Thursday, June 28, 2012

Override behavior method?

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

No comments: