Public methods in controller classes should only be actions
This commit is contained in:
parent
c55011138d
commit
ba64c7e209
|
@ -559,9 +559,9 @@ class BaseAdminController extends Controller
|
|||
|
||||
$form = $this->getConfiguration()->getFormEdit();
|
||||
|
||||
if($this->has($form)){
|
||||
if ($this->has($form)) {
|
||||
$form = $this->createForm($this->get($form)->getName(), $object, $this->getConfiguration()->getFormEditOptions());
|
||||
}else {
|
||||
} else {
|
||||
$form = $this->createForm(new $form($this->getConfiguration()->getFormEditOptions()), $object);
|
||||
}
|
||||
|
||||
|
@ -599,9 +599,9 @@ class BaseAdminController extends Controller
|
|||
|
||||
$form = $this->getConfiguration()->getFormNew();
|
||||
|
||||
if($this->has($form)){
|
||||
if ($this->has($form)) {
|
||||
$form = $this->createForm($this->get($form)->getName(), $object, $this->getConfiguration()->getFormNewOptions());
|
||||
}else {
|
||||
} else {
|
||||
$form = $this->createForm(new $form($this->getConfiguration()->getFormNewOptions()), $object);
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,7 @@ class BaseAdminController extends Controller
|
|||
* @return mixed
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function getConfiguration()
|
||||
protected function getConfiguration()
|
||||
{
|
||||
if (empty($this->configuration)) {
|
||||
throw new \LogicException('You must specify a crud configuration.');
|
||||
|
@ -797,38 +797,38 @@ class BaseAdminController extends Controller
|
|||
return $user;
|
||||
}
|
||||
|
||||
public function getSessionUser()
|
||||
protected function getSessionUser()
|
||||
{
|
||||
return $this->container->get('trinity.session_user');
|
||||
}
|
||||
|
||||
public function preSave($object)
|
||||
protected function preSave($object)
|
||||
{
|
||||
}
|
||||
|
||||
public function postSave($object, $wasNew = false)
|
||||
protected function postSave($object, $wasNew = false)
|
||||
{
|
||||
}
|
||||
|
||||
public function preRemove($object)
|
||||
protected function preRemove($object)
|
||||
{
|
||||
}
|
||||
|
||||
public function postRemove($object)
|
||||
protected function postRemove($object)
|
||||
{
|
||||
}
|
||||
|
||||
public function postDelete($object)
|
||||
protected function postDelete($object)
|
||||
{
|
||||
return $this->postRemove($object);
|
||||
}
|
||||
|
||||
public function preDelete($object)
|
||||
protected function preDelete($object)
|
||||
{
|
||||
return $this->preRemove($object);
|
||||
}
|
||||
|
||||
public function cleanString($text)
|
||||
protected function cleanString($text)
|
||||
{
|
||||
$text = preg_replace('`</?[^>]+>`U', '', $text);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class DefaultController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
public function getMenu()
|
||||
protected function getMenu()
|
||||
{
|
||||
$transformer = new ConfigurationTransformer($this->rac, $this->router, $this->factory, $this->config);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class MenuAdminController extends BaseAdminController
|
|||
$this->get('routeur.cache')->clearRouting();
|
||||
}
|
||||
|
||||
public function postSave($object, $wasNew = false)
|
||||
protected function postSave($object, $wasNew = false)
|
||||
{
|
||||
$object->createRootNode();
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ class NavigationAdminController extends BaseAdminController
|
|||
}
|
||||
}
|
||||
|
||||
public function postSave($object, $wasNew = false)
|
||||
protected function postSave($object, $wasNew = false)
|
||||
{
|
||||
$object->createRootNode();
|
||||
|
||||
|
|
|
@ -553,7 +553,7 @@ class NodeAdminController extends Controller
|
|||
$this->get('routeur.cache')->clearRouting();
|
||||
}
|
||||
|
||||
public function getSessionUser()
|
||||
protected function getSessionUser()
|
||||
{
|
||||
return $this->container->get('trinity.session_user');
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ class PageAdminController extends BaseAdminController
|
|||
$event = new LuceneEvent();
|
||||
$event->setObject($object);
|
||||
$nav = $object->getNodeRelatedByNodeId()->getNav();
|
||||
if($this->use_nav_name){
|
||||
if ($this->use_nav_name) {
|
||||
$event->setIndex($nav->getName());
|
||||
}else {
|
||||
} else {
|
||||
$event->setIndex($nav->getCulture());
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ class PageAdminController extends BaseAdminController
|
|||
}
|
||||
}
|
||||
|
||||
public function postSave($object, $was_new = false)
|
||||
protected function postSave($object, $was_new = false)
|
||||
{
|
||||
$this->use_nav_name = $this->container->getParameter('trinity_content_manager.index_use_nav_name');
|
||||
|
||||
|
@ -438,9 +438,9 @@ class PageAdminController extends BaseAdminController
|
|||
$event = new LuceneEvent();
|
||||
$event->setObject($object);
|
||||
$nav = $node->getNav();
|
||||
if($this->use_nav_name){
|
||||
if ($this->use_nav_name) {
|
||||
$event->setIndex($nav->getName());
|
||||
}else {
|
||||
} else {
|
||||
$event->setIndex($nav->getCulture());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use Trinity\Bundle\UserBundle\User\SessionUser;
|
|||
use Trinity\Bundle\ContentManagerBundle\Model\PageableInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Trinity\Bundle\ContentManagerBundle\Model\Nav;
|
||||
use WD\Bundle\ActualityBundle\Model\Actuality;
|
||||
|
||||
class PageController extends Controller
|
||||
{
|
||||
|
@ -27,14 +26,14 @@ class PageController extends Controller
|
|||
return $this->defaultRender();
|
||||
}
|
||||
|
||||
public function generateCmsUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||
protected function generateCmsUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||
{
|
||||
$route = sprintf('%d_%s', $this->getNavigationSelector()->retrieve()->getId(), $route);
|
||||
|
||||
return $this->container->get('router')->generate($route, $parameters, $referenceType);
|
||||
}
|
||||
|
||||
public function generateCmsUrlByNav(Nav $nav, $route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||
protected function generateCmsUrlByNav(Nav $nav, $route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||
{
|
||||
$route = sprintf('%d_%s', $nav->getId(), $route);
|
||||
|
||||
|
@ -123,7 +122,7 @@ class PageController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function getDefaultRenderParameters()
|
||||
protected function getDefaultRenderParameters()
|
||||
{
|
||||
return array(
|
||||
'page' => $this->getPage(),
|
||||
|
@ -134,7 +133,7 @@ class PageController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
public function defaultRender(array $parameters = array(), Response $response = null)
|
||||
protected function defaultRender(array $parameters = array(), Response $response = null)
|
||||
{
|
||||
$formats = array(
|
||||
'html' => 'text/html',
|
||||
|
@ -151,7 +150,7 @@ class PageController extends Controller
|
|||
/**
|
||||
* @return SessionUser
|
||||
*/
|
||||
public function getSessionUser()
|
||||
protected function getSessionUser()
|
||||
{
|
||||
return $this->container->get('trinity.session_user');
|
||||
}
|
||||
|
|
|
@ -41,14 +41,14 @@ class DefaultController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
public function getDashboard()
|
||||
protected function getDashboard()
|
||||
{
|
||||
$transformer = new ConfigurationTransformer(
|
||||
$this->rac,
|
||||
$this->router,
|
||||
$this->config,
|
||||
$this->getUser()
|
||||
);
|
||||
$this->rac,
|
||||
$this->router,
|
||||
$this->config,
|
||||
$this->getUser()
|
||||
);
|
||||
|
||||
return $transformer->getDash();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
$this->configuration = new CrudConfiguration();
|
||||
}
|
||||
|
||||
public function init()
|
||||
protected function init()
|
||||
{
|
||||
$form_options = array('use_ace_editor' => $this->container->getParameter('trinity_notification.use_ace_editor'));
|
||||
|
||||
|
@ -40,6 +40,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function indexAction($page, Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::indexAction($page, $request);
|
||||
}
|
||||
|
||||
|
@ -50,6 +51,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function newAction(Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::newAction($request);
|
||||
}
|
||||
|
||||
|
@ -61,6 +63,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function editAction($object, Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::editAction($object, $request);
|
||||
}
|
||||
|
||||
|
@ -72,6 +75,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function removeAction($object, $token, Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::removeAction($object, $token, $request);
|
||||
}
|
||||
|
||||
|
@ -83,6 +87,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function batchAction(Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::batchAction($request);
|
||||
}
|
||||
|
||||
|
@ -93,6 +98,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function clearFilterAction(Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::clearFilterAction($request);
|
||||
}
|
||||
|
||||
|
@ -104,6 +110,7 @@ class TemplateAdminController extends BaseAdminController
|
|||
public function rankAction(Request $request)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
return parent::rankAction($request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class ProfileAdminController extends BaseProfileController
|
|||
);
|
||||
}
|
||||
|
||||
public function getSessionUser()
|
||||
protected function getSessionUser()
|
||||
{
|
||||
return $this->container->get('trinity.session_user');
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ class UserAdminController extends BaseAdminController
|
|||
return $this->get('mailer')->send($message);
|
||||
}
|
||||
|
||||
public function postSave($object, $was_new = false)
|
||||
protected function postSave($object, $was_new = false)
|
||||
{
|
||||
$this->get('fos_user.user_manager')->updateUser($object);
|
||||
}
|
||||
|
@ -152,10 +152,10 @@ class UserAdminController extends BaseAdminController
|
|||
* @return mixed
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function getConfiguration()
|
||||
protected function getConfiguration()
|
||||
{
|
||||
// DI first
|
||||
if($this->has('trinity.user.crud.configuration')){
|
||||
if ($this->has('trinity.user.crud.configuration')) {
|
||||
$this->configuration = $this->get('trinity.user.crud.configuration');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue