| Total Complexity | 6 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class HttpRepository |
||
| 10 | { |
||
| 11 | private $manager; |
||
| 12 | |||
| 13 | private $stack; |
||
| 14 | |||
| 15 | private $repo; |
||
| 16 | |||
| 17 | public function __construct( |
||
| 18 | EntityManagerInterface $manager, |
||
| 19 | RequestStack $stack |
||
| 20 | ) { |
||
| 21 | $this->manager = $manager; |
||
| 22 | $this->stack = $stack; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function setRepo(BaseRepository $repo) |
||
| 26 | { |
||
| 27 | $this->repo = $repo; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function buildForEntity(string $entityClassName) |
||
| 31 | { |
||
| 32 | if (!$this->repo) { |
||
| 33 | $this->repo = new BaseRepository( |
||
| 34 | $this->manager, |
||
| 35 | $this->manager->getClassMetadata($entityClassName) |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->repo->setRequest($this->stack->getCurrentRequest()); |
||
| 40 | |||
| 41 | $this->query = $this->repo |
||
|
|
|||
| 42 | ->getQueryBuilderFactory() |
||
| 43 | ->filter() |
||
| 44 | ->sort() |
||
| 45 | ->getQueryBuilder() |
||
| 46 | ->getQuery(); |
||
| 47 | } |
||
| 48 | |||
| 49 | public function getSql() |
||
| 52 | } |
||
| 53 | |||
| 54 | public function getResult() |
||
| 57 | } |
||
| 58 | } |
||
| 59 |