本文整理汇总了PHP中APY\DataGridBundle\Grid\Source\Entity::getTableAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::getTableAlias方法的具体用法?PHP Entity::getTableAlias怎么用?PHP Entity::getTableAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APY\DataGridBundle\Grid\Source\Entity
的用法示例。
在下文中一共展示了Entity::getTableAlias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request)
{
$data = array();
$source = new Entity('OjsJournalBundle:Journal');
$source->manipulateRow(function (Row $row) use($request) {
/* @var Journal $entity */
$entity = $row->getEntity();
$entity->setDefaultLocale($request->getDefaultLocale());
if (!is_null($entity)) {
$row->setField('title', $entity->getTitle());
}
return $row;
});
$alias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use($alias) {
$query->andWhere($alias . '.status = :status')->setParameter('status', '0');
return $query;
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$rowAction = array();
$rowAction[] = $gridAction->editAction('ojs_admin_application_journal_edit', 'id');
$rowAction[] = $gridAction->showAction('ojs_admin_application_journal_show', 'id');
$rowAction[] = $gridAction->deleteAction('ojs_admin_application_journal_delete', 'id');
$actionColumn = new ActionsColumn("actions", 'actions');
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data['grid'] = $grid;
return $grid->getGridResponse('OjsAdminBundle:AdminApplication:journal.html.twig', $data);
}
示例2: indexAction
/**
* Lists all JournalSection entities.
*
*/
public function indexAction()
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('VIEW', $journal, 'sections')) {
throw new AccessDeniedException("You are not authorized for view this journal's sections!");
}
$source = new Entity('OjsJournalBundle:JournalSection');
$source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
$ta = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $qb) use($journal, $ta) {
$qb->where($qb->expr()->eq($ta . '.journalId', $journal->getId()));
return $qb;
});
$source->manipulateRow(function (Row $row) {
if ($row->getField("title") && strlen($row->getField('title')) > 20) {
$row->setField('title', substr($row->getField('title'), 0, 20) . "...");
}
return $row;
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_journal_section_show', ['id', 'journalId' => $journal->getId()]);
if ($this->isGranted('EDIT', $this->get('ojs.journal_service')->getSelectedJournal(), 'sections')) {
$rowAction[] = $gridAction->editAction('ojs_journal_section_edit', ['id', 'journalId' => $journal->getId()]);
}
if ($this->isGranted('DELETE', $this->get('ojs.journal_service')->getSelectedJournal(), 'sections')) {
$rowAction[] = $gridAction->deleteAction('ojs_journal_section_delete', ['id', 'journalId' => $journal->getId()]);
}
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
return $grid->getGridResponse('OjsJournalBundle:JournalSection:index.html.twig', $data);
}
示例3: indexAction
/**
* Lists all Design entities.
*
* @param Request $request
* @return Response
*/
public function indexAction(Request $request)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('VIEW', $journal, 'design')) {
throw new AccessDeniedException("You are not authorized for view this journal's designs!");
}
$source = new Entity('OjsJournalBundle:Design');
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function ($query) use($tableAlias, $journal) {
$query->andWhere($tableAlias . '.owner = :journal')->setParameter('journal', $journal);
});
$source->manipulateRow(function (Row $row) use($request) {
/* @var Design $entity */
$entity = $row->getEntity();
if (!is_null($entity)) {
$entity->getOwner()->setDefaultLocale($request->getDefaultLocale());
$row->setField('owner', $entity->getOwner()->getTitle());
}
return $row;
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_journal_design_show', ['id', 'journalId' => $journal->getId()]);
$rowAction[] = $gridAction->editAction('ojs_journal_design_edit', ['id', 'journalId' => $journal->getId()]);
$rowAction[] = $gridAction->deleteAction('ojs_journal_design_delete', ['id', 'journalId' => $journal->getId()]);
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
return $grid->getGridResponse('OjsJournalBundle:Design:index.html.twig', $data);
}
示例4: indexAction
/**
* Lists all SubmissionChecklist entities.
*
*/
public function indexAction()
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('VIEW', $journal, 'checklist')) {
throw new AccessDeniedException("You are not authorized for view this page!");
}
$source = new Entity('OjsJournalBundle:SubmissionChecklist');
$source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
if ($journal) {
$ta = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $qb) use($journal, $ta) {
$qb->andWhere($qb->expr()->eq("{$ta}.journal_id", ':journal'))->setParameter('journal', $journal->getId());
});
}
if (!$journal) {
throw new NotFoundHttpException("Journal not found!");
}
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_journal_checklist_show', ['id', 'journalId' => $journal->getId()]);
$rowAction[] = $gridAction->editAction('ojs_journal_checklist_edit', ['id', 'journalId' => $journal->getId()]);
$rowAction[] = $gridAction->deleteAction('ojs_journal_checklist_delete', ['id', 'journalId' => $journal->getId()]);
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
$data['journal_id'] = $journal;
return $grid->getGridResponse('OjsJournalBundle:SubmissionChecklist:index.html.twig', $data);
}
示例5: indexAction
/**
* Lists all PublisherThemes entities.
*
* @param integer $publisherId
* @return Response
*/
public function indexAction($publisherId)
{
$em = $this->getDoctrine()->getManager();
$publisher = $em->getRepository('OjsJournalBundle:Publisher')->find($publisherId);
$this->throw404IfNotFound($publisher);
if (!$this->isGrantedForPublisher($publisher)) {
throw new AccessDeniedException("You are not authorized for this page!");
}
$source = new Entity('OjsJournalBundle:PublisherTheme');
$alias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $qb) use($publisher, $alias) {
$qb->andWhere($alias . '.publisher = :publisher')->setParameter('publisher', $publisher);
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_publisher_manager_theme_show', ['publisherId' => $publisher->getId(), 'id']);
$rowAction[] = $gridAction->editAction('ojs_publisher_manager_theme_edit', ['publisherId' => $publisher->getId(), 'id']);
$rowAction[] = $gridAction->deleteAction('ojs_publisher_manager_theme_delete', ['publisherId' => $publisher->getId(), 'id']);
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
$data['publisher'] = $publisher;
return $grid->getGridResponse('OjsJournalBundle:ManagerPublisherTheme:index.html.twig', $data);
}
示例6: indexAction
public function indexAction(Request $request, $issueId)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$this->throw404IfNotFound($journal);
if (!$this->isGranted('VIEW', $journal, 'issues')) {
throw new AccessDeniedException("You not authorized for this page!");
}
$source = new Entity('OjsJournalBundle:IssueFile');
$source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
$issue = $this->getDoctrine()->getRepository('OjsJournalBundle:Issue')->find($issueId);
$this->throw404IfNotFound($issue);
$alias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use($alias, $issueId) {
$query->join($alias . '.issue', 'i')->where('i.id = :issueId')->setParameter('issueId', $issueId);
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_journal_issue_file_show', ['id', 'journalId' => $journal->getId(), 'issueId' => $issueId]);
$rowAction[] = $gridAction->editAction('ojs_journal_issue_file_edit', ['id', 'journalId' => $journal->getId(), 'issueId' => $issueId]);
$rowAction[] = $gridAction->deleteAction('ojs_journal_issue_file_delete', ['id', 'journalId' => $journal->getId(), 'issueId' => $issueId]);
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
$data['issue'] = $issue;
return $grid->getGridResponse('OjsJournalBundle:IssueFile:index.html.twig', $data);
}
示例7: indexAction
public function indexAction()
{
$data = array();
$source = new Entity('OjsJournalBundle:Publisher', 'application');
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use($tableAlias) {
$query->andWhere($tableAlias . ".status = :status")->setParameter('status', 0);
return $query;
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$grid->getColumn('status')->manipulateRenderCell(function ($value) {
return $this->get('translator')->trans(Publisher::$statuses[$value]);
});
$rowAction = array();
$saveAction = new RowAction('<i class="fa fa-save"></i>', 'ojs_admin_application_publisher_save');
$saveAction->setRouteParameters(['id']);
$saveAction->setAttributes(['class' => 'btn btn-primary btn-xs', 'title' => $this->get('translator')->trans('institute.merge_as_new_institute')]);
$rowAction[] = $saveAction;
$rowAction[] = $gridAction->showAction('ojs_admin_application_publisher_show', 'id');
$rowAction[] = $gridAction->editAction('ojs_admin_application_publisher_edit', 'id');
$rowAction[] = $gridAction->deleteAction('ojs_admin_application_publisher_delete', 'id');
$actionColumn = new ActionsColumn("actions", 'actions');
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data['grid'] = $grid;
return $grid->getGridResponse('OjsAdminBundle:AdminApplication:publisher.html.twig', $data);
}
示例8: typeAction
/**
* Index view of content by type
*
* @param int $type
* @return Response
*/
public function typeAction($type)
{
$contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
if (!$contentType) {
throw $this->createNotFoundException(sprintf('Content Type with ID %d could not be found.', $type));
}
$queryBuilder = $this->get('opifer.content.content_manager')->getRepository()->createValuedQueryBuilder('c');
$source = new Entity($this->getParameter('opifer_content.content_class'));
$source->initQueryBuilder($queryBuilder);
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function ($query) use($tableAlias, $contentType) {
$query->andWhere($tableAlias . '.contentType = :contentType')->setParameter('contentType', $contentType);
});
$editAction = new RowAction('button.edit', 'opifer_content_contenteditor_design');
$editAction->setRouteParameters(['id', 'type' => 'content']);
//$deleteAction = new RowAction('button.delete', 'opifer_content_content_delete');
//$deleteAction->setRouteParameters(['id']);
/* @var $grid \APY\DataGridBundle\Grid\Grid */
$grid = $this->get('grid');
$grid->setId('content')->setSource($source)->addRowAction($editAction);
//->addRowAction($deleteAction)
foreach ($contentType->getSchema()->getAttributes() as $attribute) {
$name = $attribute->getName();
$column = new TextColumn(['id' => $name, 'field' => 'attributes.' . $attribute->getName() . '.value', 'title' => $attribute->getDisplayName()]);
$column->manipulateRenderCell(function ($value, $row, $router) use($name) {
$value = $row->getEntity()->getAttributes()[$name];
return $value;
});
$grid->addColumn($column);
}
return $grid->getGridResponse($this->getParameter('opifer_content.content_type_view'), ['content_type' => $contentType, 'grid' => $grid]);
}
示例9: indexAction
/**
* Lists all ArticleFile entities.
* @param Integer $articleId
* @return Response
*/
public function indexAction($articleId)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$article = $this->getDoctrine()->getRepository('OjsJournalBundle:Article')->find($articleId);
$this->throw404IfNotFound($article);
if (!$this->isGranted('VIEW', $journal, 'articles')) {
throw new AccessDeniedException("You not authorized for this page!");
}
$source = new Entity('OjsJournalBundle:ArticleFile');
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $qb) use($article, $tableAlias) {
return $qb->where($tableAlias . '.article = :article')->setParameter('article', $article);
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_journal_article_file_show', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]);
$rowAction[] = $gridAction->editAction('ojs_journal_article_file_edit', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]);
$rowAction[] = $gridAction->deleteAction('ojs_journal_article_file_delete', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]);
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
$data['article'] = $article;
return $grid->getGridResponse('OjsJournalBundle:ArticleFile:index.html.twig', $data);
}
示例10: notFinishedAction
/**
* Returns setupFinished == false journals
*
* @param Request $request
* @return Response
*/
public function notFinishedAction(Request $request)
{
if (!$this->isGranted('VIEW', new Journal())) {
throw new AccessDeniedException("You not authorized for list journals!");
}
$source = new Entity('OjsJournalBundle:Journal');
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use($tableAlias) {
$query->andWhere($tableAlias . '.setupFinished = 0');
});
$source->manipulateRow(function (Row $row) use($request) {
/* @var Journal $entity */
$entity = $row->getEntity();
$entity->setDefaultLocale($request->getDefaultLocale());
if (!is_null($entity)) {
$row->setField('title', $entity->getTitle());
$row->setField('subtitle', $entity->getSubtitle());
$row->setField('description', $entity->getDescription());
}
return $row;
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_admin_journal_show', 'id');
$rowAction[] = $gridAction->editAction('ojs_journal_settings_index', 'id')->setRouteParametersMapping(['id' => 'journalId']);
$rowAction[] = $gridAction->cmsAction();
$rowAction[] = $gridAction->deleteAction('ojs_admin_journal_delete', 'id');
$rowAction[] = (new RowAction('Manage', 'ojs_journal_dashboard_index'))->setRouteParameters('id')->setRouteParametersMapping(array('id' => 'journalId'))->setAttributes(array('class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'title' => "Manage"));
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
return $grid->getGridResponse('OjsAdminBundle:AdminJournal:index.html.twig', $data);
}
示例11: indexAction
/**
* Lists all Citation entities.
*
* @param Request $request
* @param Integer $articleId
* @return Response
*/
public function indexAction(Request $request, $articleId)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$this->throw404IfNotFound($journal);
if (!$this->isGranted('VIEW', $journal, 'articles')) {
throw new AccessDeniedException("You not authorized for this page!");
}
$article = $this->getDoctrine()->getRepository('OjsJournalBundle:Article')->find($articleId);
$this->throw404IfNotFound($article);
$source = new Entity('OjsJournalBundle:Citation');
if ($articleId !== null) {
$alias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use($alias, $articleId) {
$query->join($alias . '.articles', 'a')->where('a.id = :articleId')->setParameter('articleId', $articleId);
});
}
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_journal_citation_show', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]);
$rowAction[] = $gridAction->editAction('ojs_journal_citation_edit', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]);
$rowAction[] = $gridAction->deleteAction('ojs_journal_citation_delete', ['id', 'journalId' => $journal->getId(), 'articleId' => $articleId]);
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
return $grid->getGridResponse('OjsJournalBundle:Citation:index.html.twig');
}
示例12: listAction
/**
* List all brands.
*
* @throws AccessDeniedException If authenticate user is not allowed to access to this resource (minimum ROLE_ADMIN)
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function listAction()
{
$this->get('event_dispatcher')->dispatch(ProductEvents::LIST_BRANDS, new Event());
// Set Datagrid source
$source = new Entity($this->getParameter('asf_product.brand.entity'));
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function ($query) use($tableAlias) {
$query instanceof QueryBuilder;
if (count($query->getDQLPart('orderBy')) == 0) {
$query->orderBy($tableAlias . '.name', 'ASC');
}
});
// Get Grid instance
$grid = $this->get('grid');
$grid instanceof Grid;
// Attach the source to the grid
$grid->setSource($source);
$grid->setId('asf_brands_list');
// Columns configuration
$editAction = new RowAction('btn_edit', 'asf_product_brand_edit');
$editAction->setRouteParameters(array('id'));
$grid->addRowAction($editAction);
$deleteAction = new RowAction('btn_delete', 'asf_product_brand_delete', true);
$deleteAction->setRouteParameters(array('id'))->setConfirmMessage($this->get('translator')->trans('asf.product.msg.delete.confirm', array('%name%' => $this->get('translator')->trans('asf.product.default_value.this_brand'))));
$grid->addRowAction($deleteAction);
$grid->setNoDataMessage($this->get('translator')->trans('asf.product.msg.list.no_brand'));
return $grid->getGridResponse('ASFProductBundle:Brand:list.html.twig');
}
示例13: notFinishedAction
/**
* Returns setupStatus == false journals
* @return Response
*/
public function notFinishedAction()
{
if (!$this->isGranted('VIEW', new Journal())) {
throw new AccessDeniedException("You not authorized for list journals!");
}
$source = new Entity('OjsJournalBundle:Journal');
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function ($query) use($tableAlias) {
$query->andWhere($tableAlias . '.setup_status = 0');
});
$source->addHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$actionColumn = new ActionsColumn("actions", 'actions');
$rowAction[] = $gridAction->showAction('ojs_admin_journal_show', 'id');
$rowAction[] = $gridAction->editAction('ojs_admin_journal_edit', 'id');
$rowAction[] = $gridAction->cmsAction();
$rowAction[] = $gridAction->deleteAction('ojs_admin_journal_delete', 'id');
$rowAction[] = (new RowAction('Manage', 'change_selected_journal'))->setRouteParameters('id')->setRouteParametersMapping(array('id' => 'journal_id'))->setAttributes(array('class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'title' => "Manage"));
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data = [];
$data['grid'] = $grid;
return $grid->getGridResponse('OjsAdminBundle:AdminJournal:index.html.twig', $data);
}
示例14: indexAction
public function indexAction(Request $request)
{
$data = array();
$source = new Entity('OjsJournalBundle:Journal');
$source->manipulateRow(function (Row $row) use($request) {
/* @var Journal $entity */
$entity = $row->getEntity();
$entity->setDefaultLocale($request->getDefaultLocale());
if (!is_null($entity)) {
$row->setField('title', $entity->getTitle());
}
return $row;
});
$alias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use($alias) {
$query->andWhere($alias . '.status = :status')->setParameter('status', JournalStatuses::STATUS_PREPARING);
return $query;
});
$grid = $this->get('grid')->setSource($source);
$gridAction = $this->get('grid_action');
$saveAction = new RowAction('<i class="fa fa-save"></i>', 'ojs_admin_application_journal_save');
$saveAction->setRouteParameters(['id']);
$saveAction->setAttributes(['class' => 'btn btn-primary btn-xs', 'title' => $this->get('translator')->trans('journal.merge_as_new_journal')]);
$rowAction = array();
$rowAction[] = $saveAction;
$rowAction[] = $gridAction->editAction('ojs_admin_application_journal_edit', 'id');
$rowAction[] = $gridAction->showAction('ojs_admin_application_journal_show', 'id');
$rowAction[] = $gridAction->deleteAction('ojs_admin_application_journal_delete', 'id');
$actionColumn = new ActionsColumn("actions", 'actions');
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$data['grid'] = $grid;
return $grid->getGridResponse('OjsAdminBundle:AdminApplication:journal.html.twig', $data);
}
示例15: listAction
/**
* List all website config
*
* @throws AccessDeniedException If authenticate user is not allowed to access to this resource (minimum ROLE_ADMIN)
* @return \Symfony\Component\HttpFoundation\Response
*/
public function listAction()
{
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) {
throw new AccessDeniedException();
}
// Set Datagrid source
$source = new Entity($this->get('asf_website.config.manager')->getClassName());
$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function ($query) use($tableAlias) {
$query instanceof QueryBuilder;
if (count($query->getDQLPart('orderBy')) == 0) {
$query->orderBy($tableAlias . '.name', 'ASC');
}
});
// Get Grid instance
$grid = $this->get('grid');
$grid instanceof Grid;
// Attach the source to the grid
$grid->setSource($source);
$grid->setId('asf_website_config_list');
// Columns configuration
$grid->hideColumns(array('id'));
$grid->getColumn('name')->setTitle($this->get('translator')->trans('Config name', array(), 'asf_website'))->setDefaultOperator('like')->setOperatorsVisible(false);
$editAction = new RowAction('btn_edit', 'asf_website_config_edit');
$editAction->setRouteParameters(array('id'));
$grid->addRowAction($editAction);
$deleteAction = new RowAction('btn_delete', 'asf_website_config_delete', true);
$deleteAction->setRouteParameters(array('id'))->setConfirmMessage($this->get('translator')->trans('Do you want to delete this config?', array(), 'asf_website'));
$grid->addRowAction($deleteAction);
$grid->setNoDataMessage($this->get('translator')->trans('No config was found.', array(), 'asf_website'));
return $grid->getGridResponse('ASFWebsiteBundle:Config:list.html.twig');
}