weavora/wform — Issue #12: Be able to delete related records
Author: asakurayoh
Created: 2012-01-19 17:51:25+00:00
State: open

If set in "relation", should be able to delete related content (not only many_to_many records.
By example, in the Product example, if you add the posibility to delete a product, and use:

```php
$product = ProductForm::model()->findByPk($id);
$product->delete();
```
The record for "ProductDescription" is not deleted..
An option like that would do the trick, for configuration:

```php
public function behaviors()
{
return array_merge(
parent::behaviors(),
array(
'wform' => array(
'class' => 'ext.wform.WFormBehavior',
'relations' => array(
'category' => array('unsetInvalid' => true, 'required' => false),
'tags' => array('required' => false),
'images', => array('cascadeDelete' => true)
'certificate', => array('cascadeDelete' => true)
'description' => array('cascadeDelete' => true),
),
),
)
);
```

Here, the images, certificate and description would be delete when calling ProductForm->delete.