public function deleteLinkTable($record) { $linkTable = $this->linkTable(); $property = $this->target(); $associated = $record->{$property}; $targetForeignKey = $this->createForeignKey($this->target()); if (empty($associated)) { return true; } foreach ($associated as $obj) { $success = BaseRecord::deleteAll($linkTable, $obj->primaryKey(), '=', $obj->id()); if (!$success) { return false; } } return true; }
public function testDeleteAll() { $record = Mock::create(); $this->assertEquals(true, BaseRecord::deleteAll(Mock::tableName(), 'id', '=', $record->id)); }