FluentPDO::delete PHP Method

delete() public method

Create DELETE query
public delete ( string $table, string $primaryKey = null ) : DeleteQuery
$table string
$primaryKey string delete only row by primary key
return DeleteQuery
    public function delete($table, $primaryKey = null)
    {
        $query = new DeleteQuery($this, $table);
        if ($primaryKey) {
            $primaryKeyName = $this->getStructure()->getPrimaryKey($table);
            $query = $query->where($primaryKeyName, $primaryKey);
        }
        return $query;
    }

Usage Example

Esempio n. 1
0
 public function delete(Entity $entity)
 {
     $query = $this->queryBuilder->delete($this->getTableName(), $entity->getId());
     try {
         $result = $query->execute();
     } catch (\PDOException $ex) {
         throw new QueryException($ex, $query);
     }
     return $result;
 }
All Usage Examples Of FluentPDO::delete