Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -28,24 +28,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
*/
|
||||
class ActivityService
|
||||
{
|
||||
/**
|
||||
* @var ActivityRepository
|
||||
*/
|
||||
private $repository;
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $dispatcher;
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
private $validator;
|
||||
|
||||
public function __construct(ActivityRepository $activityRepository, EventDispatcherInterface $dispatcher, ValidatorInterface $validator)
|
||||
public function __construct(private ActivityRepository $repository, private EventDispatcherInterface $dispatcher, private ValidatorInterface $validator)
|
||||
{
|
||||
$this->repository = $activityRepository;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function createNewActivity(?Project $project = null): Activity
|
||||
@@ -104,6 +88,6 @@ class ActivityService
|
||||
|
||||
public function findActivityByName(string $name, ?Project $project = null): ?Activity
|
||||
{
|
||||
return $this->repository->findOneBy(['project' => $project->getId(), 'name' => $name]);
|
||||
return $this->repository->findOneBy(['project' => $project?->getId(), 'name' => $name]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user