Last active
August 29, 2015 14:19
-
-
Save azamouchi/1fe45307e180b885ba21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_archives($app,$bbapp, $site) { | |
$response = array(); | |
$page = $app->request->post('page') != null ? $app->request->post('page') : 0 ; | |
$root = $bbapp->getEntityManager()->getRepository('BackBuilder\NestedNode\Page')->getRoot($site); | |
// Construction du sélecteur de contenu | |
$selector = array( | |
'BySite'=> $site->getUid(), | |
//'parentnode' => array("4b2b88f8d2505a6fa3971871ed42c834"), | |
); | |
// Lancement de la requ�te de s�lection | |
$articles = $bbapp->getEntityManager() | |
->getRepository('BackBuilder\ClassContent\AClassContent') | |
->getSelection( | |
$selector, // Le s�lecteur | |
true, // R�sultat pagin� | |
true, // Recherche r�cursive dans l'arbre | |
0*$page, // Point de d�part des r�sultats | |
50, // Limite du nombre de r�sultats (optionnel car d�j� dans le s�lecteur) | |
true, // Uniquement les pages en ligne | |
false, // Ignor� | |
array('BackBuilder\ClassContent\Archive\article') // On ne souhaite que des articles | |
); | |
foreach($articles as $article) { | |
$obj = new StdClass(); | |
$obj->id = $article->getUid(); | |
$obj->titre = $article->titre->value; | |
$obj->date = date("d/m/Y",intval($article->date->value)); | |
$response[]= $obj; | |
} | |
succes($app, $response); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment