public function getLastValidBlockItem(Block $block)
    {
        $dbHandler = $this->getConnection();
        $q = $dbHandler->createSelectQuery();
        $q
            ->select('object_id, node_id, priority, ts_publication, ts_visible, rotation_until, moved_to')
            ->from($dbHandler->quoteTable('ezm_pool'))
            ->where(
                $q->expr->eq('block_id', $q->bindValue($block->id)),
                $q->expr->gt('ts_visible', $q->bindValue(0, null, PDO::PARAM_INT)),
                $q->expr->eq('ts_hidden', $q->bindValue(0, null, PDO::PARAM_INT))
            )
            ->orderBy('ts_visible', SelectQuery::DESC)
            ->limit(1);

        $stmt = $q->prepare();
        $stmt->execute();
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        if (empty($rows)) {
            return;
        }

        return $this->buildBlockItem(
            $rows[0] + array(
                'block_id' => $block->id,
                'ts_hidden' => 0,
            )
        );
    }
public function getLastValidBlockItem(Block $block)
    {
        $dbHandler = $this->getConnection();
        $q = $dbHandler->createSelectQuery();
        $q
            ->select('object_id, node_id, priority, ts_publication, ts_visible, rotation_until, moved_to')
            ->from($dbHandler->quoteTable('ezm_pool'))
            ->where(
                $q->expr->eq('block_id', $q->bindValue($block->id)),
                $q->expr->gt('ts_visible', $q->bindValue(0, null, PDO::PARAM_INT)),
                $q->expr->eq('ts_hidden', $q->bindValue(0, null, PDO::PARAM_INT))
            )
            ->orderBy('ts_visible', SelectQuery::DESC)
            ->limit(1);

        $stmt = $q->prepare();
        $stmt->execute();
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        if (empty($rows)) {
            return;
        }

        return $this->buildBlockItem(
            $rows[0] + array(
                'block_id' => $block->id,
                'ts_hidden' => 0,
            )
        );
    }
public function getLastValidBlockItem ( Block $ block ) { $ dbHandler = $ this -> getConnection ( ) ; $ q = $ dbHandler -> createSelectQuery ( ) ; $ q -> select ( 'object_id, node_id, priority, ts_publication, ts_visible, rotation_until, moved_to' ) -> from ( $ dbHandler -> quoteTable ( 'ezm_pool' ) ) -> where ( $ q -> expr -> eq ( 'block_id' , $ q -> bindValue ( $ block -> id ) ) , $ q -> expr -> gt ( 'ts_visible' , $ q -> bindValue ( 0 , null , PDO :: PARAM_INT ) ) , $ q -> expr -> eq ( 'ts_hidden' , $ q -> bindValue ( 0 , null , PDO :: PARAM_INT ) ) ) -> orderBy ( 'ts_visible' , SelectQuery :: DESC ) -> limit ( 1 ) ; $ stmt = $ q -> prepare ( ) ; $ stmt -> execute ( ) ; $ rows = $ stmt -> fetchAll ( PDO :: FETCH_ASSOC ) ; if ( empty ( $ rows ) ) { return ; } return $ this -> buildBlockItem ( $ rows [ 0 ] + array ( 'block_id' => $ block -> id , 'ts_hidden' => 0 , ) ) ; }
Returns the block item having a highest visible date, for given block.
Will return null if no block item is registered for block.

@param \eZ\Publish\Core\FieldType\Page\Parts\Block $block

@return \eZ\Publish\Core\FieldType\Page\Parts\Item|null
Returns the block item having a highest visible date for given block . Will return null if no block item is registered for block .