mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 14:06:13 +00:00
fix cs
This commit is contained in:
parent
d95472ca9d
commit
642b1e43c8
@ -90,7 +90,6 @@ final class ActivityController extends AbstractController
|
||||
SerializerInterface $serializer,
|
||||
UserRepositoryInterface $userRepository,
|
||||
CenterResolverManagerInterface $centerResolver
|
||||
|
||||
) {
|
||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
@ -106,7 +105,6 @@ final class ActivityController extends AbstractController
|
||||
$this->serializer = $serializer;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->centerResolver = $centerResolver;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,16 +409,16 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function getUrgent(): ?bool
|
||||
{
|
||||
return $this->urgent;
|
||||
}
|
||||
|
||||
public function getThirdParties(): Collection
|
||||
{
|
||||
return $this->getProfessionals();
|
||||
}
|
||||
|
||||
public function getUrgent(): ?bool
|
||||
{
|
||||
return $this->urgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|User[]
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
@ -599,13 +599,6 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUrgent(bool $urgent): self
|
||||
{
|
||||
$this->urgent = $urgent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStartDate(DateTimeImmutable $startDate): self
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
@ -623,4 +616,11 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUrgent(bool $urgent): self
|
||||
{
|
||||
$this->urgent = $urgent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ class MonthYearAggregator implements AggregatorInterface
|
||||
return 'by month and year';
|
||||
}
|
||||
|
||||
$month = (int)substr($value, 0, 2);
|
||||
$year = (int)substr($value, 3, 4);
|
||||
$month = (int) substr($value, 0, 2);
|
||||
$year = (int) substr($value, 3, 4);
|
||||
|
||||
return strftime('%B %G', mktime(0, 0, 0, $month, 1, $year));
|
||||
};
|
||||
|
@ -21,7 +21,6 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class UrgencyAggregator implements AggregatorInterface
|
||||
{
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
@ -88,4 +87,3 @@ class UrgencyAggregator implements AggregatorInterface
|
||||
return 'Group calendars by urgency';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Exception\LogicException;
|
||||
|
||||
|
||||
class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
private CalendarRepository $calendarRepository;
|
||||
|
@ -11,8 +11,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\CalendarBundle\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\CalendarBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
@ -23,7 +23,7 @@ class CalendarRangeFilter implements FilterInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'Not made within a calendar range' => true,
|
||||
'Made within a calendar range' => false
|
||||
'Made within a calendar range' => false,
|
||||
];
|
||||
|
||||
private const DEFAULT_CHOICE = false;
|
||||
@ -52,7 +52,6 @@ class CalendarRangeFilter implements FilterInterface
|
||||
$clause = $qb->expr()->isNull('cal.calendarRange');
|
||||
}
|
||||
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
@ -101,4 +100,3 @@ class CalendarRangeFilter implements FilterInterface
|
||||
return 'Filter by calendar range';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ class MapCalendarToUser
|
||||
|
||||
public function writeMetadata(User $user): User
|
||||
{
|
||||
if (null === $user->getEmail() OR '' === $user->getEmail()) {
|
||||
if (null === $user->getEmail() || '' === $user->getEmail()) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
@ -40,11 +40,6 @@ class CalendarRepository implements ObjectRepository
|
||||
return $this->repository->count(['accompanyingPeriod' => $period]);
|
||||
}
|
||||
|
||||
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
|
||||
{
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
}
|
||||
|
||||
public function countByUser(User $user, DateTimeImmutable $from, DateTimeImmutable $to): int
|
||||
{
|
||||
return $this->buildQueryByUser($user, $from, $to)
|
||||
@ -53,6 +48,11 @@ class CalendarRepository implements ObjectRepository
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
|
||||
{
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
}
|
||||
|
||||
public function find($id): ?Calendar
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\AgentAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AgentAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private AgentAggregator $aggregator;
|
||||
@ -51,8 +55,7 @@ final class AgentAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
->join('cal.mainUser', 'caluser')
|
||||
,
|
||||
->join('cal.mainUser', 'caluser'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CancelReasonAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private CancelReasonAggregator $aggregator;
|
||||
@ -51,8 +55,7 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
->join('cal.cancelReason', 'calcancel')
|
||||
,
|
||||
->join('cal.cancelReason', 'calcancel'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\JobAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private JobAggregator $aggregator;
|
||||
@ -51,8 +55,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
->join('cal.user', 'caluser')
|
||||
,
|
||||
->join('cal.user', 'caluser'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\LocationAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class LocationAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private LocationAggregator $aggregator;
|
||||
@ -51,8 +55,7 @@ final class LocationAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
->join('cal.location', 'calloc')
|
||||
,
|
||||
->join('cal.location', 'calloc'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class LocationTypeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private LocationTypeAggregator $aggregator;
|
||||
@ -51,8 +55,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
->join('cal.location', 'calloc')
|
||||
,
|
||||
->join('cal.location', 'calloc'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class MonthYearAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private MonthYearAggregator $aggregator;
|
||||
@ -50,8 +54,7 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
,
|
||||
->from(Calendar::class, 'cal'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\ScopeAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ScopeAggregator $aggregator;
|
||||
@ -51,8 +55,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(cal.id)')
|
||||
->from(Calendar::class, 'cal')
|
||||
->join('cal.user', 'caluser')
|
||||
,
|
||||
->join('cal.user', 'caluser'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ final class AgentFilterTest extends AbstractFilterTest
|
||||
|
||||
foreach ($array as $a) {
|
||||
$data[] = [
|
||||
'accepted_agents' => $a
|
||||
'accepted_agents' => $a,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Tests\Export\Filter;
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\CalendarBundle\Export\Filter\BetweenDatesFilter;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
@ -46,9 +47,9 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-06-01'),
|
||||
]
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ final class JobFilterTest extends AbstractFilterTest
|
||||
|
||||
foreach ($array as $a) {
|
||||
$data[] = [
|
||||
'job' => $a
|
||||
'job' => $a,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ final class ScopeFilterTest extends AbstractFilterTest
|
||||
|
||||
foreach ($array as $a) {
|
||||
$data[] = [
|
||||
'scope' => $a
|
||||
'scope' => $a,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Calendar;
|
||||
@ -12,6 +19,12 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20220921101643 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE chill_calendar.calendar DROP urgent');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add urgent property to calendar entity';
|
||||
@ -21,13 +34,5 @@ final class Version20220921101643 extends AbstractMigration
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE chill_calendar.calendar ADD urgent BOOLEAN DEFAULT NULL');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE chill_calendar.calendar DROP urgent');
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class DeadOrAliveFilter implements FilterInterface
|
||||
'person.birthdate',
|
||||
':date_calc'
|
||||
)
|
||||
),
|
||||
),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->isNotNull('person.deathdate'),
|
||||
$qb->expr()->gt(
|
||||
|
Loading…
x
Reference in New Issue
Block a user