you could probably use the class name
$key === get_class($this)
and add it to your AppEntity class.
if you want to avoid the protected attribute in all files.
mark
Am Montag, 14. Juli 2014 10:23:17 UTC+2 schrieb José Lorenzo:
>
> I would add a Trait to your entities.
>
> Inteface: ArrayAccess
> Trait: LegacyAccessorTrait, with methods offsetGet(), offsetSet().
> offsetUnset(), offsetExists()
>
> Each of those methods will internally just check if the first argument is
> the "Model" name, and just ignore that and call the parent method. Example:
>
> class Article extends Entity {
> use LegacyAccessorTrait;
>
> protected $_legacyModelName = 'Article';
>
> }
>
> trait LegacyAccessorTrait {
>
> public function offsetGet($key) {
> if ($key === $this->_legacyModelName) {
> return $this;
> }
> return parent::offsetGet($key);
> }
>
> ...
> }
>
>
> That will give you some space while your remove your ['Model'] calls in
> the templates. the alternative is to just remove those :)
>
>
> On Monday, July 14, 2014 9:04:50 AM UTC+2, Thomas von Hassel wrote:
>>
>> Hi good people
>>
>> If i have a _crapton_ of templates that expect to receive data in the old
>> `$var[‘Model’][‘field’]` style, where would you translate this ? The
>> controllers will be rewritten in 3.x but the sheer volume of templates
>> makes i prohibitive to convert all at once.
>>
>>
>> /thomas
>>
>>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.