Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

add Russian translation #24

Merged
merged 2 commits into from Oct 21, 2011
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions Entity/PostManager.php
Expand Up @@ -96,6 +96,13 @@ public function delete(PostInterface $post)
}

/**
* Retrieve posts, based on the criteria, a page at a time.
* Valid criteria are:
* enabled - boolean
* date - query
* tag - string
* author - 'NULL', 'NOT NULL', id, array of ids
*
* @param array $criteria
* @param $page
* @return \Sonata\AdminBundle\Datagrid\ORM\Pager
Expand Down Expand Up @@ -125,6 +132,13 @@ public function getPager(array $criteria, $page)
$parameters['tag_enabled'] = true;
}

if (isset($criteria['author'])) {
if (!is_array($criteria['author']) && stristr($criteria['author'], 'NULL')) {
$query->andWhere('p.author IS '.$criteria['author']);
} else {
$query->andWhere(sprintf('p.author IN (%s)', implode((array)$criteria['author'], ',')));
}
}
$query->setParameters($parameters);

$pager = new Pager();
Expand Down
Binary file added Resources/translations/SonataNewsBundle.ru.xliff
Binary file not shown.