287 next($this->key_from); 288 } 289 \Debug::dump($query); 290 \Debug::backtrace(); 291 //die(); 292 $query->delete(); 293 294 $cascade = is_null($cascade) ? $this->cascade_delete : (bool) $cascade; 295 if ($cascade and ! empty($model_to)) 296 { 297 foreach ($models_to as $m)
class Model_Users extends Orm\Model { protected static $_many_many = array( 'sites' => array( 'key_from' => 'id', 'key_through_from' => 'user_id', // column 1 from the table in between, should match a posts.id 'table_through' => 'sites_users', // both models plural without prefix in alphabetical order 'key_through_to' => 'site_id', // column 2 from the table in between, should match a users.id 'model_to' => 'Model_Sites', 'key_to' => 'id', 'cascade_save' => true, 'cascade_delete' => false, ) ); }
public function action_delete($id = null) { if ($users = Model_Users::find($id)) { $users->delete(); Session::set_flash('notice', 'Deleted user #' . $id); } else { Session::set_flash('notice', 'Could not delete user #' . $id); } Response::redirect('users'); }
object(Fuel\Core\Database_Query_Builder_Delete)#13 (9) { ["_table":protected]=> string(11) "sites_users" ["_where":protected]=> array(1) { [0]=> array(1) { ["AND"]=> array(3) { [0]=> string(7) "user_id" [1]=> string(1) "=" [2]=> string(1) "6" } } } ["_order_by":protected]=> array(0) { } ["_limit":protected]=> NULL ["_type":protected]=> int(4) ["_lifetime":protected]=> NULL ["_sql":protected]=> string(0) "" ["_parameters":protected]=> array(0) { } ["_as_object":protected]=> bool(false) }
It looks like you're new here. If you want to get involved, click one of these buttons!