Skip to content

Commit

Permalink
revert dependency injection
Browse files Browse the repository at this point in the history
  • Loading branch information
fiste788 committed Apr 19, 2024
1 parent 7c0f7bb commit 6a6be9a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Model/Table/SelectionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function afterSave(Event $event, EntityInterface $entity, ArrayObject $op
public function beforeSave(Event $event, Selection $entity, ArrayObject $options): void
{
if ($entity->isDirty('processed') && $entity->processed) {
$this->loadService('SelectionService');
$this->loadService('Selection');

$this->Selection->save($entity);
}
Expand Down
9 changes: 8 additions & 1 deletion src/Service/ComputeScoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@
use App\Model\Entity\Matchday;
use App\Model\Entity\Score;
use App\Model\Entity\Team;
use Burzum\CakeServiceLayer\Service\ServiceAwareTrait;
use Cake\ORM\Locator\LocatorAwareTrait;

/**
* @property \App\Service\LineupService $Lineup
*/
#[\AllowDynamicProperties]
class ComputeScoreService
{
use LocatorAwareTrait;
use ServiceAwareTrait;

/**
* Undocumented function
*
* @throws \Cake\Core\Exception\CakeException
* @throws \UnexpectedValueException
*/
public function __construct(private LineupService $Lineup)
public function __construct()
{
$this->loadService('Lineup');
}

/**
Expand Down
9 changes: 8 additions & 1 deletion src/Service/SelectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@

use App\Model\Entity\Selection;
use App\Model\Entity\Transfert;
use Burzum\CakeServiceLayer\Service\ServiceAwareTrait;
use Cake\Mailer\Mailer;
use Cake\ORM\Locator\LocatorAwareTrait;
use WebPush\Notification;

/**
* @property \App\Service\PushNotificationService $PushNotification
*/
#[\AllowDynamicProperties]
class SelectionService
{
use LocatorAwareTrait;
use ServiceAwareTrait;

/**
* Construct
*
* @throws \UnexpectedValueException
*/
public function __construct(private PushNotificationService $PushNotification)
public function __construct()
{
$this->loadService('PushNotification');
}

/**
Expand Down
16 changes: 12 additions & 4 deletions src/Service/TeamService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,33 @@
namespace App\Service;

use App\Model\Entity\Team;
use Burzum\CakeServiceLayer\Service\ServiceAwareTrait;
use Cake\Core\Configure;
use Cake\ORM\Locator\LocatorAwareTrait;
use GetStream\Stream\Client;

/**
* @property \App\Service\NotificationSubscriptionService $NotificationSubscription
* @property \App\Service\ScoreService $Score
*/
#[\AllowDynamicProperties]
class TeamService
{
use LocatorAwareTrait;
use ServiceAwareTrait;

/**
* Constructor
*
* @throws \UnexpectedValueException
*/
public function __construct(
private ScoreService $Score,
private NotificationSubscriptionService $NotificationSubscription
) {
public function __construct()
{
$this->loadService('Score');
$this->loadService('NotificationSubscription');
}


/**
* Create new team
*
Expand Down
8 changes: 6 additions & 2 deletions src/Service/TransfertService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@
use App\Model\Entity\MembersTeam;
use App\Model\Entity\Transfert;
use ArrayObject;
use Burzum\CakeServiceLayer\Service\ServiceAwareTrait;
use Cake\ORM\Locator\LocatorAwareTrait;

/**
* @property \App\Service\LineupService $Lineup
*/
#[AllowDynamicProperties]
#[\AllowDynamicProperties]
class TransfertService
{
use LocatorAwareTrait;

use ServiceAwareTrait;

/**
* Constructor
*
* @throws \Cake\Core\Exception\CakeException
* @throws \UnexpectedValueException
*/
public function __construct(private LineupService $Lineup)
public function __construct()
{
$this->loadService('Lineup');
}

/**
Expand Down

0 comments on commit 6a6be9a

Please sign in to comment.