Skip to content

Commit

Permalink
Merge pull request #252 from Asgraf/patch-1
Browse files Browse the repository at this point in the history
Replace Entity with EntityInterface in CrudViewHelper
  • Loading branch information
jippi authored Dec 28, 2018
2 parents e749753 + 7247aea commit 8903b77
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/View/Helper/CrudViewHelper.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace CrudView\View\Helper;

use Cake\ORM\Entity;
use Cake\Datasource\EntityInterface;
use Cake\Utility\Hash;
use Cake\Utility\Inflector;
use Cake\Utility\Text;
Expand All @@ -28,7 +28,7 @@ class CrudViewHelper extends Helper
/**
* Context
*
* @var \Cake\ORM\Entity
* @var \Cake\Datasource\EntityInterface
*/
protected $_context;

Expand All @@ -44,18 +44,18 @@ class CrudViewHelper extends Helper
/**
* Set context
*
* @param \Cake\ORM\Entity $record Entity.
* @param \Cake\Datasource\EntityInterface $record Entity.
* @return void
*/
public function setContext(Entity $record)
public function setContext(EntityInterface $record)
{
$this->_context = $record;
}

/**
* Get context
*
* @return \Cake\ORM\Entity
* @return \Cake\Datasource\EntityInterface
*/
public function getContext()
{
Expand All @@ -66,11 +66,11 @@ public function getContext()
* Process a single field into an output
*
* @param string $field The field to process.
* @param Entity $data The entity data.
* @param \Cake\Datasource\EntityInterface $data The entity data.
* @param array $options Processing options.
* @return string|null|array|bool|int
*/
public function process($field, Entity $data, array $options = [])
public function process($field, EntityInterface $data, array $options = [])
{
$this->setContext($data);

Expand Down Expand Up @@ -102,11 +102,11 @@ public function process($field, Entity $data, array $options = [])
/**
* Get the current field value
*
* @param Entity $data The entity data.
* @param \Cake\Datasource\EntityInterface $data The entity data.
* @param string $field The field to extract, if null, the field from the entity context is used.
* @return mixed
*/
public function fieldValue(Entity $data, $field)
public function fieldValue(EntityInterface $data, $field)
{
if (empty($data)) {
$data = $this->getContext();
Expand Down

0 comments on commit 8903b77

Please sign in to comment.