fuel / orm

Fuel PHP Framework - Fuel v1.x ORM
http://fuelphp.com/docs/packages/orm/intro.html
152 stars 96 forks source link

cascade delete in 1.6.1 #306

Closed emarguin closed 11 years ago

emarguin commented 11 years ago

Hi there,

I noticed some code quite strange when trying to delete a model and its relations. Indeed in model.php, function delete, line, 1399 we have : $this->freeze();

then we try to remove relations

but in function get(), line 1068, we have : if ($this->_frozen) { // avoid a notice, we're returning by reference $var = null; return $var; }

It means that if the relation has not been used before the $mymodel->delete() call, it won't be deleted.

I might miss a point ?

WanWizard commented 11 years ago

Was fixed here: https://github.com/fuel/orm/commit/dcc815e06a5a319154b9c16bb059276d2a1266d2