diff --git a/config/packages/mapping/ProjectEntity.orm.xml b/config/packages/mapping/ProjectEntity.orm.xml new file mode 100644 index 0000000..c0d4f0e --- /dev/null +++ b/config/packages/mapping/ProjectEntity.orm.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Repository/ProjectRepository.php b/src/Repository/ProjectRepository.php new file mode 100644 index 0000000..2f5943b --- /dev/null +++ b/src/Repository/ProjectRepository.php @@ -0,0 +1,56 @@ + 'desc', + 'name' => 'asc' + ]; + + /** + * {@inheritdoc} + */ + public function findAll($onlyActive = false): array + { + $critera = []; + if ($onlyActive) { + $critera['active'] = True; + } + return $this->findBy($critera); + } + + /** + * {@inheritdoc} + */ + public function findBy(array $criteria, ?array $orderBy = self::DEFAULT_ORDER, $limit = null, $offset = null) + { + return parent::findBy($criteria, $orderBy, $limit, $offset); + } + + /** + * {@inheritdoc} + */ + public function createQueryBuilder($alias, $indexBy = null): QueryBuilder + { + $queryBuilder = parent::createQueryBuilder($alias, $indexBy); + foreach ($this::DEFAULT_ORDER as $field => $order) { + $queryBuilder->addOrderBy($alias . '.' . $field, $order); + } + + return $queryBuilder; + } + + /** + * {@inheritdoc} + */ + public function find($id, $lockMode = null, $lockVersion = null): ?ProjectEntity + { + return parent::find($id, $lockMode = null, $lockVersion = null); + } +} \ No newline at end of file