Nooooooo (screamed in a big dramatic 'stop the wedding' type styleee)

If you resort to using Model->query() you're never going to get your
head around the basics of cake which sort of negates the point of
using Cake in the first place.  Honestly, querying related models is
so simple, I gave you the code further up this post.

If you are wanting to find a field's value from a record within the
Lodging model and you have the record's id available at $this-
>data['BookingPosition']['lodging_id']  you need to run Model->field()

  $value = $this->BookingPosition->Lodging->field('your_field_name',
array('Lodging.id'=>$this->data['BookingPosition']['lodging']));

Or you can pull the whole record by using the convenience method Model-
>findBy()

  $record = $this->BookingPosition->Lodging->findById($this-
>data['BookingPosition']['lodging']);

Or using Model->find()

  $record = $this->BookingPosition->Lodging->find('first',
array('conditions'=>array('Lodging.id'=>$this->data['BookingPosition']
['lodging'])));

You really need to get your head around Naming Conventions,
Controllers, Models, Associations, Retrieving and Saving data etc. and
the best way to do that is learnt he cookbook inside out, it's all
there for you to reference at any time.

Paul

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 [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

Reply via email to