Skip to content

Commit

Permalink
Applied fixes from StyleCI (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored and soullivaneuh committed May 26, 2016
1 parent 83a5fbd commit 705b37d
Show file tree
Hide file tree
Showing 59 changed files with 320 additions and 311 deletions.
16 changes: 8 additions & 8 deletions Admin/CategoryAdmin.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/*
* This file is part of the Sonata project.
* This file is part of the Sonata Project package.
*
* (c) Sonata Project <https://github.com/sonata-project/SonataClassificationBundle/>
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -48,11 +48,11 @@ protected function configureFormFields(FormMapper $formMapper)
if ($this->getSubject()->getParent() !== null || $this->getSubject()->getId() === null) { // root category cannot have a parent
$formMapper
->add('parent', 'sonata_category_selector', array(
'category' => $this->getSubject() ?: null,
'category' => $this->getSubject() ?: null,
'model_manager' => $this->getModelManager(),
'class' => $this->getClass(),
'required' => true,
'context' => $this->getSubject()->getContext(),
'class' => $this->getClass(),
'required' => true,
'context' => $this->getSubject()->getContext(),
));
}
}
Expand All @@ -67,7 +67,7 @@ protected function configureFormFields(FormMapper $formMapper)
))
->add('position', 'integer', array(
'required' => false,
'data' => $position,
'data' => $position,
))
->end()
;
Expand All @@ -82,7 +82,7 @@ protected function configureFormFields(FormMapper $formMapper)
array(
'link_parameters' => array(
'provider' => 'sonata.media.provider.image',
'context' => 'sonata_category',
'context' => 'sonata_category',
),
)
)
Expand Down
6 changes: 3 additions & 3 deletions Admin/CollectionAdmin.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/*
* This file is part of the Sonata project.
* This file is part of the Sonata Project package.
*
* (c) Sonata Project <https://github.com/sonata-project/SonataClassificationBundle/>
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -44,7 +44,7 @@ protected function configureFormFields(FormMapper $formMapper)
array(
'link_parameters' => array(
'provider' => 'sonata.media.provider.image',
'context' => 'sonata_collection',
'context' => 'sonata_collection',
),
)
);
Expand Down
2 changes: 1 addition & 1 deletion Admin/ContextAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
36 changes: 18 additions & 18 deletions Admin/ContextAwareAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -63,29 +63,13 @@ public function getNewInstance()
return $instance;
}

/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$options = array();

if (1 === $this->getPersistentParameter('hide_context')) {
$options['disabled'] = true;
}

$datagridMapper
->add('context', null, array(), null, $options)
;
}

/**
* {@inheritdoc}
*/
public function getPersistentParameters()
{
$parameters = array(
'context' => '',
'context' => '',
'hide_context' => $this->hasRequest() ? (int) $this->getRequest()->get('hide_context', 0) : 0,
);

Expand All @@ -103,4 +87,20 @@ public function getPersistentParameters()

return $parameters;
}

/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$options = array();

if (1 === $this->getPersistentParameter('hide_context')) {
$options['disabled'] = true;
}

$datagridMapper
->add('context', null, array(), null, $options)
;
}
}
2 changes: 1 addition & 1 deletion Admin/TagAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
2 changes: 1 addition & 1 deletion Command/FixContextCommand.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
6 changes: 3 additions & 3 deletions Controller/Api/CategoryController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -51,7 +51,7 @@ class CategoryController
public function __construct(CategoryManagerInterface $categoryManager, FormFactoryInterface $formFactory)
{
$this->categoryManager = $categoryManager;
$this->formFactory = $formFactory;
$this->formFactory = $formFactory;
}

/**
Expand All @@ -75,7 +75,7 @@ public function __construct(CategoryManagerInterface $categoryManager, FormFacto
*/
public function getCategoriesAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');

/** @var PagerInterface $categoriesPager */
Expand Down
6 changes: 3 additions & 3 deletions Controller/Api/CollectionController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -51,7 +51,7 @@ class CollectionController
public function __construct(CollectionManagerInterface $collectionManager, FormFactoryInterface $formFactory)
{
$this->collectionManager = $collectionManager;
$this->formFactory = $formFactory;
$this->formFactory = $formFactory;
}

/**
Expand All @@ -74,7 +74,7 @@ public function __construct(CollectionManagerInterface $collectionManager, FormF
*/
public function getCollectionsAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');

/** @var PagerInterface $collectionsPager */
Expand Down
6 changes: 3 additions & 3 deletions Controller/Api/ContextController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -50,7 +50,7 @@ class ContextController
*/
public function __construct(ContextManagerInterface $contextManager, FormFactoryInterface $formFactory)
{
$this->contextManager = $contextManager;
$this->contextManager = $contextManager;
$this->formFactory = $formFactory;
}

Expand All @@ -74,7 +74,7 @@ public function __construct(ContextManagerInterface $contextManager, FormFactory
*/
public function getContextsAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');

/** @var PagerInterface $contextsPager */
Expand Down
6 changes: 3 additions & 3 deletions Controller/Api/TagController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -50,7 +50,7 @@ class TagController
*/
public function __construct(TagManagerInterface $tagManager, FormFactoryInterface $formFactory)
{
$this->tagManager = $tagManager;
$this->tagManager = $tagManager;
$this->formFactory = $formFactory;
}

Expand All @@ -74,7 +74,7 @@ public function __construct(TagManagerInterface $tagManager, FormFactoryInterfac
*/
public function getTagsAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');

/** @var PagerInterface $tagsPager */
Expand Down
22 changes: 11 additions & 11 deletions Controller/CategoryAdminController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -51,9 +51,9 @@ public function listAction(Request $request = null)
$this->get('twig')->getExtension('form')->renderer->setTheme($formView, $this->admin->getFilterTheme());

return $this->render($this->admin->getTemplate('list'), array(
'action' => 'list',
'form' => $formView,
'datagrid' => $datagrid,
'action' => 'list',
'form' => $formView,
'datagrid' => $datagrid,
'csrf_token' => $this->getCsrfToken('sonata.batch'),
));
}
Expand All @@ -75,7 +75,7 @@ public function treeAction(Request $request)
$rootCategories = $categoryManager->getRootCategories(false);

if (!$currentContext) {
$mainCategory = current($rootCategories);
$mainCategory = current($rootCategories);
$currentContext = $mainCategory->getContext();
} else {
foreach ($rootCategories as $category) {
Expand All @@ -100,12 +100,12 @@ public function treeAction(Request $request)
$this->get('twig')->getExtension('form')->renderer->setTheme($formView, $this->admin->getFilterTheme());

return $this->render('SonataClassificationBundle:CategoryAdmin:tree.html.twig', array(
'action' => 'tree',
'main_category' => $mainCategory,
'root_categories' => $rootCategories,
'current_context' => $currentContext,
'form' => $formView,
'csrf_token' => $this->getCsrfToken('sonata.batch'),
'action' => 'tree',
'main_category' => $mainCategory,
'root_categories' => $rootCategories,
'current_context' => $currentContext,
'form' => $formView,
'csrf_token' => $this->getCsrfToken('sonata.batch'),
));
}
}
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down

0 comments on commit 705b37d

Please sign in to comment.