| 1 | <?php |
||
| 9 | abstract class AbstractDatagrid extends Datagrid implements FactoryInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param ContainerInterface $container |
||
| 13 | * @param string $requestedName |
||
| 14 | * @param array|null $options |
||
| 15 | * |
||
| 16 | * @return $this |
||
| 17 | */ |
||
| 18 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
||
| 19 | { |
||
| 20 | $this->setServiceLocator($container); |
||
| 21 | $config = $container->get('config'); |
||
| 22 | |||
| 23 | if (!isset($config['ZfcDatagrid'])) { |
||
| 24 | throw new InvalidArgumentException('Config key "ZfcDatagrid" is missing'); |
||
| 25 | } |
||
| 26 | |||
| 27 | /* @var $application \Zend\Mvc\Application */ |
||
| 28 | $application = $container->get('application'); |
||
| 29 | |||
| 30 | parent::setOptions($config['ZfcDatagrid']); |
||
|
|
|||
| 31 | parent::setMvcEvent($application->getMvcEvent()); |
||
| 32 | |||
| 33 | if ($container->has('translator') === true) { |
||
| 34 | parent::setTranslator($container->get('translator')); |
||
| 35 | } |
||
| 36 | |||
| 37 | parent::setRendererService($container->get('zfcDatagrid.renderer.' . parent::getRendererName())); |
||
| 38 | parent::init(); |
||
| 39 | |||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Call initGrid on rendering. |
||
| 45 | */ |
||
| 46 | public function render() |
||
| 47 | { |
||
| 48 | $this->initGrid(); |
||
| 49 | |||
| 50 | parent::render(); |
||
| 51 | } |
||
| 52 | |||
| 53 | abstract public function initGrid(); |
||
| 54 | } |
||
| 55 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.