예제 #1
0
 /**
  * Deletes row. Primary key value must be set before this function is called
  */
 public function delete()
 {
     if ($this->isPrimaryKeyEmpty()) {
         throw new Gpf_Exception("Could not delete Row. Primary key values are empty");
     }
     foreach ($this->table->getDeleteConstraints() as $deleteConstraint) {
         $deleteConstraint->execute($this);
     }
     $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
     $deleteBuilder->from->add($this->table->name());
     $deleteBuilder->where = $this->getPrimaryWhereClause();
     $deleteBuilder->deleteOne();
 }