Moved yaml doctrine conf to annotation

This commit is contained in:
Andrey
2013-08-05 17:27:21 +02:00
parent 03f6b9199e
commit 22f55855d1
18 changed files with 301 additions and 148 deletions

View File

@@ -48,15 +48,39 @@ class ORMServiceProvider implements ServiceProviderInterface
$config->setSQLLogger($app['EM.sql-logger']); $config->setSQLLogger($app['EM.sql-logger']);
} }
\Doctrine\Common\Annotations\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 \Doctrine\Common\Annotations\AnnotationReader;
$cachedAnnotationReader = new \Doctrine\Common\Annotations\CachedReader(
$annotationReader,
new \Doctrine\Common\Cache\ArrayCache
);
$driverChain = new \Doctrine\ORM\Mapping\Driver\DriverChain();
\Gedmo\DoctrineExtensions::registerAbstractMappingIntoDriverChainORM(
$driverChain,
$cachedAnnotationReader
);
$annotationDriver = new \Doctrine\ORM\Mapping\Driver\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 +88,12 @@ 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(); // $driverYaml = new YamlDriver(array($app['root.path'] . '/lib/conf.d/Doctrine'));
$driverYaml = new YamlDriver(array($app['root.path'] . '/lib/conf.d/Doctrine')); // $chainDriverImpl->addDriver($driverYaml, 'Entities');
$chainDriverImpl->addDriver($driverYaml, 'Entities');
$chainDriverImpl->addDriver($driverYaml, 'Gedmo\Timestampable'); $config->setMetadataDriverImpl($driverChain);
$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

@@ -12,39 +12,47 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; 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

@@ -12,24 +12,30 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* 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

@@ -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;
/** /**
* 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

@@ -12,39 +12,47 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; 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,60 @@
namespace Entities; namespace Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* 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", mappedBy="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;