Kunstmaan/KunstmaanBundlesCMS — pull request #50 by T4m (2014-11-11 13:44:57+00:00)
Title: Allow to initialise pageparts providing service container

This PR allow to have dynamic and extended data in a pagepart, by initialising the pagepart with access to all his fields and to the service container (with locale and entity manager).

Just overriding the **AbstractPagePart** method **init*. Example, this get the **x** last **news** (where is **x** is a Integer field edited in Backoffice, and **news** is an *ArticlePage*):

```
public function init(PageInterface $page, ContainerInterface $container){

$locale = $container->getParameter('locale');
$em = $container->get('doctrine.orm.entity_manager');

$repository = $em->getRepository('LiipKumaPocBundle:News\NewsPage');
$news = $repository->getArticles($locale);
$this->news = array_slice($news, 0, $this->getNumber());
}
```

The extended content is then available in the webpage and in the backoffice.