Example #1
0
 /**
  * Delete from a table by criteria
  * 
  *   deleteTable ( $meta , $criteria... );
  * 
  * @return void
  */
 public function deleteTable($meta, ...$args)
 {
     if (!isset($args[0])) {
         throw new \InvalidArgumentException("Cannot delete from table without a condition (pass the string '1=1' if you really meant to do this)");
     }
     $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
     if (!$meta->canDelete) {
         throw new Exception("Meta {$meta->id} prohibits update");
     }
     $query = Query\Criteria::fromParamArgs($args);
     return $this->executeDelete($meta, $query);
 }