Thursday, June 28, 2012

Re: Override behavior method?

It will run the Models fly()-method!

Once in a while it is nice to dig into the framework code to find out
how it works - having a good IDE helps with this

Cheers

Tarique

On Thu, Jun 28, 2012 at 12:39 PM, Poyan Nabati <poyan.nabati@gmail.com> wrote:
> From the manual:
>
> Behavior methods are automatically available on any model acting as the
> behavior. For example if you had:
> <?php
> class Duck extends AppModel {
>     public $name = 'Duck';
>     public $actsAs = array('Flying');
> }
> You would be able to call FlyingBehavior methods as if they were methods on
> your Duck model. When creating behavior methods you automatically get passed
> a reference of the calling model as the first parameter. All other supplied
> parameters are shifted one place to the right. For example:
> <?php
> $this->Duck->fly('toronto', 'montreal');
>
> What happens if Duck already has a method fly()?
>
> Do you
>
> get an error?
> run the Models fly()-method?
> run the Behaviors fly()-method?
>
> Or formulated differently;
> With an attached behavior, can I still override certain methods with local
> implementations?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php



--
=============================================================
PHP for E-Biz: http://sanisoft.com
=============================================================

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: