diff --git a/lib/Doctrine/Entities/LazaretCheck.php b/lib/Doctrine/Entities/LazaretCheck.php new file mode 100644 index 0000000000..35f8b54a7d --- /dev/null +++ b/lib/Doctrine/Entities/LazaretCheck.php @@ -0,0 +1,81 @@ +id; + } + + /** + * Set check + * + * @param string $check + * @return LazaretCheck + */ + public function setCheck($check) + { + $this->check = $check; + return $this; + } + + /** + * Get check + * + * @return string + */ + public function getCheck() + { + return $this->check; + } + + /** + * Set lazaretFile + * + * @param Entities\LazaretFile $lazaretFile + * @return LazaretCheck + */ + public function setLazaretFile(\Entities\LazaretFile $lazaretFile = null) + { + $this->lazaretFile = $lazaretFile; + return $this; + } + + /** + * Get lazaretFile + * + * @return Entities\LazaretFile + */ + public function getLazaretFile() + { + return $this->lazaretFile; + } +} \ No newline at end of file diff --git a/lib/Doctrine/Entities/LazaretFile.php b/lib/Doctrine/Entities/LazaretFile.php index e273425068..ed86c1fa48 100644 --- a/lib/Doctrine/Entities/LazaretFile.php +++ b/lib/Doctrine/Entities/LazaretFile.php @@ -54,6 +54,21 @@ class LazaretFile */ private $session; + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + private $checks; + + /** + * @var string $originalName + */ + private $originalName; + + /** + * @var boolean $forced + */ + private $forced = false; + public function __construct() { $this->attributes = new \Doctrine\Common\Collections\ArrayCollection(); @@ -244,11 +259,6 @@ class LazaretFile { return $this->session; } - /** - * @var string $originalName - */ - private $originalName; - /** * Set originalName @@ -272,6 +282,50 @@ class LazaretFile return $this->originalName; } + /** + * Add checks + * + * @param Entities\LazaretCheck $checks + * @return LazaretFile + */ + public function addLazaretCheck(\Entities\LazaretCheck $checks) + { + $this->checks[] = $checks; + return $this; + } + + /** + * Get checks + * + * @return Doctrine\Common\Collections\Collection + */ + public function getChecks() + { + return $this->checks; + } + + /** + * Set forced + * + * @param boolean $forced + * @return LazaretFile + */ + public function setForced($forced) + { + $this->forced = $forced; + return $this; + } + + /** + * Get forced + * + * @return boolean + */ + public function getForced() + { + return $this->forced; + } + /** * Get the Destination Collection * diff --git a/lib/Doctrine/Entities/LazaretSession.php b/lib/Doctrine/Entities/LazaretSession.php index a5d2044272..57f03213bf 100644 --- a/lib/Doctrine/Entities/LazaretSession.php +++ b/lib/Doctrine/Entities/LazaretSession.php @@ -64,7 +64,7 @@ class LazaretSession /** * Get user * - * @return \User_Adapte + * @return \User_Adapter */ public function getUser() { @@ -157,4 +157,4 @@ class LazaretSession $this->files[] = $files; return $this; } -} \ No newline at end of file +} diff --git a/lib/Doctrine/Proxies/__CG__EntitiesLazaretAttribute.php b/lib/Doctrine/Proxies/__CG__EntitiesLazaretAttribute.php new file mode 100644 index 0000000000..858e18313f --- /dev/null +++ b/lib/Doctrine/Proxies/__CG__EntitiesLazaretAttribute.php @@ -0,0 +1,136 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + /** @private */ + public function __isInitialized() + { + return $this->__isInitialized__; + } + + + public function getId() + { + if ($this->__isInitialized__ === false) { + return (int) $this->_identifier["id"]; + } + $this->__load(); + return parent::getId(); + } + + public function setName($name) + { + $this->__load(); + return parent::setName($name); + } + + public function getName() + { + $this->__load(); + return parent::getName(); + } + + public function setValue($value) + { + $this->__load(); + return parent::setValue($value); + } + + public function getValue() + { + $this->__load(); + return parent::getValue(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setLazaretFile(\Entities\LazaretFile $lazaretFile = NULL) + { + $this->__load(); + return parent::setLazaretFile($lazaretFile); + } + + public function getLazaretFile() + { + $this->__load(); + return parent::getLazaretFile(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'name', 'value', 'created', 'updated', 'lazaretFile'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/__CG__EntitiesLazaretCheck.php b/lib/Doctrine/Proxies/__CG__EntitiesLazaretCheck.php new file mode 100644 index 0000000000..fa7e104d57 --- /dev/null +++ b/lib/Doctrine/Proxies/__CG__EntitiesLazaretCheck.php @@ -0,0 +1,100 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + /** @private */ + public function __isInitialized() + { + return $this->__isInitialized__; + } + + + public function getId() + { + if ($this->__isInitialized__ === false) { + return (int) $this->_identifier["id"]; + } + $this->__load(); + return parent::getId(); + } + + public function setCheck($check) + { + $this->__load(); + return parent::setCheck($check); + } + + public function getCheck() + { + $this->__load(); + return parent::getCheck(); + } + + public function setLazaretFile(\Entities\LazaretFile $lazaretFile = NULL) + { + $this->__load(); + return parent::setLazaretFile($lazaretFile); + } + + public function getLazaretFile() + { + $this->__load(); + return parent::getLazaretFile(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'check', 'lazaretFile'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/__CG__EntitiesLazaretFile.php b/lib/Doctrine/Proxies/__CG__EntitiesLazaretFile.php new file mode 100644 index 0000000000..c024c767d0 --- /dev/null +++ b/lib/Doctrine/Proxies/__CG__EntitiesLazaretFile.php @@ -0,0 +1,208 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + /** @private */ + public function __isInitialized() + { + return $this->__isInitialized__; + } + + + public function getId() + { + if ($this->__isInitialized__ === false) { + return (int) $this->_identifier["id"]; + } + $this->__load(); + return parent::getId(); + } + + public function setPathname($pathname) + { + $this->__load(); + return parent::setPathname($pathname); + } + + public function getPathname() + { + $this->__load(); + return parent::getPathname(); + } + + public function setBaseId($baseId) + { + $this->__load(); + return parent::setBaseId($baseId); + } + + public function getBaseId() + { + $this->__load(); + return parent::getBaseId(); + } + + public function setUuid($uuid) + { + $this->__load(); + return parent::setUuid($uuid); + } + + public function getUuid() + { + $this->__load(); + return parent::getUuid(); + } + + public function setSha256($sha256) + { + $this->__load(); + return parent::setSha256($sha256); + } + + public function getSha256() + { + $this->__load(); + return parent::getSha256(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function addLazaretAttribute(\Entities\LazaretAttribute $attributes) + { + $this->__load(); + return parent::addLazaretAttribute($attributes); + } + + public function getAttributes() + { + $this->__load(); + return parent::getAttributes(); + } + + public function setSession(\Entities\LazaretSession $session = NULL) + { + $this->__load(); + return parent::setSession($session); + } + + public function getSession() + { + $this->__load(); + return parent::getSession(); + } + + public function setOriginalName($originalName) + { + $this->__load(); + return parent::setOriginalName($originalName); + } + + public function getOriginalName() + { + $this->__load(); + return parent::getOriginalName(); + } + + public function addLazaretCheck(\Entities\LazaretCheck $checks) + { + $this->__load(); + return parent::addLazaretCheck($checks); + } + + public function getChecks() + { + $this->__load(); + return parent::getChecks(); + } + + public function setForced($forced) + { + $this->__load(); + return parent::setForced($forced); + } + + public function getForced() + { + $this->__load(); + return parent::getForced(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'pathname', 'originalName', 'base_id', 'uuid', 'sha256', 'forced', 'created', 'updated', 'attributes', 'checks', 'session'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/__CG__EntitiesLazaretSession.php b/lib/Doctrine/Proxies/__CG__EntitiesLazaretSession.php new file mode 100644 index 0000000000..eacb40db77 --- /dev/null +++ b/lib/Doctrine/Proxies/__CG__EntitiesLazaretSession.php @@ -0,0 +1,130 @@ +_entityPersister = $entityPersister; + $this->_identifier = $identifier; + } + /** @private */ + public function __load() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + + if (method_exists($this, "__wakeup")) { + // call this after __isInitialized__to avoid infinite recursion + // but before loading to emulate what ClassMetadata::newInstance() + // provides. + $this->__wakeup(); + } + + if ($this->_entityPersister->load($this->_identifier, $this) === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + unset($this->_entityPersister, $this->_identifier); + } + } + + /** @private */ + public function __isInitialized() + { + return $this->__isInitialized__; + } + + + public function getId() + { + if ($this->__isInitialized__ === false) { + return (int) $this->_identifier["id"]; + } + $this->__load(); + return parent::getId(); + } + + public function setUsrId($usrId) + { + $this->__load(); + return parent::setUsrId($usrId); + } + + public function getUsrId() + { + $this->__load(); + return parent::getUsrId(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function addLazaretFiles(\Entities\LazaretFile $files) + { + $this->__load(); + return parent::addLazaretFiles($files); + } + + public function getFiles() + { + $this->__load(); + return parent::getFiles(); + } + + public function addLazaretFile(\Entities\LazaretFile $files) + { + $this->__load(); + return parent::addLazaretFile($files); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'usr_id', 'created', 'updated', 'files'); + } + + public function __clone() + { + if (!$this->__isInitialized__ && $this->_entityPersister) { + $this->__isInitialized__ = true; + $class = $this->_entityPersister->getClassMetadata(); + $original = $this->_entityPersister->load($this->_identifier); + if ($original === null) { + throw new \Doctrine\ORM\EntityNotFoundException(); + } + foreach ($class->reflFields AS $field => $reflProperty) { + $reflProperty->setValue($this, $reflProperty->getValue($original)); + } + unset($this->_entityPersister, $this->_identifier); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Repositories/LazaretFileRepository.php b/lib/Doctrine/Repositories/LazaretFileRepository.php index 0320696963..290a87e2ec 100644 --- a/lib/Doctrine/Repositories/LazaretFileRepository.php +++ b/lib/Doctrine/Repositories/LazaretFileRepository.php @@ -1,48 +1,34 @@ _em->createQueryBuilder(); + $base_ids = implode(', ', array_map(function($int) { + return (int) $int; + }, $base_ids)); - $qb - ->add('select', 'l') - ->add('from', 'Entities\LazaretFile l') - ->add('orderBy', 'l.updated DESC') - ->setFirstResult($offset) - ->setMaxResults($limit); + $dql = 'SELECT f + FROM Entities\LazaretFile f + WHERE f.base_id IN (' . $base_ids . ') ORDER BY id DESC'; - $query = $qb->getQuery(); + $query = $this->_em->createQuery($dql); + $query->setFirstResult($offset) + ->setMaxResults($perPage); - return $query->getResult(); + $paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query, true); + + return $paginator; } } diff --git a/lib/conf.d/Doctrine/Entities.LazaretCheck.dcm.yml b/lib/conf.d/Doctrine/Entities.LazaretCheck.dcm.yml new file mode 100644 index 0000000000..0ffdf00a5e --- /dev/null +++ b/lib/conf.d/Doctrine/Entities.LazaretCheck.dcm.yml @@ -0,0 +1,20 @@ +Entities\LazaretCheck: + type: entity + table: LazaretChecks + id: + id: + type: integer + generator: + strategy: AUTO + fields: + check: + type: string + length: 512 + manyToOne: + lazaretFile: + targetEntity: LazaretFile + inversedBy: checks + joinColumn: + name: lazaret_file_id + referencedColumnName: id + cascade: ["persist"] diff --git a/lib/conf.d/Doctrine/Entities.LazaretFile.dcm.yml b/lib/conf.d/Doctrine/Entities.LazaretFile.dcm.yml index 0578078efe..0b723dd529 100644 --- a/lib/conf.d/Doctrine/Entities.LazaretFile.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.LazaretFile.dcm.yml @@ -17,13 +17,13 @@ Entities\LazaretFile: base_id: type: integer uuid: - #check collation in tests type: string length: 36 sha256: - #check collation in tests type: string length: 64 + forced: + type: boolean created: type: datetime gedmo: @@ -49,3 +49,9 @@ Entities\LazaretFile: cascade: ["ALL"] orderBy: id: ASC + checks: + targetEntity: LazaretCheck + mappedBy: lazaretFile + cascade: ["ALL"] + orderBy: + id: ASC