cedriclombardot/AdmingeneratorIpsum — Issue #4: Method "Admingenerator\DemoBundle\Controller\ListController::indexAction" does not exist.
Author: harikt
Created: 2011-10-29 08:34:05+00:00
State: open

Method "Admingenerator\DemoBundle\Controller\ListController::indexAction" does not exist.

This is from the cache and the ListController

hari@hari-Vostro1510:/media/Linux/Symfony$ cat src/Admingenerator/DemoBundle/Controller/ListController.php
get('request')->query->get('page'))
{
$this->setPage($this->get('request')->query->get('page'));
}

if ($this->get('request')->query->get('sort'))
{
$this->setSort($this->get('request')->query->get('sort'), $this->get('request')->query->get('order_by','ASC'));
}

$form = $this->getFilterForm();

return $this->render('AdmingeneratorDemoBundle:List:index.html.twig', array(
'Movies' => $this->getPager(),
'form' => $form->createView(),
'sortColumn' => $this->getSortColumn(),
'sortOrder' => $this->getSortOrder(),
'scopes' => $this->getScopes(),
));
}
/**
* Store in the session service the current page
*
* @param integer $page The page number
*/
protected function setPage($page)
{
$this->get('session')->set('Admingenerator\DemoBundle\List\Page', $page);
}

/**
* Return the stored page
*
* @return integer $page The page number
*/
protected function getPage()
{
return $this->get('session')->get('Admingenerator\DemoBundle\List\Page', 1);
}

protected function getPager()
{
$paginator = new Pagerfanta(new PagerAdapter($this->getQuery()));
$paginator->setMaxPerPage(3);
$paginator->setCurrentPage($this->getPage(), false, true);

return $paginator;
}
/**
* Store in the session service the current sort
*
* @param string $column The column
* @param string $order_by The order sorting (ASC,DESC)
*/
protected function setSort($column, $order_by)
{
$this->get('session')->set('Admingenerator\DemoBundle\List\Sort', $column);

if ($order_by == 'desc') {
$this->get('session')->set('Admingenerator\DemoBundle\List\OrderBy', 'DESC');
} else {
$this->get('session')->set('Admingenerator\DemoBundle\List\OrderBy', 'ASC');
}
}

/**
* Return the stored sort
*
* @return string The column to sort
*/
protected function getSortColumn()
{
return $this->get('session')->get('Admingenerator\DemoBundle\List\Sort', 'producer.name');
}

/**
* Return the stored sort order
*
* @return string the order mode ASC|DESC
*/
protected function getSortOrder()
{
return $this->get('session')->get('Admingenerator\DemoBundle\List\OrderBy', 'DESC');
}

public function filtersAction()
{
if ($this->get('request')->get('reset')) {
$this->setFilters(array());

return new RedirectResponse($this->generateUrl("Admingenerator_DemoBundle_list"));
}

$form = $this->getFilterForm();
$form->bindRequest($this->get('request'));

if ($form->isValid()) {
$this->setFilters($form->getClientData());
}

return new RedirectResponse($this->generateUrl("Admingenerator_DemoBundle_list"));
}

/**
* Store in the session service the current filters
*
* @param array the filters
*/
protected function setFilters($filters)
{
$this->get('session')->set('Admingenerator\DemoBundle\List\Filters', $filters);
}

protected function getFilters()
{
return $this->get('session')->get('Admingenerator\DemoBundle\List\Filters', array());
}
public function scopesAction()
{
if ($this->get('request')->get('reset')) {
$this->setScopes(array());

return new RedirectResponse($this->generateUrl("Admingenerator_DemoBundle_list"));
}

$this->setScope($this->get('request')->get('group'), $this->get('request')->get('scope'));

return new RedirectResponse($this->generateUrl("Admingenerator_DemoBundle_list"));
}

/**
* Store in the session service the current scopes
*
* @param array the scopes
*/
protected function setScopes($scopes)
{
$this->get('session')->set('Admingenerator\DemoBundle\List\Scopes', $scopes);
}

/**
* Change the value of one Scope
*
* @param string the group name
* @param string the scope name
*/
protected function setScope($groupName, $scopeName)
{
$scopes = $this->getScopes();
$scopes[$groupName] = $scopeName;
$this->setScopes($scopes);
}

protected function getScopes()
{
return $this->get('session')->get('Admingenerator\DemoBundle\List\Scopes', $this->getDefaultScopes());
}

protected function getDefaultScopes()
{
$scopes = array();

$scopes['group_1'] = '';

$scopes['group_1'] = 'Published';
$scopes['group_2'] = '';

return $scopes;
}

/*
* @return string|null the scope setted for the current group
*/
protected function getScope($groupName)
{
$scopes = $this->getScopes();

return isset($scopes[$groupName]) ? $scopes[$groupName] : null ;
}

protected function getQuery()
{
$query = $this->getDoctrine()
->getEntityManager()
->createQueryBuilder()
->select('q')
->from('Admingenerator\DemoBundle\Entity\Movie', 'q');

$this->processSort($query);
$this->processFilters($query);
$this->processScopes($query);

return $query->getQuery();
}

protected function processSort($query)
{
if ($this->getSortColumn()) {
if (!strstr($this->getSortColumn(), '.')) { //direct column
$query->orderBy('q.'.$this->getSortColumn(), $this->getSortOrder());
} else {
list($table, $column) = explode('.', $this->getSortColumn(), 2);
$this->addJoinFor($table, $query);
$query->orderBy($this->getSortColumn(), $this->getSortOrder());
}
}
}

protected function getFilterForm()
{
$filters = $this->getFilters();

if (isset($filters['producer'])) {
$this->getDoctrine()->getEntityManager()->getUnitOfWork()->registerManaged($filters['producer'], array($filters['producer']->getId()), array());
}
if (isset($filters['actors'])) {
$this->getDoctrine()->getEntityManager()->getUnitOfWork()->registerManaged($filters['actors'], array($filters['actors']->getId()), array());
}

return $this->createForm(new FiltersType(), $this->getFilters());
}

protected function addJoinFor($table, $query)
{
$query->leftJoin('q.'.$table, $table);
}

protected function processFilters($query)
{
$filterObject = $this->getFilters();

$queryFilter = $this->get('admingenerator.queryfilter.doctrine');
$queryFilter->setQuery($query);

if (isset($filterObject['title']) && null !== $filterObject['title']) {
$queryFilter->addStringFilter("title", $filterObject['title']);
}

if (isset($filterObject['is_published']) && null !== $filterObject['is_published']) {
$queryFilter->addBooleanFilter("is_published", $filterObject['is_published']);
}

if (isset($filterObject['producer']) && null !== $filterObject['producer']) {
$queryFilter->addEntityFilter("producer", $filterObject['producer']);
}

if (isset($filterObject['actors']) && null !== $filterObject['actors']) {
$queryFilter->addCollectionFilter("actors.id", $filterObject['actors']);
}

if (isset($filterObject['release_date']) && null !== $filterObject['release_date']) {
$queryFilter->addDateFilter("release_date", $filterObject['release_date']);
}

}

protected function processScopes($query)
{
$scopes = $this->getScopes();

$queryFilter = $this->get('admingenerator.queryfilter.doctrine');
$queryFilter->setQuery($query);

if (isset($scopes['group_1']) && $scopes['group_1'] == 'All') {

}

if (isset($scopes['group_1']) && $scopes['group_1'] == 'Published') {
$queryFilter->addDefaultFilter("is_published", true);
}

if (isset($scopes['group_1']) && $scopes['group_1'] == 'Not Published') {
$queryFilter->addDefaultFilter("is_published", false);
}

if (isset($scopes['group_2']) && $scopes['group_2'] == 'With actors') {
$this->scopeWithActors($queryFilter);
}

if (isset($scopes['group_2']) && $scopes['group_2'] == 'Without actos') {
$this->scopeWithoutActors($queryFilter);
}
}

/**
* Add the filters to the query for group_2 => With actors
*
* @param queryFilter the queryFilter
*/
protected function scopeWithActors($query)
{
} /**
* Add the filters to the query for group_2 => Without actos
*
* @param queryFilter the queryFilter
*/
protected function scopeWithoutActors($query)
{
}}
hari@hari-Vostro1510:/media/Linux/Symfony$