public isRootEntry ( mixed $id ) : boolean | ||
$id | mixed | |
return | boolean |
public function isRootEntry($id)
{
/** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
$query = $this->dbHandler->createSelectQuery();
$query->select($this->dbHandler->quoteColumn('text'), $this->dbHandler->quoteColumn('parent'))->from($this->dbHandler->quoteTable($this->table))->where($query->expr->eq($this->dbHandler->quoteColumn('id'), $query->bindValue($id, null, \PDO::PARAM_INT)));
$statement = $query->prepare();
$statement->execute();
$row = $statement->fetch(\PDO::FETCH_ASSOC);
return strlen($row['text']) == 0 && $row['parent'] == 0;
}