protected function countContentRelations($fromId = null, $toId = null) { $query = $this->getDatabaseHandler()->createSelectQuery(); $query->select('count(*)')->from('ezcontentobject_link'); if ($fromId !== null) { $query->where('from_contentobject_id=' . $fromId); } if ($toId !== null) { $query->where('to_contentobject_id=' . $toId); } $statement = $query->prepare(); $statement->execute(); return (int) $statement->fetchColumn(); }