You've already forked symfony-notifications
auto
This commit is contained in:
@@ -10,9 +10,8 @@ class MainController extends AbstractController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
die($request->getMethod());
|
||||
// ON PEUT PAS INJECTER UN SERVICE DU BUNDLE EN QUESTION DANS LES ARGS DONC ON LE récupère ainsi :
|
||||
$this->get('bluesquare.notifications_bundle.foo')->foo();
|
||||
die('hello');
|
||||
$r = $this->get('bluesquare.notifications_bundle.notifssrv')->foo();
|
||||
die($r);
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@ services:
|
||||
tags: ['doctrine.repository_service']
|
||||
|
||||
# Services : alias
|
||||
Bluesquare\NotificationsBundle\Service\FooService: '@bluesquare.notifications_bundle.foo'
|
||||
Bluesquare\NotificationsBundle\Service\NotificationsService: '@bluesquare.notifications_bundle.notifssrv'
|
||||
|
||||
# Services : params
|
||||
bluesquare.notifications_bundle.foo:
|
||||
class: Bluesquare\NotificationsBundle\Service\FooService
|
||||
bluesquare.notifications_bundle.notifssrv:
|
||||
class: Bluesquare\NotificationsBundle\Service\NotificationsService
|
||||
autowire: true
|
||||
public: true
|
||||
arguments: ['@request_stack']
|
||||
arguments: ['@doctrine.orm.entity_manager']
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Bluesquare\NotificationsBundle\Service;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
class FooService
|
||||
{
|
||||
public function __construct(RequestStack $requestStack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function foo()
|
||||
{
|
||||
die(var_dump('azertyu'));
|
||||
return 'bar';
|
||||
}
|
||||
}
|
||||
20
NotificationsBundle/Service/NotificationsService.php
Normal file
20
NotificationsBundle/Service/NotificationsService.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Bluesquare\NotificationsBundle\Service;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class NotificationsService
|
||||
{
|
||||
protected $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function notifyUsers()
|
||||
{
|
||||
return 'bar';
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
"license": "proprietary",
|
||||
"authors": [
|
||||
{
|
||||
"name": "RENOU Maxime",
|
||||
"email": "maxime@bluesquare.io"
|
||||
"name": "COMBALDIEU Paul",
|
||||
"email": "paul@bluesquare.io"
|
||||
}
|
||||
],
|
||||
"type": "symfony-bundle",
|
||||
|
||||
Reference in New Issue
Block a user