diff --git a/app/config/config.yml b/app/config/config.yml
index 58992d9..efd25ec 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -2,6 +2,12 @@ imports:
- { resource: parameters.yml }
- { resource: security.yml }
+jms_di_extra:
+ locations:
+ all_bundles: false
+ bundles: [ KekRozsakFrontBundle, KekRozsakSecurityBundle ]
+ directories: [ "%kernel.root_dir%/../src" ]
+
framework:
#esi: ~
#translator: { fallback: %locale% }
diff --git a/src/KekRozsak/FrontBundle/Form/Extension/HelpMessageTypeExtension.php b/src/KekRozsak/FrontBundle/Form/Extension/HelpMessageTypeExtension.php
index e0dc2ce..f3f3552 100644
--- a/src/KekRozsak/FrontBundle/Form/Extension/HelpMessageTypeExtension.php
+++ b/src/KekRozsak/FrontBundle/Form/Extension/HelpMessageTypeExtension.php
@@ -5,7 +5,12 @@ use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormBuilderInterface;
+use JMS\DiExtraBundle\Annotation as DI;
+/**
+ * @DI\Service("form.type_extension.help_message")
+ * @DI\Tag("form.type_extension", attributes={"alias" = "field"})
+ */
class HelpMessageTypeExtension extends AbstractTypeExtension
{
public function buildForm(FormBuilderInterface $builder, array $options)
diff --git a/src/KekRozsak/FrontBundle/Resources/config/services.xml b/src/KekRozsak/FrontBundle/Resources/config/services.xml
index 693930e..edd12d2 100644
--- a/src/KekRozsak/FrontBundle/Resources/config/services.xml
+++ b/src/KekRozsak/FrontBundle/Resources/config/services.xml
@@ -3,18 +3,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/KekRozsak/FrontBundle/Twig/EventsExtension.php b/src/KekRozsak/FrontBundle/Twig/EventsExtension.php
index b7e61c0..8826981 100644
--- a/src/KekRozsak/FrontBundle/Twig/EventsExtension.php
+++ b/src/KekRozsak/FrontBundle/Twig/EventsExtension.php
@@ -4,64 +4,78 @@ namespace KekRozsak\FrontBundle\Twig;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;
+use JMS\DiExtraBundle\Annotation as DI;
+/**
+ * @DI\Service
+ * @DI\Tag("twig.extension")
+ */
class EventsExtension extends \Twig_Extension
{
- protected $_doctrine;
- protected $_securityContext;
+ protected $_doctrine;
+ protected $_securityContext;
- public function __construct(RegistryInterface $doctrine, SecurityContextInterface $securityContext)
- {
- $this->_doctrine = $doctrine;
- $this->_securityContext = $securityContext;
- }
+ /**
+ * @DI\InjectParams({
+ * "doctrine" = @DI\Inject("doctrine"),
+ * "securityContext" = @DI\Inject("security.context")
+ * })
+ *
+ * @param \Symfony\Bridge\Doctrine\RegistryInterface $doctrine
+ * @param \Symfony\Component\Security\Core\SecurityContextInterface $securityContext
+ */
+ public function __construct(RegistryInterface $doctrine, SecurityContextInterface $securityContext)
+ {
+ $this->_doctrine = $doctrine;
+ $this->_securityContext = $securityContext;
+ }
- public function getGlobals()
- {
- $today = new \DateTime('now');
- $firstDay = \DateTime::createFromFormat('Y-m-d', $today->format('Y-m-01'));
- $firstDayWeekday = $firstDay->format('N');
- $numDays = $firstDay->format('t');
- $lastDay = \DateTime::createFromFormat('Y-m-d', $today->format('Y-m-' . sprintf("%02d", $numDays)));
+ public function getGlobals()
+ {
+ $today = new \DateTime('now');
+ $firstDay = \DateTime::createFromFormat('Y-m-d', $today->format('Y-m-01'));
+ $firstDayWeekday = $firstDay->format('N');
+ $numDays = $firstDay->format('t');
+ $lastDay = \DateTime::createFromFormat('Y-m-d', $today->format('Y-m-' . sprintf("%02d", $numDays)));
- /*
- * Get all events in today's month. Iterate through this
- * collection, adding each element to $monthEvents array's
- * 'day'th element array.
- */
- $query = $this->_doctrine->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :firstDay AND e.endDate >= :firstDay) OR e.startDate BETWEEN :firstDay AND :lastDay)');
- $query->setParameter('firstDay', $firstDay, \Doctrine\DBAL\Types\Type::DATE);
- $query->setParameter('lastDay', $lastDay, \Doctrine\DBAL\Types\Type::DATE);
- $events = $query->getResult();
+ /*
+ * Get all events in today's month. Iterate through this
+ * collection, adding each element to $monthEvents array's
+ * 'day'th element array.
+ */
+ $query = $this->_doctrine->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :firstDay AND e.endDate >= :firstDay) OR e.startDate BETWEEN :firstDay AND :lastDay)');
+ $query->setParameter('firstDay', $firstDay, \Doctrine\DBAL\Types\Type::DATE);
+ $query->setParameter('lastDay', $lastDay, \Doctrine\DBAL\Types\Type::DATE);
+ $events = $query->getResult();
- $eventList = array();
- for ($i = 1; $i <= $numDays; $i++)
- {
- $date = \DateTime::createFromFormat('Y-m-d', $today->format('Y-m-' . sprintf('%02d', $i)));
- $eventList[$i]['date'] = $date;
- $eventList[$i]['events'] = array();
- foreach ($events as $event)
- {
- if ($event->isOnDate($date))
- {
- $eventList[$i]['events'][] = $event;
- }
- }
- }
+ $eventList = array();
+ for ($i = 1; $i <= $numDays; $i++) {
+ $date = \DateTime::createFromFormat(
+ 'Y-m-d',
+ $today->format('Y-m-' . sprintf('%02d', $i))
+ );
+ $eventList[$i]['date'] = $date;
+ $eventList[$i]['events'] = array();
+ foreach ($events as $event) {
+ if ($event->isOnDate($date)) {
+ $eventList[$i]['events'][] = $event;
+ }
+ }
+ }
- return array(
- 'events' => $events,
- 'eventList' => $eventList,
- 'today' => $today,
- 'firstDay' => $firstDay,
- 'lastDay' => $lastDay,
- 'firstDayWeekday' => $firstDayWeekday,
- 'numDays' => $numDays,
- );
- }
+ return array(
+ 'events' => $events,
+ 'eventList' => $eventList,
+ 'today' => $today,
+ 'firstDay' => $firstDay,
+ 'lastDay' => $lastDay,
+ 'firstDayWeekday' => $firstDayWeekday,
+ 'numDays' => $numDays,
+ );
+ }
- public function getName()
- {
- return 'Events';
- }
+ public function getName()
+ {
+ return 'Events';
+ }
}
diff --git a/src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php b/src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php
index 2af7871..53df4ab 100644
--- a/src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php
+++ b/src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php
@@ -2,15 +2,26 @@
namespace KekRozsak\FrontBundle\Twig;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use JMS\DiExtraBundle\Annotation as DI;
+/**
+ * @DI\Service
+ * @DI\Tag("twig.extension")
+ *
+ */
class TwigBBExtension extends \Twig_Extension
{
- private $container;
private $assets;
+ /**
+ * @DI\InjectParams({
+ * "container" = @DI\Inject("service_container")
+ * })
+ * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
+ */
public function __construct(ContainerInterface $container)
{
- $this->container = $container;
+ $this->assets = $container->get('templating.helper.assets');
}
public function getFilters()
@@ -67,8 +78,7 @@ class TwigBBExtension extends \Twig_Extension
$sentence,
'
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/KekRozsak/SecurityBundle/Security/AuthSuccess.php b/src/KekRozsak/SecurityBundle/Security/AuthSuccess.php
index d0f1a16..7dc05ec 100644
--- a/src/KekRozsak/SecurityBundle/Security/AuthSuccess.php
+++ b/src/KekRozsak/SecurityBundle/Security/AuthSuccess.php
@@ -6,11 +6,26 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Security\Core\Event\AuthenticationEvent;
+use JMS\DiExtraBundle\Annotation as DI;
+/**
+ * @DI\Service
+ * @DI\Tag("kernel.event_listener", attributes={"event" = "security.authentication.success"})
+ */
class AuthSuccess implements AuthenticationSuccessHandlerInterface
{
+ /**
+ * The Doctrine interface
+ *
+ * @var Symfony\Bridge\Doctrine\RegistryInterface $doctrine
+ */
private $doctrine;
+ /**
+ * @DI\InjectParams
+ *
+ * @param \Symfony\Bridge\Doctrine\RegistryInterface $doctrine
+ */
public function __construct(RegistryInterface $doctrine)
{
$this->doctrine = $doctrine;
@@ -34,4 +49,3 @@ class AuthSuccess implements AuthenticationSuccessHandlerInterface
$em->flush();
}
}
-
diff --git a/src/KekRozsak/SecurityBundle/Service/CryptEncoder.php b/src/KekRozsak/SecurityBundle/Service/CryptEncoder.php
index f1d40bb..c249e65 100644
--- a/src/KekRozsak/SecurityBundle/Service/CryptEncoder.php
+++ b/src/KekRozsak/SecurityBundle/Service/CryptEncoder.php
@@ -2,7 +2,11 @@
namespace KekRozsak\SecurityBundle\Service;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
+use JMS\DiExtraBundle\Annotation as DI;
+/**
+ * @DI\Service("kek_rozsak_security.encoder.crypt")
+ */
class CryptEncoder implements PasswordEncoderInterface
{
function encodePassword($raw, $salt)
@@ -15,4 +19,3 @@ class CryptEncoder implements PasswordEncoderInterface
return (crypt($raw, $salt) == $encoded);
}
}
-
diff --git a/src/KekRozsak/SecurityBundle/Twig/UserDataSpanExtension.php b/src/KekRozsak/SecurityBundle/Twig/UserDataSpanExtension.php
index 51c660c..6c429a9 100644
--- a/src/KekRozsak/SecurityBundle/Twig/UserDataSpanExtension.php
+++ b/src/KekRozsak/SecurityBundle/Twig/UserDataSpanExtension.php
@@ -4,14 +4,28 @@ namespace KekRozsak\SecurityBundle\Twig;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
+use JMS\DiExtraBundle\Annotation as DI;
use KekRozsak\SecurityBundle\Entity\User;
+/**
+ * @DI\Service
+ * @DI\Tag("twig.extension")
+ */
class UserDataSpanExtension extends \Twig_Extension
{
protected $_securityContext;
protected $_router;
+ /**
+ * @DI\InjectParams({
+ * "router" = @DI\Inject("router"),
+ * "security" = @DI\Inject("security.context")
+ * })
+ *
+ * @param \Symfony\Bundle\FrameworkBundle\Routing\Router $router
+ * @param \Symfony\Component\Security\Core\SecurityContextInterface $security
+ */
public function __construct(Router $router, SecurityContextInterface $security)
{
$this->_router = $router;