Merge pull request #545 from csaoh/yaml_to_anno

[3.9] Moved yaml doctrine conf to annotation
This commit is contained in:
Romain Neutron
2013-08-06 08:59:59 -07:00
35 changed files with 302 additions and 791 deletions

View File

@@ -12,13 +12,17 @@
namespace Alchemy\Phrasea\Core\Provider; namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Exception\RuntimeException;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\FileCacheReader;
use Doctrine\Common\EventManager; use Doctrine\Common\EventManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\DriverChain; use Doctrine\ORM\Mapping\Driver\DriverChain;
use Doctrine\ORM\Mapping\Driver\YamlDriver;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Configuration as ORMConfiguration; use Doctrine\ORM\Configuration as ORMConfiguration;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use Doctrine\Logger\MonologSQLLogger; use Doctrine\Logger\MonologSQLLogger;
use Gedmo\DoctrineExtensions;
use Gedmo\Timestampable\TimestampableListener; use Gedmo\Timestampable\TimestampableListener;
use Monolog\Logger; use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\RotatingFileHandler;
@@ -48,15 +52,40 @@ class ORMServiceProvider implements ServiceProviderInterface
$config->setSQLLogger($app['EM.sql-logger']); $config->setSQLLogger($app['EM.sql-logger']);
} }
AnnotationRegistry::registerFile(
$app['root.path'].'/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
);
$opCodeCacheType = $app['phraseanet.configuration']['main']['opcodecache']['type']; $opCodeCacheType = $app['phraseanet.configuration']['main']['opcodecache']['type'];
$opCodeCacheOptions = $app['phraseanet.configuration']['main']['opcodecache']['options']; $opCodeCacheOptions = $app['phraseanet.configuration']['main']['opcodecache']['options'];
$cacheType = $app['phraseanet.configuration']['main']['cache']['type']; $cacheType = $app['phraseanet.configuration']['main']['cache']['type'];
$cacheOptions = $app['phraseanet.configuration']['main']['cache']['options']; $cacheOptions = $app['phraseanet.configuration']['main']['cache']['options'];
$annotationReader = new AnnotationReader();
$fileCacheReader = new FileCacheReader(
$annotationReader,
$app['root.path']."/tmp/doctrine",
$app['debug']
);
$driverChain = new DriverChain();
DoctrineExtensions::registerAbstractMappingIntoDriverChainORM(
$driverChain,
$fileCacheReader
);
$annotationDriver = new AnnotationDriver(
$annotationReader,
array($app['root.path'].'/lib/Doctrine/Entities')
);
$driverChain->addDriver($annotationDriver, 'Entities');
$config->setMetadataCacheImpl($app['phraseanet.cache-service']->factory( $config->setMetadataCacheImpl($app['phraseanet.cache-service']->factory(
'ORMmetadata', $opCodeCacheType, $opCodeCacheOptions 'ORMmetadata', $opCodeCacheType, $opCodeCacheOptions
)); ));
$config->setQueryCacheImpl($app['phraseanet.cache-service']->factory( $config->setQueryCacheImpl($app['phraseanet.cache-service']->factory(
'ORMquery', $opCodeCacheType, $opCodeCacheOptions 'ORMquery', $opCodeCacheType, $opCodeCacheOptions
)); ));
@@ -64,14 +93,9 @@ class ORMServiceProvider implements ServiceProviderInterface
'ORMresult', $cacheType, $cacheOptions 'ORMresult', $cacheType, $cacheOptions
)); ));
//define autoregeneration of proxies base on debug mode
$config->setAutoGenerateProxyClasses($app['debug']); $config->setAutoGenerateProxyClasses($app['debug']);
$chainDriverImpl = new DriverChain(); $config->setMetadataDriverImpl($driverChain);
$driverYaml = new YamlDriver(array($app['root.path'] . '/lib/conf.d/Doctrine'));
$chainDriverImpl->addDriver($driverYaml, 'Entities');
$chainDriverImpl->addDriver($driverYaml, 'Gedmo\Timestampable');
$config->setMetadataDriverImpl($chainDriverImpl);
$config->setProxyDir($app['root.path'] . '/lib/Doctrine/Proxies'); $config->setProxyDir($app['root.path'] . '/lib/Doctrine/Proxies');
$config->setProxyNamespace('Proxies'); $config->setProxyNamespace('Proxies');

View File

@@ -12,34 +12,39 @@
namespace Entities; namespace Entities;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* AuthFailure * @ORM\Table(name="AuthFailures")
* @ORM\Entity(repositoryClass="Repositories\AuthFailureRepository")
*/ */
class AuthFailure class AuthFailure
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var string * @ORM\Column(type="string", length=128)
*/ */
private $username; private $username;
/** /**
* @var string * @ORM\Column(type="string", length=128, nullable=true)
*/ */
private $ip; private $ip;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $locked; private $locked;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;

View File

@@ -12,9 +12,12 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* Basket * @ORM\Table(name="Baskets")
* @ORM\Entity(repositoryClass="Repositories\BasketRepository")
*/ */
class Basket class Basket
{ {
@@ -23,57 +26,62 @@ class Basket
const ELEMENTSORDER_ASC = 'asc'; const ELEMENTSORDER_ASC = 'asc';
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var string * @ORM\Column(type="string", length=128)
*/ */
private $name; private $name;
/** /**
* @var string * @ORM\Column(type="text", nullable=true)
*/ */
private $description; private $description;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $is_read = false; private $is_read = false;
/** /**
* @var integer * @ORM\Column(type="integer", nullable=true)
*/ */
private $pusher_id; private $pusher_id;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $archived = false; private $archived = false;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Entities\ValidationSession * @ORM\OneToOne(targetEntity="ValidationSession", mappedBy="basket", cascade={"ALL"})
*/ */
private $validation; private $validation;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="BasketElement", mappedBy="basket", cascade={"ALL"})
* @ORM\OrderBy({"ord" = "ASC"})
*/ */
private $elements; private $elements;

View File

@@ -13,49 +13,57 @@ namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* BasketElement * @ORM\Table(name="BasketElements", uniqueConstraints={@ORM\UniqueConstraint(name="unique_recordcle", columns={"basket_id","sbas_id","record_id"})})
* @ORM\Entity(repositoryClass="Repositories\BasketElementRepository")
* @ORM\HasLifecycleCallbacks
*/ */
class BasketElement class BasketElement
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $record_id; private $record_id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $sbas_id; private $sbas_id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $ord; private $ord;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="ValidationData", mappedBy="basket_element", cascade={"all"})
*/ */
private $validation_datas; private $validation_datas;
/** /**
* @var \Entities\Basket * @ORM\ManyToOne(targetEntity="Basket", inversedBy="elements", cascade={"persist"})
* @ORM\JoinColumn(name="basket_id", referencedColumnName="id")
*/ */
private $basket; private $basket;

View File

@@ -11,40 +11,47 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* LazaretAttribute * @ORM\Table(name="LazaretAttributes")
* @ORM\Entity
*/ */
class LazaretAttribute class LazaretAttribute
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var string * @ORM\Column(type="string", length=64)
*/ */
private $name; private $name;
/** /**
* @var string * @ORM\Column(type="string", length=2048)
*/ */
private $value; private $value;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Entities\LazaretFile * @ORM\ManyToOne(targetEntity="LazaretFile", inversedBy="attributes", cascade={"persist"})
* @ORM\JoinColumn(name="lazaret_file_id", referencedColumnName="id")
*/ */
private $lazaretFile; private $lazaretFile;

View File

@@ -11,25 +11,29 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Doctrine\ORM\Mapping as ORM;
/** /**
* LazaretCheck * @ORM\Table(name="LazaretChecks")
* @ORM\Entity
*/ */
class LazaretCheck class LazaretCheck
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var string * @ORM\Column(type="string", length=512)
*/ */
private $checkClassname; private $checkClassname;
/** /**
* @var \Entities\LazaretFile * @ORM\ManyToOne(targetEntity="LazaretFile", inversedBy="checks", cascade={"persist"})
* @ORM\JoinColumn(name="lazaret_file_id", referencedColumnName="id")
*/ */
private $lazaretFile; private $lazaretFile;

View File

@@ -12,74 +12,84 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* LazaretFile * @ORM\Table(name="LazaretFiles")
* @ORM\Entity(repositoryClass="Repositories\LazaretFileRepository")
*/ */
class LazaretFile class LazaretFile
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var string * @ORM\Column(type="string", length=512)
*/ */
private $filename; private $filename;
/** /**
* @var string * @ORM\Column(type="string", length=512)
*/ */
private $thumbFilename; private $thumbFilename;
/** /**
* @var string * @ORM\Column(type="string", length=256)
*/ */
private $originalName; private $originalName;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $base_id; private $base_id;
/** /**
* @var string * @ORM\Column(type="string", length=36)
*/ */
private $uuid; private $uuid;
/** /**
* @var string * @ORM\Column(type="string", length=64)
*/ */
private $sha256; private $sha256;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $forced = false; private $forced = false;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="LazaretAttribute", mappedBy="lazaretFile", cascade={"all"})
* @ORM\OrderBy({"id" = "ASC"})
*/ */
private $attributes; private $attributes;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="LazaretCheck", mappedBy="lazaretFile", cascade={"all"})
* @ORM\OrderBy({"id" = "ASC"})
*/ */
private $checks; private $checks;
/** /**
* @var \Entities\LazaretSession * @ORM\ManyToOne(targetEntity="LazaretSession", inversedBy="files", cascade={"persist"})
* @ORM\JoinColumn(name="lazaret_session_id", referencedColumnName="id")
*/ */
private $session; private $session;

View File

@@ -12,34 +12,42 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* LazaretSession * @ORM\Table(name="LazaretSessions")
* @ORM\Entity
*/ */
class LazaretSession class LazaretSession
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer", nullable=true)
*/ */
private $usr_id; private $usr_id;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="LazaretFile", mappedBy="session", cascade={"all"})
* @ORM\OrderBy({"id" = "ASC"})
*/ */
private $files; private $files;

View File

@@ -12,79 +12,87 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* Session * @ORM\Table(name="Sessions", indexes={@ORM\index(name="usr_id", columns={"usr_id"})})
* @ORM\Entity(repositoryClass="Repositories\SessionRepository")
*/ */
class Session class Session
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var string * @ORM\Column(type="string", length=512)
*/ */
private $user_agent; private $user_agent;
/** /**
* @var string * @ORM\Column(type="string", length=40, nullable=true)
*/ */
private $ip_address; private $ip_address;
/** /**
* @var string * @ORM\Column(type="string", length=128, nullable=true)
*/ */
private $platform; private $platform;
/** /**
* @var string * @ORM\Column(type="string", length=128, nullable=true)
*/ */
private $browser_name; private $browser_name;
/** /**
* @var string * @ORM\Column(type="string", length=32, nullable=true)
*/ */
private $browser_version; private $browser_version;
/** /**
* @var integer * @ORM\Column(type="integer", nullable=true)
*/ */
private $screen_width; private $screen_width;
/** /**
* @var integer * @ORM\Column(type="integer", nullable=true)
*/ */
private $screen_height; private $screen_height;
/** /**
* @var string * @ORM\Column(type="string", length=128, nullable=true, unique=true)
*/ */
private $token; private $token;
/** /**
* @var string * @ORM\Column(type="string", length=16, nullable=true)
*/ */
private $nonce; private $nonce;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="SessionModule", mappedBy="session", cascade={"all"})
* @ORM\OrderBy({"module_id" = "ASC"})
*/ */
private $modules; private $modules;

View File

@@ -11,35 +11,42 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* SessionModule * @ORM\Table(name="SessionModules", uniqueConstraints={@ORM\UniqueConstraint(name="unique_module", columns={"session_id", "module_id"})})
* @ORM\Entity(repositoryClass="Repositories\SessionModuleRepository")
*/ */
class SessionModule class SessionModule
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $module_id; private $module_id;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Entities\Session * @ORM\ManyToOne(targetEntity="Session", inversedBy="modules", cascade={"persist"})
* @ORM\JoinColumn(name="session_id", referencedColumnName="id")
*/ */
private $session; private $session;

View File

@@ -13,33 +13,40 @@ namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* StoryWZ * @ORM\Table(name="StoryWZ", uniqueConstraints={@ORM\UniqueConstraint(name="user_story", columns={"usr_id", "sbas_id", "record_id"})})
* @ORM\Entity(repositoryClass="Repositories\StoryWZRepository")
*/ */
class StoryWZ class StoryWZ
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $sbas_id; private $sbas_id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $record_id; private $record_id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;

View File

@@ -3,42 +3,52 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* UsrAuthProvider * @ORM\Table(name="UsrAuthProviders", uniqueConstraints={
* @ORM\UniqueConstraint(name="unique_provider_per_user", columns={"usr_id", "provider"}),
* @ORM\UniqueConstraint(name="provider_ids", columns={"provider", "distant_id"})
* })
* @ORM\Entity(repositoryClass="Repositories\UsrAuthProviderRepository")
*/ */
class UsrAuthProvider class UsrAuthProvider
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var string * @ORM\Column(type="string", length=32)
*/ */
private $provider; private $provider;
/** /**
* @var string * @ORM\Column(type="string", length=192)
*/ */
private $distant_id; private $distant_id;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
*/ * @ORM\Column(type="datetime")
private $updated;
/**
* @var \DateTime
*/ */
private $created; private $created;
/**
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
private $updated;
/** /**
* Get id * Get id
* *

View File

@@ -12,39 +12,46 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* UsrList * @ORM\Table(name="UsrLists")
* @ORM\Entity(repositoryClass="Repositories\UsrListRepository")
*/ */
class UsrList class UsrList
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var string * @ORM\Column(type="string")
*/ */
private $name; private $name;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="UsrListOwner", mappedBy="list", cascade={"all"})
*/ */
private $owners; private $owners;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="UsrListEntry", mappedBy="list", cascade={"all"})
*/ */
private $entries; private $entries;

View File

@@ -12,34 +12,42 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* UsrListEntry * @ORM\Table(name="UsrListsContent", uniqueConstraints={@ORM\UniqueConstraint(name="unique_usr_per_list", columns={"usr_id", "list_id"})})
* @ORM\Entity(repositoryClass="Repositories\UsrListEntryRepository")
*/ */
class UsrListEntry class UsrListEntry
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Entities\UsrList * @ORM\ManyToOne(targetEntity="UsrList", inversedBy="entries", cascade={"persist"})
* @ORM\JoinColumn(name="list_id", referencedColumnName="id")
*/ */
private $list; private $list;

View File

@@ -12,9 +12,12 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* UsrListOwner * @ORM\Table(name="UsrListOwners", uniqueConstraints={@ORM\UniqueConstraint(name="unique_owner", columns={"usr_id", "id"})})
* @ORM\Entity(repositoryClass="Repositories\UsrListOwnerRepository")
*/ */
class UsrListOwner class UsrListOwner
{ {
@@ -23,32 +26,37 @@ class UsrListOwner
const ROLE_ADMIN = 3; const ROLE_ADMIN = 3;
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var string * @ORM\Column(type="string")
*/ */
private $role; private $role;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Entities\UsrList * @ORM\ManyToOne(targetEntity="UsrList", inversedBy="owners", cascade={"persist"})
* @ORM\JoinColumn(name="list_id", referencedColumnName="id")
*/ */
private $list; private $list;

View File

@@ -11,40 +11,47 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* ValidationData * @ORM\Table(name="ValidationDatas")
* @ORM\Entity
*/ */
class ValidationData class ValidationData
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var boolean * @ORM\Column(type="boolean", nullable=true)
*/ */
private $agreement; private $agreement;
/** /**
* @var string * @ORM\Column(type="text", nullable=true)
*/ */
private $note; private $note;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \Entities\ValidationParticipant * @ORM\ManyToOne(targetEntity="ValidationParticipant", inversedBy="datas", cascade={"persist"})
* @ORM\JoinColumn(name="participant_id", referencedColumnName="id")
*/ */
private $participant; private $participant;
/** /**
* @var \Entities\BasketElement * @ORM\ManyToOne(targetEntity="BasketElement", inversedBy="validation_datas", cascade={"persist"})
* @ORM\JoinColumn(name="basket_element_id", referencedColumnName="id")
*/ */
private $basket_element; private $basket_element;

View File

@@ -12,54 +12,59 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
/** /**
* ValidationParticipant * @ORM\Table(name="ValidationParticipants")
* @ORM\Entity(repositoryClass="Repositories\ValidationParticipantRepository")
*/ */
class ValidationParticipant class ValidationParticipant
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $usr_id; private $usr_id;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $is_aware = false; private $is_aware = false;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $is_confirmed = false; private $is_confirmed = false;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $can_agree = false; private $can_agree = false;
/** /**
* @var boolean * @ORM\Column(type="boolean")
*/ */
private $can_see_others = false; private $can_see_others = false;
/** /**
* @var \DateTime * @ORM\Column(type="datetime", nullable=true)
*/ */
private $reminded; private $reminded;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="ValidationData", mappedBy="participant", cascade={"all"})
*/ */
private $datas; private $datas;
/** /**
* @var \Entities\ValidationSession * @ORM\ManyToOne(targetEntity="ValidationSession", inversedBy="participants", cascade={"persist"})
* @ORM\JoinColumn(name="ValidationSession_id", referencedColumnName="id")
*/ */
private $session; private $session;

View File

@@ -12,45 +12,53 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* ValidationSession * @ORM\Table(name="ValidationSessions")
* @ORM\Entity
*/ */
class ValidationSession class ValidationSession
{ {
/** /**
* @var integer * @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $id; private $id;
/** /**
* @var integer * @ORM\Column(type="integer")
*/ */
private $initiator_id; private $initiator_id;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $created; private $created;
/** /**
* @var \DateTime * @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/ */
private $updated; private $updated;
/** /**
* @var \DateTime * @ORM\Column(type="datetime", nullable=true)
*/ */
private $expires; private $expires;
/** /**
* @var \Entities\Basket * @ORM\OneToOne(targetEntity="Basket", inversedBy="validation", cascade={"persist"})
* @ORM\JoinColumn(name="basket_id", referencedColumnName="id")
*/ */
private $basket; private $basket;
/** /**
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(targetEntity="ValidationParticipant", mappedBy="session", cascade={"all"})
*/ */
private $participants; private $participants;

View File

@@ -1,24 +0,0 @@
Entities\AuthFailure:
type: entity
repositoryClass: Repositories\AuthFailureRepository
table: AuthFailures
id:
id:
type: integer
generator:
strategy: AUTO
fields:
username:
type: string
size: 128
ip:
type: string
size: 128
nullable: true
locked:
type: boolean
created:
type: datetime
gedmo:
timestampable:
on: create

View File

@@ -1,48 +0,0 @@
Entities\Basket:
type: entity
repositoryClass: Repositories\BasketRepository
table: Baskets
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 128
description:
type: text
nullable: true
usr_id:
type: integer
is_read:
type: boolean
pusher_id:
type: integer
nullable: true
archived:
type: boolean
default: false
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
oneToOne:
validation:
targetEntity: ValidationSession
mappedBy: basket
cascade: ["ALL"]
oneToMany:
elements:
targetEntity: BasketElement
mappedBy: basket
cascade: ["ALL"]
orderBy:
ord: ASC

View File

@@ -1,45 +0,0 @@
Entities\BasketElement:
type: entity
repositoryClass: Repositories\BasketElementRepository
table: BasketElements
uniqueConstraints:
unique_recordcle:
columns: basket_id,sbas_id,record_id
id:
id:
type: integer
generator:
strategy: AUTO
fields:
record_id:
type: integer
sbas_id:
type: integer
ord:
type: integer
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
basket:
targetEntity: Basket
inversedBy: elements
joinColumn:
name: basket_id
referencedColumnName: id
cascade: ["persist"]
oneToMany:
validation_datas:
targetEntity: ValidationData
mappedBy: basket_element
cascade: ["ALL"]
lifecycleCallbacks:
prePersist: [ setLastInBasket ]

View File

@@ -1,33 +0,0 @@
Entities\LazaretAttribute:
type: entity
table: LazaretAttributes
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 64
value:
type: string
length: 2048
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
lazaretFile:
targetEntity: LazaretFile
inversedBy: attributes
joinColumn:
name: lazaret_file_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,20 +0,0 @@
Entities\LazaretCheck:
type: entity
table: LazaretChecks
id:
id:
type: integer
generator:
strategy: AUTO
fields:
checkClassname:
type: string
length: 512
manyToOne:
lazaretFile:
targetEntity: LazaretFile
inversedBy: checks
joinColumn:
name: lazaret_file_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,60 +0,0 @@
Entities\LazaretFile:
type: entity
repositoryClass: Repositories\LazaretFileRepository
table: LazaretFiles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
filename:
type: string
length: 512
thumbFilename:
type: string
length: 512
originalName:
type: string
length: 256
base_id:
type: integer
uuid:
type: string
length: 36
sha256:
type: string
length: 64
forced:
type: boolean
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
session:
targetEntity: LazaretSession
inversedBy: files
joinColumn:
name: lazaret_session_id
referencedColumnName: id
cascade: ["persist"]
oneToMany:
attributes:
targetEntity: LazaretAttribute
mappedBy: lazaretFile
cascade: ["ALL"]
orderBy:
id: ASC
checks:
targetEntity: LazaretCheck
mappedBy: lazaretFile
cascade: ["ALL"]
orderBy:
id: ASC

View File

@@ -1,29 +0,0 @@
Entities\LazaretSession:
type: entity
table: LazaretSessions
id:
id:
type: integer
generator:
strategy: AUTO
fields:
usr_id:
type: integer
nullable: true
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
oneToMany:
files:
targetEntity: LazaretFile
mappedBy: session
cascade: ["ALL"]
orderBy:
id: ASC

View File

@@ -1,66 +0,0 @@
Entities\Session:
type: entity
repositoryClass: Repositories\SessionRepository
table: Sessions
indexes:
usr_id:
columns: [ usr_id ]
id:
id:
type: integer
generator:
strategy: AUTO
fields:
usr_id:
type: integer
user_agent:
type: string
length: 512
ip_address:
type: string
length: 40
nullable: true
platform:
type: string
length: 128
nullable: true
browser_name:
type: string
length: 128
nullable: true
browser_version:
type: string
length: 32
nullable: true
screen_width:
type: integer
nullable: true
screen_height:
type: integer
nullable: true
token:
type: string
length: 128
nullable: true
unique: true
nonce:
type: string
length: 16
nullable: true
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
oneToMany:
modules:
targetEntity: SessionModule
mappedBy: session
cascade: ["ALL"]
orderBy:
module_id: ASC

View File

@@ -1,33 +0,0 @@
Entities\SessionModule:
type: entity
repositoryClass: Repositories\SessionModuleRepository
table: SessionModules
id:
id:
type: integer
generator:
strategy: AUTO
uniqueConstraints:
unique_module:
columns: session_id,module_id
fields:
module_id:
type: integer
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
session:
targetEntity: Session
inversedBy: modules
joinColumn:
name: session_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,29 +0,0 @@
Entities\StoryWZ:
type: entity
repositoryClass: Repositories\StoryWZRepository
table: StoryWZ
uniqueConstraints:
user_story:
columns: usr_id,sbas_id,record_id
id:
id:
type: integer
generator:
strategy: AUTO
fields:
sbas_id:
type: integer
record_id:
type: integer
usr_id:
type: integer
created:
type: datetime
gedmo:
timestampable:
on: create

View File

@@ -1,33 +0,0 @@
Entities\UsrAuthProvider:
type: entity
repositoryClass: Repositories\UsrAuthProviderRepository
table: UsrAuthProviders
uniqueConstraints:
unique_provider_per_user:
columns: [ usr_id, provider ]
provider_ids:
columns: [ provider, distant_id ]
id:
id:
type: integer
generator:
strategy: AUTO
fields:
usr_id:
type: integer
provider:
type: string
length: 32
distant_id:
type: string
length: 192
updated:
type: datetime
gedmo:
timestampable:
on: update
created:
type: datetime
gedmo:
timestampable:
on: create

View File

@@ -1,33 +0,0 @@
Entities\UsrList:
type: entity
repositoryClass: Repositories\UsrListRepository
table: UsrLists
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
oneToMany:
owners:
targetEntity: UsrListOwner
mappedBy: list
cascade: ["ALL"]
entries:
targetEntity: UsrListEntry
mappedBy: list
cascade: ["ALL"]

View File

@@ -1,35 +0,0 @@
Entities\UsrListEntry:
type: entity
repositoryClass: Repositories\UsrListEntryRepository
table: UsrListsContent
uniqueConstraints:
unique_usr_per_list:
columns: usr_id,list_id
id:
id:
type: integer
generator:
strategy: AUTO
fields:
usr_id:
type: integer
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
list:
targetEntity: UsrList
inversedBy: entries
joinColumn:
name: list_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,38 +0,0 @@
Entities\UsrListOwner:
type: entity
repositoryClass: Repositories\UsrListOwnerRepository
table: UsrListOwners
uniqueConstraints:
unique_owner:
columns: usr_id,id
id:
id:
type: integer
generator:
strategy: AUTO
fields:
usr_id:
type: integer
role:
type: string
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
list:
targetEntity: UsrList
inversedBy: owners
joinColumn:
name: list_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,35 +0,0 @@
Entities\ValidationData:
type: entity
table: ValidationDatas
id:
id:
type: integer
generator:
strategy: AUTO
fields:
agreement:
type: boolean
nullable: true
note:
type: text
nullable: true
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
participant:
targetEntity: ValidationParticipant
inversedBy: datas
joinColumn:
name: participant_id
referencedColumnName: id
cascade: ["persist"]
basket_element:
targetEntity: BasketElement
inversedBy: validation_datas
joinColumn:
name: basket_element_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,36 +0,0 @@
Entities\ValidationParticipant:
type: entity
repositoryClass: Repositories\ValidationParticipantRepository
table: ValidationParticipants
id:
id:
type: integer
generator:
strategy: AUTO
fields:
usr_id:
type: integer
is_aware:
type: boolean
is_confirmed:
type: boolean
can_agree:
type: boolean
can_see_others:
type: boolean
reminded:
type: datetime
nullable: true;
oneToMany:
datas:
targetEntity: ValidationData
mappedBy: participant
cascade: ["ALL"]
manyToOne:
session:
targetEntity: ValidationSession
inversedBy: participants
joinColumn:
name: ValidationSession_id
referencedColumnName: id
cascade: ["persist"]

View File

@@ -1,41 +0,0 @@
Entities\ValidationSession:
type: entity
table: ValidationSessions
id:
id:
type: integer
generator:
strategy: AUTO
fields:
initiator_id:
type: integer
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
expires:
type: datetime
nullable: true
oneToOne:
basket:
targetEntity: Basket
inversedBy: validation
joinColumn:
name: basket_id
referencedColumnName: id
cascade: ["persist"]
oneToMany:
participants:
targetEntity: ValidationParticipant
mappedBy: session
cascade: ["ALL"]