eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::countLocationsByContentId PHP Method

countLocationsByContentId() public method

Returns how many locations given content object identified by $contentId has.
public countLocationsByContentId ( integer $contentId ) : integer
$contentId integer
return integer
    public function countLocationsByContentId($contentId)
    {
        $q = $this->handler->createSelectQuery();
        $q->select($q->alias($q->expr->count('*'), 'count'))->from($this->handler->quoteTable('ezcontentobject_tree'))->where($q->expr->eq($this->handler->quoteColumn('contentobject_id'), $q->bindValue($contentId, null, \PDO::PARAM_INT)));
        $stmt = $q->prepare();
        $stmt->execute();
        $res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
        return (int) $res[0]['count'];
    }