diff --git a/src/ZfcDatagrid/Column/Formatter/GenerateLink.php b/src/ZfcDatagrid/Column/Formatter/GenerateLink.php index 132adafd..8a395d4a 100644 --- a/src/ZfcDatagrid/Column/Formatter/GenerateLink.php +++ b/src/ZfcDatagrid/Column/Formatter/GenerateLink.php @@ -38,7 +38,7 @@ public function __construct(ServiceManager $sm, $route, $key = null, $params = [ } /** - * @param AbstractColumn $columnUniqueId + * @param AbstractColumn $column * @return string */ public function getFormattedValue(AbstractColumn $column) diff --git a/src/ZfcDatagrid/Column/Type/AbstractType.php b/src/ZfcDatagrid/Column/Type/AbstractType.php index d205b0e7..fb1c03c6 100644 --- a/src/ZfcDatagrid/Column/Type/AbstractType.php +++ b/src/ZfcDatagrid/Column/Type/AbstractType.php @@ -36,4 +36,11 @@ public function getUserValue($val) { return $val; } + + /** + * Get the type name + * + * @return string + */ + abstract public function getTypeName(); } diff --git a/src/ZfcDatagrid/Column/Type/DateTime.php b/src/ZfcDatagrid/Column/Type/DateTime.php index 07baf6f6..e89497dd 100644 --- a/src/ZfcDatagrid/Column/Type/DateTime.php +++ b/src/ZfcDatagrid/Column/Type/DateTime.php @@ -44,8 +44,8 @@ class DateTime extends AbstractType * * @param string $sourceDateTimeFormat * PHP DateTime format - * @param unknown $outputDateType - * @param unknown $outputTimeType + * @param int $outputDateType + * @param int $outputTimeType * @param string $locale * @param string $sourceTimezone * @param string $outputTimezone @@ -60,6 +60,9 @@ public function __construct($sourceDateTimeFormat = 'Y-m-d H:i:s', $outputDateTy $this->setOutputTimezone($outputTimezone); } + /** + * @return string + */ public function getTypeName() { return 'dateTime'; diff --git a/src/ZfcDatagrid/Column/Type/Image.php b/src/ZfcDatagrid/Column/Type/Image.php index 3192788b..24b883a4 100644 --- a/src/ZfcDatagrid/Column/Type/Image.php +++ b/src/ZfcDatagrid/Column/Type/Image.php @@ -21,6 +21,9 @@ class Image extends AbstractType */ protected $resizeHeight = 20.5; + /** + * @return string + */ public function getTypeName() { return 'image'; diff --git a/src/ZfcDatagrid/DataSource/AbstractDataSource.php b/src/ZfcDatagrid/DataSource/AbstractDataSource.php index 48c0fe9e..c11bdd28 100644 --- a/src/ZfcDatagrid/DataSource/AbstractDataSource.php +++ b/src/ZfcDatagrid/DataSource/AbstractDataSource.php @@ -32,6 +32,21 @@ abstract class AbstractDataSource implements DataSourceInterface */ protected $paginatorAdapter; + /** + * Set the data source + * - array + * - ZF2: Zend\Db\Sql\Select + * - Doctrine2: Doctrine\ORM\QueryBuilder + * - ... + * + * @param mixed $data + */ + public function __construct($data) + { + // we need this exception, because a abstract __construct, create a exception in php-unit for mocking + throw new \Exception(sprintf('Missing __construct in %s', get_class($this))); + } + /** * Set the columns * @@ -126,4 +141,17 @@ public function getPaginatorAdapter() { return $this->paginatorAdapter; } + + /** + * Get the data back from construct + * @return mixed + */ + abstract public function getData(); + + /** + * Execute the query and set the paginator + * - with sort statements + * - with filters statements + */ + abstract public function execute(); } diff --git a/src/ZfcDatagrid/Renderer/AbstractRenderer.php b/src/ZfcDatagrid/Renderer/AbstractRenderer.php index 19f13558..15d7e421 100644 --- a/src/ZfcDatagrid/Renderer/AbstractRenderer.php +++ b/src/ZfcDatagrid/Renderer/AbstractRenderer.php @@ -14,8 +14,16 @@ abstract class AbstractRenderer implements RendererInterface { + /** + * + * @var array + */ protected $options = []; + /** + * + * @var string + */ protected $title; /** @@ -700,4 +708,30 @@ public function prepareViewModel(Datagrid $grid) $viewModel->setVariable('exportRenderers', $grid->getExportRenderers()); } + + /** + * Return the name of the renderer + * @return string + */ + abstract public function getName(); + + /** + * Determine if the renderer is for export + * @return boolean + */ + abstract public function isExport(); + + /** + * Determin if the renderer is HTML + * It can be export + html -> f.x. + * printing for HTML + * @return boolean + */ + abstract public function isHtml(); + + /** + * Execute all... + * @return ViewModel Response\Stream + */ + abstract public function execute(); }