Find render-list

@param int|null $id
@return \Menu\Model\Menu\StructureInterface[]
771513
public function findRenderList( $id = null )
    {
        $platform = $this->getDbAdapter()
                         ->getPlatform();

        $columns = $this->getSelectColumns();
        $columns['_depth'] = new Sql\Expression( '(' .
            $this->sql( null )
                 ->select( array( 'parent' => static::$tableName ) )
                 ->columns( array(
                     new Sql\Expression( 'COUNT(*)' )
                 ) )
                 ->where( array(
                     new Sql\Predicate\Expression(
                         $platform->quoteIdentifierChain( array( static::$tableName, 'left' ) ) .
                         ' BETWEEN ' . $platform->quoteIdentifierChain( array( 'parent', 'left' ) ) .
                             ' AND ' . $platform->quoteIdentifierChain( array( 'parent', 'right' ) )
                     ),
                 ) )
                 ->getSqlString( $platform ) .
        ')' );

        $select = $this->select( $columns )
                       ->order( 'left' );

        if ( null !== $id )
        {
            $select->join( array( 'parent' => self::$tableName ),
                           '( ' . self::$tableName . '.left BETWEEN parent.left AND parent.right ) ',
                           array() )
                   ->where( array( 'parent.id' => $id ) );
        }

        /* @var $result \Zend\Db\Adapter\Driver\ResultInterface */

        $return = array();
        $result = $this->sql()
                       ->prepareStatementForSqlObject( $select )
                       ->execute();

        foreach ( $result as $row )
        {
            $depth = (int) $row['_depth'];
            unset( $row['_depth'] );
            $return[] = array( $depth, $this->selected( $row ) );
        }

        return $return;
    }
746669
public function view($id = null) {
        $cmsContent = $this->CmsContent->get($id, [
            'contain' => ['CmsPermission', 'CmsTermRelation']
        ]);
        $this->set('cmsContent', $cmsContent);
        $this->set('_serialize', ['cmsContent']);
    }
902798
public function actionView($id)
    {
        $model = $this->findModel($id);
        $viewPostUrl = $this->getViewPostUrl($model);

        return $this->render('view', [
            'model' => $model,
            'viewPostUrl' => $viewPostUrl,
        ]);
    }
79106
public function find(string $id = null)
    {
        if (null === $id) {
            return null;
        }

        $table = $this->getTable();

        $this->logger->info('model: find row within table {table} with id {id}', ['table' => $table, 'id' => $id]);

        if ($this->storageCache->has($id)) {
            $this->logger->info(
                'model: found row within cache for table {table} with id {id}',
                ['table' => $table, 'id' => $id]
            );

            return $this->fromPersistence($this->storageCache->get($id));
        }

        $qb = $this->connection->createQueryBuilder();
        $qb->select('*')->from($this->getTable())->where($qb->expr()->eq('id', ':id'))->setParameter('id', $id);

        $row = $qb->execute()->fetch(\PDO::FETCH_ASSOC);
        if (false === $row) {
            $this->logger->notice(
                'model: row within table {table} with id {id} not found',
                ['table' => $table, 'id' => $id]
            );

            return null;
        }

        $this->storageCache->set($row['id'], $row);

        return $this->fromPersistence($row);
    }
1370685
public function get($id = null) {
		if (empty($id)) {
			return false;
		}

		$fields = [
			$this->alias . '.id',
			$this->alias . '.value',
		];
		$blockExists = $this->hasField('block');
		if ($blockExists) {
			$fields[] = $this->alias . '.block';
		}
		$conditions = [$this->alias . '.id' => $id];
		$this->recursive = -1;

		return $this->find('first', compact('fields', 'conditions'));
	}
845608
public function actionImages($id)
    {
        $gallery = $this->findModel($id);

        $searchModel  = $this->module->manager->createGalleryImageSearch();
        $dataProvider = $searchModel->search($_GET, $id);

        return $this->render('image/index', [
            'gallery' => $gallery,
            'dataProvider' => $dataProvider,
            'searchModel'  => $searchModel,
        ]);
    }
805124
public function __async_rendermenu($structure_id = 0)
    {
        $sub_menu = m()->view('main/sub_menu')->parentnav_id($structure_id)->nav_id($structure_id)->output();

        return array(
            'status'=>1,
            'sub_menu' => $sub_menu
        );
    }
997155
public function getTree($id = null) {
        $parent = $this->getConfig('parentField');
        $left = $this->getConfig('leftField');
        $right = $this->getConfig('rightField');

        $query = $this->getRepository()->select()->orderBy($left, 'asc');

        if ($id) {
            if ($parentNode = $this->getNode($id)) {
                $query->where($left, 'between', [$parentNode[$left], $parentNode[$right]]);
            } else {
                return [];
            }
        }

        $nodes = $query->all();

        if ($nodes->isEmpty()) {
            return [];
        }

        $map = [];
        $stack = [];
        $pk = $this->getRepository()->getPrimaryKey();

        foreach ($nodes as $node) {
            if ($node[$parent] && $node[$pk] != $id) {
                $map[$node[$parent]][] = $node;
            } else {
                $stack[] = $node;
            }
        }

        $results = $this->mapTree($stack, $map);

        if ($id) {
            return $results[0];
        }

        return $results;
    }
4502
public function actionView(int $id)
    {
        $model = $this->findModel($id);

        return $this->render('view', [
            'model' => $model,
            'usernameField' => $this->usernameField,
        ]);
    }
1363061
public function view($id = null) {
        $task = $this->Tasks->get($id, [
            'contain' => ['Roles']
        ]);
        $this->set('task', $task);
        $this->set('_serialize', ['task']);
    }
497113
protected static function doSearch($id = null)
    {
        $model = self::createModelInstance();
        $tableName = $model->getTableName($model->className);

        return $id ? self::selectOne($model, $tableName, $id) : self::selectAll($model, $tableName);
    }
892257
public function actionView($id)
    {
        $model = $this->findModel($id);
        return $this->render('view', [
            'model' => $model,
            'idField' => $this->idField,
            'usernameField' => $this->usernameField,
            'fullNameField' => $this->fullNameField,
        ]);
    }
1321061
public function actionView($id)
    {
        $this->layout = static::MAIN_LAYOUT;
        return $this->render('view', [
            'model' => $this->findModel($id),
        ]);
    }
410051
public function view($id = null)
    {
        $role = $this->Roles->get($id, [
            'contain' => []
        ]);
        $this->set('role', $role);

        $this->render(Configure::read('CM.AdminRoleViews.view'));
    }
813155
public static function find($id) { 
        $array = KernelDB::find(static::$model, $id);
        $routeModel = Dir::apiModel(static::$model);
        return self::arrayToModel($routeModel, $array);
    }
1332805
public function getResource(string $id = null): array
    {
        if ($id) {
            if (is_numeric($id)) {
                $filter = array_filter($this->resource, function ($row) use ($id) { return $row['id'] == $id; });
                return (array) array_pop($filter);
            }
            return (array) ($this->resource[$id] ?? []);
        }
        return $this->resource;
    }
1319162
public function actionIndex($id=NULL)
	{
		if ($id !== NULL)
		{
			$category = Categories::model()->findByPk($id);
			if ($category == NULL)
				throw new CHttpException(404, Yii::t('Api.category', 'A category with the id of {{id}} was not found.', array('{{id}}' => $id)));

			return $category->getAPIAttributes(array('parent_id'), array('parent', 'metadata'));
		}

		$model = new Categories('search');
		$model->unsetAttributes();
		
		if(isset($_GET['Categories']))
			$model->attributes = $_GET['Categories'];

		// Modify the pagination variable to use page instead of Categories page
		$dataProvider = $model->search();
		$dataProvider->pagination = array('pageVar' => 'page');

		// Throw a 404 if we exceed the number of available results
		if ($dataProvider->totalItemCount == 0 || ($dataProvider->totalItemCount / ($dataProvider->itemCount * Cii::get($_GET, 'page', 1))) < 1)
			throw new CHttpException(404, Yii::t('Api.category', 'No results found'));

		$response = array();

		foreach ($dataProvider->getData() as $category)
			$response[] = $category->getAPIAttributes(array('parent_id'), array('parent', 'metadata'));

		return $response;
	}