Suppose I have an 'Order' model associated with the 'Customer' model.

class Order {
   var $belongsTo = array('Customer');}

Is there a standard way in CakePHP to validate if the record pointed to by 
the customer_id field exists?

$this->Order->create();
$this->Order->set('customer_id', 1);
$this->Order->set('order_date', date('Y-m-d'));
$this->Order->set('total', 100);
$this->Order->save();

Is there a validation rule that can be applied to the customer_id field of 
the Order model? Or, do I have to define a custom rule?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to