public static function objectId($blockId, $id, $context, $pageObject = null)
    {
        if (isset(self::$blocks[$blockId])) {
            $block = self::$blocks[$blockId];
        } else {
            $block = self::find()->select(['class'])->where(['id' => $blockId])->asArray()->one();
            static::$blocks[$blockId] = $block;
        }
        
        if (!$block) {
            return false;
        }

        $class = $block['class'];
        if (!class_exists($class)) {
            return false;
        }

        $object = Yii::createObject([
            'class' => $class,
        ]);

        $object->setEnvOption('id', $id);
        $object->setEnvOption('blockId', $blockId);
        $object->setEnvOption('context', $context);
        $object->setEnvOption('pageObject', $pageObject);

        return $object;
    }
public static function objectId($blockId, $id, $context, $pageObject = null)
    {
        if (isset(self::$blocks[$blockId])) {
            $block = self::$blocks[$blockId];
        } else {
            $block = self::find()->select(['class'])->where(['id' => $blockId])->asArray()->one();
            static::$blocks[$blockId] = $block;
        }
        
        if (!$block) {
            return false;
        }

        $class = $block['class'];
        if (!class_exists($class)) {
            return false;
        }

        $object = Yii::createObject([
            'class' => $class,
        ]);

        $object->setEnvOption('id', $id);
        $object->setEnvOption('blockId', $blockId);
        $object->setEnvOption('context', $context);
        $object->setEnvOption('pageObject', $pageObject);

        return $object;
    }
public static function objectId ( $ blockId , $ id , $ context , $ pageObject = null ) { if ( isset ( self :: $ blocks [ $ blockId ] ) ) { $ block = self :: $ blocks [ $ blockId ] ; } else { $ block = self :: find ( ) -> select ( [ 'class' ] ) -> where ( [ 'id' => $ blockId ] ) -> asArray ( ) -> one ( ) ; static :: $ blocks [ $ blockId ] = $ block ; } if ( ! $ block ) { return false ; } $ class = $ block [ 'class' ] ; if ( ! class_exists ( $ class ) ) { return false ; } $ object = Yii :: createObject ( [ 'class' => $ class , ] ) ; $ object -> setEnvOption ( 'id' , $ id ) ; $ object -> setEnvOption ( 'blockId' , $ blockId ) ; $ object -> setEnvOption ( 'context' , $ context ) ; $ object -> setEnvOption ( 'pageObject' , $ pageObject ) ; return $ object ; }
Get the block object from the database with context informations.

@param integer $blockId
@param integer $id
@param mixed $context
@param object $pageObject
@return \luya\cms\base\BlockInterface
@deprecated 1.1.0 use createObject() or getObject() instead!
Get the block object from the database with context informations .