Wednesday, April 29, 2009

Re: model::read - restrict fields in HABTM objects

I was looking for the solution to this recently and, judging from the
source, there doesn't appear to be any way to limit associated models'
fields. Not even the models themselves, other than using unbind(). So,
I think the only solution is to use find() with contain.

Of course, I'd be delighted to be proven wrong.

On Wed, Apr 29, 2009 at 10:58 AM, toby1kenobi <toby.mathews@gmail.com> wrote:
>
> Hi all,
>
>  I have a model ('Facility) that has a HABTM relationship with
> another ('ContentImage'). When I call read on an instance of Facility
> it brings back details of related ContentImages. I would like to
> exclude a field in all of the ContentImages (a field called 'data' - a
> blob containing image data) in a certain instance.
>
>  Am I able to do this? I can see how you can pass a list of required
> fields to read, but I can't figure out the syntax for doing this for
> the HABTM model retrieved.
>
>  Any help much appreciated,
>
> Toby
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: