sadly inside the posted data there is only the lodging_id.
How do I get the value for numberofbeds fromthe lodging-model?
As the validation is inside the bookingpositions model
and the bookingpositions model only has the lodging_id
how do i get the attribute numberofbeds from the lodging with
id=lodging_id?
Thanks
Michael
On 23 Feb., 09:45, Jeremy Burns <jeremybu...@me.com> wrote:
> Turn on debugging (Configure::write('debug', 2); within /app/config/core.php) and type debug($this->data); (and perhaps die; as well) at the top of your controller function and you'll see exactly what's been posted. Then it's a case of accessing the right part of the array to get the values you want.
>
> Jeremy Burns
> jeremybu...@me.com
> (Skype) +44 208 123 3822 (jeremy_burns)
> (m) +44 7973 481949
> (h) +44 208 530 7573
>
> On 23 Feb 2010, at 08:41, mivogt-LU wrote:
>
> > I am newbie to cakephp and after some looking up in books and google I
> > need still help to start with cake...
>
> > I try to do my first application and am using several models linked to
> > tables and with relations between the models.
>
> > i.e.
> > model lodgings with the numberOfBeds
> > and a
> > model bookingpositions with lodging_id and amountOfPersons
>
> > If I want to check if there are enough beds in the room for the
> > persons,
> > i need to get the amountofbeds attribute for the lodging with the id
> > lodging_id
> > to pass the numberofbeds to my own validationfunction with the
> > amountOfPersons to check and validate or pass an errormessage.
>
> > Sadly I have no idea how to access the data posted from the model or
> > how to access the data of the linked model lodgings.
>
> > Could someone please help me with a bit of code?
>
> > I tried a print_r($data) and all the form values from the one model
> > are inside tha arary.
> > If i trie to access a value out of the array I fail to name the
> > index.
> > $data[amountofpersons] do not work and $data['amountofpersons'] do not
> > work, too.
>
> > And absolute no idea hot to get the numberofbeds from the linked model
> > sql might look like selct nubmerbofbeds from lodgings where id =
> > bookingpositions.lodging_id
> > but how to do it right with cake?????
>
> > Any help realy welcome!
> > Thanks in advance
>
> > Michael
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en
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
No comments:
Post a Comment