Looking at the source of model.php, you'll see that Behavior's
beforeSave() is executed *before* the model's beforeSave().
So if you can handle the execution order being Behavior, AppModel,
Track, then just add this code into your Track model.
function beforeSave() {
if (!parent::beforeSave()) {
return false;
}
// add in your track beforeSave stuff in here, making sure you
return a boolean value
}
Cheers,
Adam
On Dec 4, 11:57 pm, Ernesto <[EMAIL PROTECTED]> wrote:
> Hello
>
> app\App_Model.php
> <?php
> class AppModel extends Model {
> var $actAs = array("My");
> function beforeSave() { }
> }
> ?>
>
> app\models\behaviors\My.php
> <?php
> class MyBehavior extends ModelBehavior {
> function beforeSave() { }
> }
> ?>
>
> app\models\Track.php
> <?php
> class TrackModel extends AppModel {
> function beforeSave() { }
> }
> ?>
>
> i'm looking for a smart way to
> - execute the AppModel's beforeSave()
> then
> - execute the TrackModel's beforeSave()
> and last
> - execute the MyBehavior's beforeSave()
>
> i tried with parent::beforeSave() but i can't get it to work
>
> Any help/hint is appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---