Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/CreateContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\Context\ContextInterface;
use FSi\Bundle\AdminBundle\Event\CRUDEvents;
use FSi\Bundle\AdminBundle\Event\FormEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;
Expand Down Expand Up @@ -44,11 +44,11 @@ class CreateContext implements ContextInterface
protected $form;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \FSi\Bundle\AdminBundle\Admin\Doctrine\CRUDElement $element
* @param \Symfony\Component\Routing\Router $router
*/
public function __construct(EventDispatcher $dispatcher, CRUDElement $element, Router $router)
public function __construct(EventDispatcherInterface $dispatcher, CRUDElement $element, Router $router)
{
$this->dispatcher = $dispatcher;
$this->element = $element;
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/CreateContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\ElementInterface;
use FSi\Bundle\AdminBundle\Admin\Context\ContextBuilderInterface;
use FSi\Bundle\AdminBundle\Exception\ContextBuilderException;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Routing\Router;

/**
Expand All @@ -32,10 +32,10 @@ class CreateContextBuilder implements ContextBuilderInterface
protected $router;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \Symfony\Component\Routing\Router $router
*/
public function __construct(EventDispatcher $dispatcher, Router $router)
public function __construct(EventDispatcherInterface $dispatcher, Router $router)
{
$this->dispatcher = $dispatcher;
$this->router = $router;
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/DeleteContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\Context\ContextInterface;
use FSi\Bundle\AdminBundle\Event\CRUDEvents;
use FSi\Bundle\AdminBundle\Event\FormEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -55,15 +55,15 @@ class DeleteContext implements ContextInterface
protected $form;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \FSi\Bundle\AdminBundle\Admin\Doctrine\CRUDElement $element
* @param \Symfony\Component\Routing\Router $router
* @param \Symfony\Component\Form\FormFactoryInterface $factory
* @param array $data
* @internal param \Symfony\Component\Form\FormFactoryInterface $form
*/
public function __construct(
EventDispatcher $dispatcher,
EventDispatcherInterface $dispatcher,
CRUDElement $element,
Router $router,
FormFactoryInterface $factory,
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/DeleteContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\ElementInterface;
use FSi\Bundle\AdminBundle\Admin\Context\ContextBuilderInterface;
use FSi\Bundle\AdminBundle\Exception\ContextBuilderException;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;
Expand Down Expand Up @@ -44,11 +44,11 @@ class DeleteContextBuilder implements ContextBuilderInterface
protected $request;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \Symfony\Component\Routing\Router $router
* @param \Symfony\Component\Form\FormFactoryInterface $factory
*/
public function __construct(EventDispatcher $dispatcher, Router $router, FormFactoryInterface $factory)
public function __construct(EventDispatcherInterface $dispatcher, Router $router, FormFactoryInterface $factory)
{
$this->dispatcher = $dispatcher;
$this->router = $router;
Expand Down
4 changes: 2 additions & 2 deletions Admin/Doctrine/Context/EditContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\Context\ContextInterface;
use FSi\Bundle\AdminBundle\Event\CRUDEvents;
use FSi\Bundle\AdminBundle\Event\FormEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;
Expand Down Expand Up @@ -54,7 +54,7 @@ class EditContext implements ContextInterface
* @param \Symfony\Component\Routing\Router $router
* @param $data mixed
*/
public function __construct(EventDispatcher $dispatcher, CRUDElement $element, Router $router, $data)
public function __construct(EventDispatcherInterface $dispatcher, CRUDElement $element, Router $router, $data)
{
$this->dispatcher = $dispatcher;
$this->element = $element;
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/EditContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\ElementInterface;
use FSi\Bundle\AdminBundle\Admin\Context\ContextBuilderInterface;
use FSi\Bundle\AdminBundle\Exception\ContextBuilderException;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;

Expand All @@ -38,10 +38,10 @@ class EditContextBuilder implements ContextBuilderInterface
protected $request;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \Symfony\Component\Routing\Router $router
*/
public function __construct(EventDispatcher $dispatcher, Router $router)
public function __construct(EventDispatcherInterface $dispatcher, Router $router)
{
$this->dispatcher = $dispatcher;
$this->router = $router;
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/ListContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use FSi\Bundle\AdminBundle\Admin\Context\ContextInterface;
use FSi\Bundle\AdminBundle\Event\CRUDEvents;
use FSi\Bundle\AdminBundle\Event\ListEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;

/**
Expand Down Expand Up @@ -42,10 +42,10 @@ class ListContext implements ContextInterface
protected $dataGrid;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \FSi\Bundle\AdminBundle\Admin\Doctrine\CRUDElement $element
*/
public function __construct(EventDispatcher $dispatcher, CRUDElement $element)
public function __construct(EventDispatcherInterface $dispatcher, CRUDElement $element)
{
$this->dispatcher = $dispatcher;
$this->element = $element;
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/ListContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use FSi\Bundle\AdminBundle\Admin\Doctrine\CRUDElement;
use FSi\Bundle\AdminBundle\Admin\ElementInterface;
use FSi\Bundle\AdminBundle\Admin\Context\ContextBuilderInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* @author Norbert Orzechowicz <norbert@fsi.pl>
Expand All @@ -25,9 +25,9 @@ class ListContextBuilder implements ContextBuilderInterface
protected $dispatcher;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
*/
public function __construct(EventDispatcher $dispatcher)
public function __construct(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/ResourceContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use FSi\Bundle\AdminBundle\Exception\ContextBuilderException;
use FSi\Bundle\ResourceRepositoryBundle\Repository\MapBuilder;
use FSi\Bundle\ResourceRepositoryBundle\Repository\Resource\Type\ResourceInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down Expand Up @@ -60,14 +60,14 @@ class ResourceContext implements ContextInterface
protected $form;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \FSi\Bundle\AdminBundle\Admin\Doctrine\ResourceElement $element
* @param \FSi\Bundle\ResourceRepositoryBundle\Repository\MapBuilder $builder
* @param \Symfony\Component\Form\FormFactory $formFactory
* @param \Symfony\Component\Routing\Router $router
*/
public function __construct(
EventDispatcher $dispatcher,
EventDispatcherInterface $dispatcher,
ResourceElement $element,
MapBuilder $builder,
FormFactory $formFactory,
Expand Down
6 changes: 3 additions & 3 deletions Admin/Doctrine/Context/ResourceContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use FSi\Bundle\AdminBundle\Admin\Doctrine\ResourceElement;
use FSi\Bundle\AdminBundle\Exception\ContextBuilderException;
use FSi\Bundle\ResourceRepositoryBundle\Repository\MapBuilder;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Routing\Router;

Expand Down Expand Up @@ -44,12 +44,12 @@ class ResourceContextBuilder implements ContextBuilderInterface
protected $router;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param \FSi\Bundle\ResourceRepositoryBundle\Repository\MapBuilder $builder
* @param \Symfony\Component\Form\FormFactory $formFactory
* @param \Symfony\Component\Routing\Router $router
*/
public function __construct(EventDispatcher $dispatcher, FormFactory $formFactory, Router $router, MapBuilder $builder = null)
public function __construct(EventDispatcherInterface $dispatcher, FormFactory $formFactory, Router $router, MapBuilder $builder = null)
{
$this->dispatcher = $dispatcher;
$this->formFactory = $formFactory;
Expand Down
28 changes: 17 additions & 11 deletions Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/**
Expand All @@ -20,56 +21,61 @@ class CRUDController extends Controller
{
/**
* @param \FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD $element
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function listAction(AbstractCRUD $element)
public function listAction(AbstractCRUD $element, Request $request)
{
return $this->action($element, 'fsi_admin_crud_list', 'admin.templates.crud_list');
return $this->action($element, $request, 'fsi_admin_crud_list', 'admin.templates.crud_list');
}

/**
* @param \FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD $element
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function createAction(AbstractCRUD $element)
public function createAction(AbstractCRUD $element, Request $request)
{
return $this->action($element, 'fsi_admin_crud_create', 'admin.templates.crud_create');
return $this->action($element, $request, 'fsi_admin_crud_create', 'admin.templates.crud_create');
}

/**
* @param \FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD $element
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function editAction(AbstractCRUD $element)
public function editAction(AbstractCRUD $element, Request $request)
{
return $this->action($element, 'fsi_admin_crud_edit', 'admin.templates.crud_edit');
return $this->action($element, $request, 'fsi_admin_crud_edit', 'admin.templates.crud_edit');
}

/**
* @param \FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD $element
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function deleteAction(AbstractCRUD $element)
public function deleteAction(AbstractCRUD $element, Request $request)
{
return $this->action($element, 'fsi_admin_crud_delete', 'admin.templates.crud_delete');
return $this->action($element, $request, 'fsi_admin_crud_delete', 'admin.templates.crud_delete');
}

/**
* @param \FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD $element
* @param Request $request
* @param string $route
* @param string $defaultTemplate
* @return \Symfony\Component\HttpFoundation\Response
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function action(AbstractCRUD $element, $route, $defaultTemplate)
protected function action(AbstractCRUD $element, Request $request, $route, $defaultTemplate)
{
$context = $this->get('admin.context.manager')->createContext($route, $element);

if (!isset($context)) {
throw new NotFoundHttpException(sprintf('Cant find context builder that supports %s', $element->getName()));
}

if (($response = $context->handleRequest($this->getRequest())) !== null) {
if (($response = $context->handleRequest($request)) !== null) {
return $response;
}

Expand Down
8 changes: 5 additions & 3 deletions Controller/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use FSi\Bundle\AdminBundle\Admin\ResourceRepository\AbstractResource;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/**
Expand All @@ -20,18 +21,19 @@ class ResourceController extends Controller
{
/**
* @param \FSi\Bundle\AdminBundle\Admin\ResourceRepository\AbstractResource $element
* @return \Symfony\Component\HttpFoundation\Response
* @param \Symfony\Component\HttpFoundation\Request $request
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @return \Symfony\Component\HttpFoundation\Response
*/
public function resourceAction(AbstractResource $element)
public function resourceAction(AbstractResource $element, Request $request)
{
$context= $this->get('admin.context.manager')->createContext('fsi_admin_resource', $element);

if (!isset($context)) {
throw new NotFoundHttpException(sprintf('Cant find context builder that supports %s', $element->getName()));
}

if (($response = $context->handleRequest($this->getRequest())) !== null) {
if (($response = $context->handleRequest($request)) !== null) {
return $response;
}

Expand Down
Loading