mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
refactor: Update ChillDocStoreBundle - Add StoredObject repository.
This commit is contained in:
parent
cd59f3a913
commit
f358f1af8d
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
*
|
declare(strict_types=1);
|
||||||
*/
|
|
||||||
namespace Chill\DocStoreBundle\Entity;
|
namespace Chill\DocStoreBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
@ -54,11 +54,9 @@ class StoredObject implements AsyncFileInterface
|
|||||||
private $creationDate;
|
private $creationDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @ORM\Column(type="text", name="type")
|
* @ORM\Column(type="text", name="type")
|
||||||
*/
|
*/
|
||||||
private $type = '';
|
private string $type = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -107,6 +105,7 @@ class StoredObject implements AsyncFileInterface
|
|||||||
public function setCreationDate(\DateTime $creationDate)
|
public function setCreationDate(\DateTime $creationDate)
|
||||||
{
|
{
|
||||||
$this->creationDate = $creationDate;
|
$this->creationDate = $creationDate;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,6 +123,9 @@ class StoredObject implements AsyncFileInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use method "getFilename()".
|
||||||
|
*/
|
||||||
public function getObjectName()
|
public function getObjectName()
|
||||||
{
|
{
|
||||||
return $this->getFilename();
|
return $this->getFilename();
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
|
final class StoredObjectRepository implements ObjectRepository
|
||||||
|
{
|
||||||
|
private EntityRepository $repository;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
|
{
|
||||||
|
$this->repository = $entityManager->getRepository(StoredObject::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, StoredObject>
|
||||||
|
*/
|
||||||
|
public function findAll(): array
|
||||||
|
{
|
||||||
|
return $this->repository->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, StoredObject>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,12 @@ parameters:
|
|||||||
# cl_chill_person.example.class: Chill\PersonBundle\Example
|
# cl_chill_person.example.class: Chill\PersonBundle\Example
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
Chill\DocStoreBundle\Repository\:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
resource: '../Repository/'
|
||||||
|
tags: ['doctrine.repository_service']
|
||||||
|
|
||||||
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
||||||
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
||||||
arguments: ['%kernel.bundles%']
|
arguments: ['%kernel.bundles%']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user