mardi 4 août 2015

CakePHP - How to continue saving if associated model fails validation

Let's say I have an array:

array(
    'Foo' => array(
        'field1' => 'value1',
        'field2' => 'value2'
    ),
    'Bar' => array(
        'field1' => 'value1',
        'field2' => 'value2'
    )
)

Where Foo and Bar have model relationships set up and have their own validation conditions in he model.

How can I make it so if I am doing $this->Foo->save(); even if Bar fails its validation then it will still go ahead and save Foo only



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire