diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index e145ff1ab..2b5345260 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -1,7 +1,7 @@ - * + * * @ORM\Entity() * @ORM\Table("chill_doc.stored_object") * @AsyncFileExists( @@ -27,51 +27,49 @@ class StoredObject implements AsyncFileInterface * @ORM\Column(type="integer") */ private $id; - + /** * @ORM\Column(type="text") */ private $filename; - + /** * @ORM\Column(type="json_array", name="key") * @var array */ private $keyInfos = array(); - + /** * - * @var int[] + * @var int[] * @ORM\Column(type="json_array", name="iv") */ private $iv = array(); - + /** * * @var \DateTime * @ORM\Column(type="datetime", name="creation_date") */ private $creationDate; - + /** - * - * @var string * @ORM\Column(type="text", name="type") */ - private $type = ''; - + private string $type = ''; + /** * * @var array * @ORM\Column(type="json_array", name="datas") */ private $datas = []; - + public function __construct() { $this->creationDate = new \DateTime(); } - + public function getId() { return $this->id; @@ -100,35 +98,39 @@ class StoredObject implements AsyncFileInterface public function setFilename($filename) { $this->filename = $filename; - + return $this; } public function setCreationDate(\DateTime $creationDate) { $this->creationDate = $creationDate; + return $this; } public function setType($type) { $this->type = $type; - + return $this; } public function setDatas(array $datas) { $this->datas = $datas; - + return $this; } + /** + * @deprecated Use method "getFilename()". + */ public function getObjectName() { return $this->getFilename(); } - + public function getKeyInfos() { return $this->keyInfos; @@ -142,14 +144,14 @@ class StoredObject implements AsyncFileInterface public function setKeyInfos($keyInfos) { $this->keyInfos = $keyInfos; - + return $this; } public function setIv($iv) { $this->iv = $iv; - + return $this; } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php new file mode 100644 index 000000000..4da7b4ca9 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php @@ -0,0 +1,51 @@ +repository = $entityManager->getRepository(StoredObject::class); + } + + /** + * @return array + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @return array + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria): ?StoredObject + { + return $this->repository->findOneBy($criteria); + } + + public function getClassName(): string + { + return StoredObject::class; + } + + public function find($id, $lockMode = null, $lockVersion = null): ?StoredObject + { + return $this->repository->find($id, $lockMode, $lockVersion); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index 79aa64ffa..812edab06 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -2,6 +2,12 @@ parameters: # cl_chill_person.example.class: Chill\PersonBundle\Example services: + Chill\DocStoreBundle\Repository\: + autowire: true + autoconfigure: true + resource: '../Repository/' + tags: ['doctrine.repository_service'] + Chill\DocStoreBundle\Form\DocumentCategoryType: class: Chill\DocStoreBundle\Form\DocumentCategoryType arguments: ['%kernel.bundles%']