Saturday, December 25, 2010

Re: retrieve id of 'belongsTo' relationship

On Sat, Dec 25, 2010 at 12:07 PM, rethab <rethab.ch@gmail.com> wrote:
> heyhey
>
> I'm facing a very easy-looking problem, but I can't solve it.
>
> In my application, a course has numerous meetings. So, I have the Meeting
> (in the Meeting Controller) and try to get the ID of the belonging Course,
> but the following returns NULL.
>
> $this->Meeting->read();
> $CourseID = $this->Meeting->Course->id;
>
> In the meantime, I changed it to
> $CourseID = $this->Meeting->field('course_id')

Use $this->Meeting->data['Course']['id'] instead.


> That works, but I'm very curious about, what's wrong with the other one.

Not sure. It does seem odd that Cake doesn't set it automatically, but
the information is available in $data so it's not too big a deal.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate