Thanks for that.. hadn't see it before.
It seems interesting, but I'm not sure it's exactly what I'm looking
for. It seems well suited for making models observable to components
and the like though.
It seems logical that if several models are associated with one
another (ie: the model PartyParticipant belongs to UserDetail and
PartyDetail) that I should be able to easily reference them within the
model and invalidate as needed -- or at least that the validation
check would work (which it does) AND set the invalidFields array
correctly (which it doesnt.. because the array is reset when back in
the controller that called the method in the PartyParticipant model)
For now I can get away with just having the primary model
(PartyParticipant) being invalidated ie:
$this->invalidate('field_name');
And use this model in the view's tagErrorMsg
Though I still hope to find out if it's possible to invalidate
associated models from within a model.
Thanks again!
-Ryan
On May 24, 9:35 pm, the_woodsman <[EMAIL PROTECTED]> wrote:
> Have you seen the example of the Observer pattern, described in the
> bakery somewhere?
> This might be helpful...
>
> On May 24, 1:09 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > I've searched around but can't find any discusson on this...
>
> > I have a method in the model that is handling a certain function for
> > me. It adds a couple records all linked together, and also allows
> > editing of these records. For the sake of example from the controller
> > I call:
>
> > $this->PartyParticipant->handleGuest( $name, $email, $rsvp );
>
> > and it will do its stuff, interacting with a couple models fine since
> > they're all referenced in the PartyParticipant model (via hasOne,
> > belongsTo, etc).
>
> > Problem is, I want to invalidate fields of OTHER models within this
> > method.
>
> > In the model I want to write:
> > $this->UserDetail->invalidate('name')
>
> > However the controller has a unique UserDetail object from the
> > PartyParticipant object... so it loses that invalidation data.
>
> > I suppose I can do this from controller:
> > $this->PartyParticipant->controller = &$this;
>
> > and in the PartyParticipant model:
> > $this->controller->UserDetail->invalidate('name');
>
> > but i hate to rely on a reference needing to be passed..
>
> > Any ideas? Thoughts? threats?
>
> > Thanks!!
>
> > -ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---