Created
February 16, 2017 02:48
-
-
Save kevinquinnyo/997f0ae547b150188aa707f550943b2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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