예제 #1
0
 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;
 }
예제 #2
0
 public function testDeleteAll()
 {
     $record = Mock::create();
     $this->assertEquals(true, BaseRecord::deleteAll(Mock::tableName(), 'id', '=', $record->id));
 }