Получим информацию по одному файлу

@param integer $id ИД файла

@return ORM|array

@version 08.01.2019
@author  Дмитрий Щербаков <atomcms@ya.ru>
507926
public function getOneORM($id)
    {
        $info = ORM::for_table('files')
            ->where_null('deleted_at')
            ->find_one($id);
        if (is_object($info)) {
            return $info;
        } else {
            return Response::error404('Файл не найден');
        }
    }
1330548
public function actionCreateImage($id)
    {
        $gallery = $this->findModel($id);

        $model = $this->module->manager->createGalleryImage(['scenario' => 'create']);

        $model->loadDefaultValues();

        if ($model->load(\Yii::$app->request->post())) {
            $model->gallery_id = $gallery->id;
            if($model->create()) {
                \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been created'));
                return $this->redirect(['images', 'id' => $id]);
            }
        }

        return $this->render('image/create', [
            'gallery' => $gallery,
            'model' => $model
        ]);
    }
837929
public function getField($id)
    {
        if (!isset($this->_fields[$id])) {
            $this->$id = ''; // @see SearchIndexDocument::__set()
        }
        return $this->_fields[$id];
    }
56626
public function actionView($id)
    {
        $model = $this->findModel($id);
        $modelsI18n = $model::prepareI18nModels($model);

        if ($model->pageSize > 0) {
            $model->orderBy = $model->defaultOrderBy;
            $model->page = $model->calcPage();//echo __METHOD__.": calcPage(id={$id},pageSize={$model->pageSize})={$model->page}<br>";exit;
        }

        return $this->render('view', [
            'model' => $model,
            'modelsI18n' => $modelsI18n,
        ]);
    }
374154
public function byOrganizationWithYear($id)
  {
    // return $this->Period->where('organization_id', '=', $id)->with('year')->get(); -> Evitar los with

    $periods = $this->DB->connection($this->databaseConnectionName)
      ->table('ACCT_Period As p')
      ->join('ACCT_Fiscal_Year AS f', 'f.id', '=', 'p.fiscal_year_id')
      ->where('p.organization_id', '=', $id)
      ->get(array('p.id', 'p.month', 'f.year'));

    return new Collection($periods);
  }
419104
public function remove($id)
    {
        /** @var \SymfonyId\AdminBundle\Configuration\ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_DELETE);

        /** @var ModelInterface $model */
        $model = $this->findOr404Error($id);

        $reflectionModel = new \ReflectionClass($crudConfigurator->getCrud()->getModelClass());
        /** @var \SymfonyId\AdminBundle\Annotation\Driver $driver */
        $driver = $this->get('symfonyid.admin.manager.driver_finder')->findDriverForClass($reflectionModel->getName());
        /** @var \SymfonyId\AdminBundle\Crud\CrudOperationHandler $crudOperationHandler */
        $crudOperationHandler = $this->get('symfonyid.admin.crud.crud_operation_handler');

        $translator = $this->get('translator');
        $translationDomain = $this->getParameter('symfonyid.admin.translation_domain');

        if (false === $crudOperationHandler->remove($driver, $model)) {
            return $this->handleView(new View(array(
                'status' => false,
                'message' => $translator->trans($crudOperationHandler->getErrorMessage(), array(), $translationDomain),
            )));
        }

        return $this->handleView(new View(array(
            'status' => true,
            'message' => $translator->trans('message.data_deleted', array('%id%' => $id), $translationDomain),
        )));
    }
1177191
public function index($id)
    {
        $this->authorize('readList', File::class);
        $input  = $this->validator->validate('list');
        $params = $this->processor->process($input)->getProcessedFields();
        $file   = $this->repository->getById($id);
        if (!empty($file)) {
            $results = $this->repository->getTranslations(
                $file,
                $params['filter'],
                $params['orderBy'],
                $params['page'],
                $params['perPage']
            );
            return $this->respondWithSuccess($results, new FileTranslationTransformer);
        } else {
            return $this->respondNotFound();
        }
    }
1210217
public function show($id)
    {
        $upload = $this->client->get(
            sprintf('buckets/%d/uploads/%d.json', $this->bucket, $id)
        );

        return new Upload($this->response($upload));
    }
1010437
public function getFileById($id)
    {
        if ($id instanceof \MongoId) {
            $file = $this->getMongoCollection()->findOne(array('_id' => $id));
        } else {
            try {
                $file = $this->getMongoCollection()->findOne(array('_id' => new \MongoId($id)));
            } catch (\MongoException $e) {
                $file = $this->getMongoCollection()->findOne(array('_id' => $id));
            }
        }
        
        if (!$file) {
            return null;
        }
        
        $fileClassName = $this->getFileClassName($file);
        return new $fileClassName($this, $file);
    }
1157404
public function Form( $id = '' ) {
		if ( $id == '' ) {
			$url = $this->url->linkTo( 'index.php/save' );
		} else {
			$url = $this->url->linkTo( 'index.php/update/' . $id );
		}

		return $this->view( 'form', array( 'id' => $id, 'url' => $url ) );
	}
692805
public function index($id)
    {
        $this->authorize('readList', Content::class);
        $input   = $this->validator->validate('list');
        $params  = $this->processor->process($input)->getProcessedFields();
        $content = $this->repository->getById($id);
        if (!empty($content)) {
            $results = $this->repository->getTranslations(
                $content,
                $params['filter'],
                $params['orderBy'],
                $params['page'],
                $params['perPage']
            );
            return $this->respondWithSuccess($results, new ContentTranslationTransformer);
        } else {
            return $this->respondNotFound();
        }
    }
322003
public function findById($id)
    {
        $entity = $this->getEntityManager()->getRepository($this->entityClass);
        return $entity->find($id);
    }
302802
public function view($id)
    {
        $this->builder->setMode(Builder::MODE_VIEW);
        $this->builder->setResourceId($id);

        $this->setFieldValue($id);

        return $this;
    }
143661
public function edit($id)
    {
        $field = $this->fields->findById($id);
        $fieldTypes = $this->fields->getFieldTypes();

        if (! $field) {
            return $this->handleError(trans('soda::errors.not-found', ['object' => trans('soda::terminology.field')]));
        }

        app('soda.interface')->setHeading($field->name);
        app('soda.interface')->breadcrumbs()->addLink(route('soda.fields.index'), ucwords(trans('soda::terminology.field_plural')));

        return soda_cms_view('data.fields.view', compact('field', 'fieldTypes'));
    }
327176
public function getOneById($id)
    {
        $id = (string)$id;

        $fields = implode(', ', $this->fields);
        $sql = 'SELECT ' . $fields . ' FROM ' . $this->table . ' WHERE ' . $this->table . '.id = :id';
        $query = $this->pdo->prepare($sql);
        $query->bindParam(':id', $id);
        $query->execute();

        return $query->fetch(PDO::FETCH_ASSOC);
    }
692548
public function indexOfId($id)
    {
        $collection = $this->_parent->{$this->_through};

        foreach ($collection as $key => $entity) {
            if (!($entity instanceof Model)) {
                throw new ORMException('Error, `indexOfId()` is only available on models.');
            }
            if ($entity[$this->_using]->id() === $id) {
                return $key;
            }
        }
        return -1;
    }
395442
public function getDocument(string $id): Document
    {
        if (isset($this->documents[$id])) {
            return $this->documents[$id];
        }

        if ($this->hasDocument($id)) {
            $path = $this->getDocumentPath($id);
            $source = $this->filesystem->read($path);

            if (is_string($source)) {
                return $this->documents[$id] = new Document($this->format->parse($source));
            }

            throw new RuntimeException(sprintf('Format error in the file "%s"', $path));
        }

        throw new RuntimeException(sprintf('File "%s" not found', $id));
    }