public function getContentIdByBlockId($id) { $dbHandler = $this->getConnection(); $query = $dbHandler->createSelectQuery(); $query->select($dbHandler->quoteColumn('contentobject_id'))->from($dbHandler->quoteTable('ezcontentobject_tree'))->innerJoin($dbHandler->quoteTable('ezm_block'), $query->expr->eq($dbHandler->quoteColumn('node_id', 'ezm_block'), $dbHandler->quoteColumn('node_id', 'ezcontentobject_tree')))->where($query->expr->eq($dbHandler->quoteColumn('id', 'ezm_block'), $query->bindValue($id, null, PDO::PARAM_STR))); $stmt = $query->prepare(); $stmt->execute(); $contentId = $stmt->fetchColumn(); if ($contentId === false) { throw new NotFoundException('Block', $id); } return $contentId; }