mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix: Add missing repositories, fix typing information, autoload Repository
directory.
This commit is contained in:
parent
b722106616
commit
97ab71b63d
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method ActivityReasonCategory|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method ActivityReasonCategory|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method ActivityReasonCategory[] findAll()
|
||||||
|
* @method ActivityReasonCategory[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class ActivityReasonCategoryRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, ActivityReasonCategory::class);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method ActivityReason|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method ActivityReason|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method ActivityReason[] findAll()
|
||||||
|
* @method ActivityReason[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class ActivityReasonRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, ActivityReason::class);
|
||||||
|
}
|
||||||
|
}
|
@ -1,24 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
declare(strict_types=1);
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
|
|
||||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
@ -29,10 +11,10 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method AccompanyingPeriodParticipation|null find($id, $lockMode = null, $lockVersion = null)
|
* @method Activity|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
* @method AccompanyingPeriodParticipation|null findOneBy(array $criteria, array $orderBy = null)
|
* @method Activity|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
* @method AccompanyingPeriodParticipation[] findAll()
|
* @method Activity[] findAll()
|
||||||
* @method AccompanyingPeriodParticipation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
* @method Activity[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
*/
|
*/
|
||||||
class ActivityRepository extends ServiceEntityRepository
|
class ActivityRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
@ -42,12 +24,7 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $person
|
* @return Activity[]
|
||||||
* @param array $scopes
|
|
||||||
* @param string[] $orderBy
|
|
||||||
* @param int $limit
|
|
||||||
* @param int $offset
|
|
||||||
* @return array|Activity[]
|
|
||||||
*/
|
*/
|
||||||
public function findByPersonImplied(Person $person, array $scopes, ?array $orderBy = [ 'date' => 'DESC'], ?int $limit = 100, ?int $offset = 0): array
|
public function findByPersonImplied(Person $person, array $scopes, ?array $orderBy = [ 'date' => 'DESC'], ?int $limit = 100, ?int $offset = 0): array
|
||||||
{
|
{
|
||||||
@ -63,8 +40,7 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
':person MEMBER OF a.persons'
|
':person MEMBER OF a.persons'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('person', $person)
|
->setParameter('person', $person);
|
||||||
;
|
|
||||||
|
|
||||||
foreach ($orderBy as $k => $dir) {
|
foreach ($orderBy as $k => $dir) {
|
||||||
$qb->addOrderBy('a.'.$k, $dir);
|
$qb->addOrderBy('a.'.$k, $dir);
|
||||||
@ -72,17 +48,11 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
$qb->setMaxResults($limit)->setFirstResult($offset);
|
$qb->setMaxResults($limit)->setFirstResult($offset);
|
||||||
|
|
||||||
return $qb->getQuery()
|
return $qb->getQuery()->getResult();
|
||||||
->getResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AccompanyingPeriod $period
|
* @return Activity[]
|
||||||
* @param array $scopes
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @param array|string[] $orderBy
|
|
||||||
* @return array|Activity[]
|
|
||||||
*/
|
*/
|
||||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array
|
||||||
{
|
{
|
||||||
@ -92,8 +62,7 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
if (!$allowNullScope) {
|
if (!$allowNullScope) {
|
||||||
$qb
|
$qb
|
||||||
->where($qb->expr()->in('a.scope', ':scopes'))
|
->where($qb->expr()->in('a.scope', ':scopes'))
|
||||||
->setParameter('scopes', $scopes)
|
->setParameter('scopes', $scopes);
|
||||||
;
|
|
||||||
} else {
|
} else {
|
||||||
$qb
|
$qb
|
||||||
->where(
|
->where(
|
||||||
@ -102,16 +71,14 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
$qb->expr()->isNull('a.scope')
|
$qb->expr()->isNull('a.scope')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('scopes', $scopes)
|
->setParameter('scopes', $scopes);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->eq('a.accompanyingPeriod', ':period')
|
$qb->expr()->eq('a.accompanyingPeriod', ':period')
|
||||||
)
|
)
|
||||||
->setParameter('period', $period)
|
->setParameter('period', $period);
|
||||||
;
|
|
||||||
|
|
||||||
foreach ($orderBy as $k => $dir) {
|
foreach ($orderBy as $k => $dir) {
|
||||||
$qb->addOrderBy('a.'.$k, $dir);
|
$qb->addOrderBy('a.'.$k, $dir);
|
||||||
@ -119,7 +86,6 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
$qb->setMaxResults($limit)->setFirstResult($offset);
|
$qb->setMaxResults($limit)->setFirstResult($offset);
|
||||||
|
|
||||||
return $qb->getQuery()
|
return $qb->getQuery()->getResult();
|
||||||
->getResult();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method ActivityType|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method ActivityType|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method ActivityType[] findAll()
|
||||||
|
* @method ActivityType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class ActivityTypeRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, ActivityType::class);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
|
_defaults:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
|
||||||
chill.activity.timeline:
|
chill.activity.timeline:
|
||||||
class: Chill\ActivityBundle\Timeline\TimelineActivityProvider
|
class: Chill\ActivityBundle\Timeline\TimelineActivityProvider
|
||||||
@ -13,17 +16,14 @@ services:
|
|||||||
- { name: chill.timeline, context: 'center' }
|
- { name: chill.timeline, context: 'center' }
|
||||||
|
|
||||||
Chill\ActivityBundle\Menu\:
|
Chill\ActivityBundle\Menu\:
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
resource: '../Menu/'
|
resource: '../Menu/'
|
||||||
tags: ['chill.menu_builder']
|
tags: ['chill.menu_builder']
|
||||||
|
|
||||||
Chill\ActivityBundle\Notification\:
|
Chill\ActivityBundle\Notification\:
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
resource: '../Notification'
|
resource: '../Notification'
|
||||||
|
|
||||||
Chill\ActivityBundle\Security\Authorization\:
|
Chill\ActivityBundle\Security\Authorization\:
|
||||||
resource: '../Security/Authorization/'
|
resource: '../Security/Authorization/'
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
Chill\ActivityBundle\Repository\:
|
||||||
|
resource: '../Repository/'
|
||||||
|
@ -1,28 +1,12 @@
|
|||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
chill_activity.repository.activity_type:
|
chill_activity.repository.activity_type: '@Chill\ActivityBundle\Repository\ActivityTypeRepository'
|
||||||
class: Doctrine\ORM\EntityRepository
|
chill_activity.repository.reason: '@Chill\ActivityBundle\Repository\ActivityReasonRepository'
|
||||||
factory: ['@doctrine.orm.entity_manager', getRepository]
|
chill_activity.repository.reason_category: '@Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository'
|
||||||
arguments:
|
|
||||||
- 'Chill\ActivityBundle\Entity\ActivityType'
|
|
||||||
|
|
||||||
chill_activity.repository.reason:
|
|
||||||
class: Doctrine\ORM\EntityRepository
|
|
||||||
factory: ['@doctrine.orm.entity_manager', getRepository]
|
|
||||||
arguments:
|
|
||||||
- 'Chill\ActivityBundle\Entity\ActivityReason'
|
|
||||||
|
|
||||||
chill_activity.repository.reason_category:
|
|
||||||
class: Doctrine\ORM\EntityRepository
|
|
||||||
factory: ['@doctrine.orm.entity_manager', getRepository]
|
|
||||||
arguments:
|
|
||||||
- 'Chill\ActivityBundle\Entity\ActivityReasonCategory'
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Repository\ActivityRepository:
|
|
||||||
tags: [doctrine.repository_service]
|
|
||||||
arguments:
|
|
||||||
- '@Doctrine\Persistence\ManagerRegistry'
|
|
||||||
|
|
||||||
|
# This is not a repository but merely a service. It needs to be moved out for simplicity.
|
||||||
|
# The autowire and autoconfigure should be enabled globally and removed from the definition of the service.
|
||||||
|
# Once autoloaded, there is no need to alias it to the interface here, it will be done automatically by Symfony.
|
||||||
Chill\ActivityBundle\Repository\ActivityACLAwareRepository:
|
Chill\ActivityBundle\Repository\ActivityACLAwareRepository:
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user