Пример #1
0
 public function processDelete(DatabaseLayer\Delete $thing)
 {
     // SELECTORS
     if (count($thing->getTables()) > 1) {
         throw new Exception("Active Record Cannot delete from more than one table at a time!");
     }
     $tables = $thing->getTables();
     $table = end($tables);
     $selector = "DELETE FROM {$table->getName()} ";
     $conditions = $this->processConditions($thing);
     $query = "{$selector}\n{$conditions}";
     $this->query($query, $thing->getModel());
     return true;
 }
 /**
  * @expectedException \Thru\ActiveRecord\DatabaseLayer\Exception
  * @expectedExceptionMessage Active Record Cannot delete from more than one table at a time!
  */
 public function testDeleteFromTwoTablesFails()
 {
     $delete = new DatabaseLayer\Delete("test_models");
     $delete->setTables(array("tm" => new DatabaseLayer\Table("test_models"), "tmb" => new DatabaseLayer\Table("test_model_bad")));
     $delete->execute();
 }