Skip to content

Instantly share code, notes, and snippets.

@kevinquinnyo
Created February 16, 2017 02:48
Show Gist options
  • Save kevinquinnyo/997f0ae547b150188aa707f550943b2c to your computer and use it in GitHub Desktop.
Save kevinquinnyo/997f0ae547b150188aa707f550943b2c to your computer and use it in GitHub Desktop.
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity as CakeEntity;
use Cake\Datasource\EntityTrait;
class Entity extends CakeEntity
{
use EntityTrait {
get as traitGet;
}
public function __construct(array $properties = [], array $options = [])
{
parent::__construct($properties, $options);
}
public function &get($property)
{
$chain = $this;
$properties = explode('.', $property);
foreach ($properties as $property) {
if ($chain !== null) {
$chain = $chain->traitGet($property);
}
}
return $chain;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment