Esempio n. 1
0
 /**
  * @param \FSi\Bundle\AdminBundle\Admin\CRUD\ListElement $adminElement
  * @return \FSi\Component\DataSource\DataSource
  */
 protected function getDataSource(ListElement $adminElement)
 {
     if (!array_key_exists($adminElement->getId(), $this->datasources)) {
         $this->datasources[$adminElement->getId()] = $adminElement->createDataSource();
     }
     return $this->datasources[$adminElement->getId()];
 }
Esempio n. 2
0
 /**
  * @param \FSi\Bundle\AdminBundle\Admin\CRUD\ListElement $element
  * @param \FSi\Bundle\AdminBundle\Admin\Context\ContextManager $manager
  * @param \Symfony\Component\HttpFoundation\Request $request
  */
 function it_throw_exception_when_cant_find_context_builder_that_supports_admin_element($element, $manager, $request)
 {
     $element->getId()->willReturn("my_awesome_list_element");
     $manager->createContext(Argument::type('string'), $element)->shouldBeCalled()->willReturn(null);
     $this->shouldThrow('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException')->during('listAction', array($element, $request));
 }