Telegram PrivateMessageProcessor service is now receives all repositories directly. Still depends on EntityManager due to need to flush().
This commit is contained in:
parent
928311dad1
commit
d6bd2ddd73
|
@ -216,8 +216,12 @@ services:
|
|||
class: Skobkin\Bundle\PointToolsBundle\Service\Telegram\PrivateMessageProcessor
|
||||
lazy: true
|
||||
arguments:
|
||||
- '@doctrine.orm.entity_manager'
|
||||
- '@app.point.user_repository'
|
||||
- '@app.point.telegram_account_repository'
|
||||
- '@app.point.subscription_repository'
|
||||
- '@app.point.subscription_record_repository'
|
||||
- '@app.telegram.message_sender'
|
||||
- '@app.point.api_user'
|
||||
- '@app.telegram.telegram_account_factory'
|
||||
- '@doctrine.orm.entity_manager'
|
||||
- '%point_id%'
|
||||
|
|
|
@ -67,18 +67,26 @@ class PrivateMessageProcessor
|
|||
private $pointUserId;
|
||||
|
||||
|
||||
public function __construct(MessageSender $messageSender, UserApi $userApi, AccountFactory $accountFactory, EntityManagerInterface $em, int $pointUserId)
|
||||
{
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
UserRepository $userRepository,
|
||||
AccountRepository $accountRepository,
|
||||
SubscriptionRepository $subscriptionRepository,
|
||||
SubscriptionEventRepository $subscriptionRecordRepository,
|
||||
MessageSender $messageSender,
|
||||
UserApi $userApi,
|
||||
AccountFactory $accountFactory,
|
||||
int $pointUserId
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->userRepo = $userRepository;
|
||||
$this->accountRepo = $accountRepository;
|
||||
$this->subscriptionRepo = $subscriptionRepository;
|
||||
$this->subscriptionEventRepo = $subscriptionRecordRepository;
|
||||
$this->messenger = $messageSender;
|
||||
$this->userApi = $userApi;
|
||||
$this->accountFactory = $accountFactory;
|
||||
$this->em = $em;
|
||||
$this->pointUserId = $pointUserId;
|
||||
|
||||
$this->userRepo = $em->getRepository('SkobkinPointToolsBundle:User');
|
||||
$this->accountRepo = $em->getRepository('SkobkinPointToolsBundle:Telegram\Account');
|
||||
$this->subscriptionRepo = $em->getRepository('SkobkinPointToolsBundle:Subscription');
|
||||
$this->subscriptionEventRepo = $em->getRepository('SkobkinPointToolsBundle:SubscriptionEvent');
|
||||
}
|
||||
|
||||
public function process(Message $message)
|
||||
|
|
Loading…
Reference in a new issue