Add LazaretCheck, update LazaretFile

This commit is contained in:
Romain Neutron
2012-05-15 16:43:46 +02:00
parent fc0a7b87d9
commit e1c15e67ba
10 changed files with 760 additions and 39 deletions

View File

@@ -0,0 +1,81 @@
<?php
namespace Entities;
use Doctrine\ORM\Mapping as ORM;
/**
* Entities\LazaretCheck
*/
class LazaretCheck
{
/**
* @var integer $id
*/
private $id;
/**
* @var string $check
*/
private $check;
/**
* @var Entities\LazaretFile
*/
private $lazaretFile;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->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;
}
}

View File

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

View File

@@ -64,7 +64,7 @@ class LazaretSession
/**
* Get user
*
* @return \User_Adapte
* @return \User_Adapter
*/
public function getUser()
{

View File

@@ -0,0 +1,136 @@
<?php
namespace Proxies\__CG__\Entities;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class LazaretAttribute extends \Entities\LazaretAttribute implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_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);
}
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace Proxies\__CG__\Entities;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class LazaretCheck extends \Entities\LazaretCheck implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_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);
}
}
}

View File

@@ -0,0 +1,208 @@
<?php
namespace Proxies\__CG__\Entities;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class LazaretFile extends \Entities\LazaretFile implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_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);
}
}
}

View File

@@ -0,0 +1,130 @@
<?php
namespace Proxies\__CG__\Entities;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class LazaretSession extends \Entities\LazaretSession implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_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);
}
}
}

View File

@@ -1,48 +1,34 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Repositories;
use Doctrine\ORM\EntityRepository;
use Entities;
/**
* LazaretFileRepository
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class LazaretFileRepository extends EntityRepository
{
/**
* Returns all lazaret files for a given offset & limit
*
* @param int $offset
* @param int $limit
*
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function getFiles($offset, $limit)
public function findPerPage(array $base_ids, $offset = 0, $perPage = 10)
{
$qb = $this->_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;
}
}

View File

@@ -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"]

View File

@@ -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