Find the index of an entity with a defined id.

@param  mixed        $id The entity id to look for.
@return integer|null     The entity's index number in the collection or `null` if not found.
492458
public function indexOfId($id)
    {
        $id = (string) $id;
        foreach ($this as $key => $entity) {
            if (!$entity instanceof Model) {
                throw new Exception('Error, `indexOfId()` is only available on models.');
            }
            if ($id === (string) $entity->id()) {
                return $key;
            }
        }
    }
1219724
public function findOrFail(int $id)
    {
        $response = $this->model->with($this->with)->findOrFail($id);
        $this->with = [];
        return $response;
    }
330693
public function findChild($id)
    {
        foreach ($this->getChildren() as $child) {
            $result = $this->findChildInNode($child, $id);

            if ($result) {
                return $result;
            }
        }

        return null;
    }
1307685
public function getById($id): ?AbstractEntity
    {
        $entity = $this->getRepository()->findById($id);

        if ($entity instanceof AbstractEntity) {
            $this->prepareEntityForGet($entity);
        }

        return $entity;
    }
545187
public function index($id = null)
    {
        // Support for resource/identifier/resource
        if ($id != null) {
            return $this->getById($id);
        }

        //parse the rquest
        $parse = new QueryParser($this->request->getQuery());
        $params = $parse->request();

        $results = $this->model->find($params);

        if ($this->request->hasQuery('relationships')) {
            $relationships = $this->request->getQuery('relationships', 'string');

            $results = QueryParser::parseRelationShips($relationships, $results);
        }

        //this means the want the response in a vuejs format
        if ($this->request->hasQuery('format')) {
            unset($params['limit'], $params['offset']);

            $results = [
                'data' => $results,
                'limit' => $this->request->getQuery('limit', 'int'),
                'page' => $this->request->getQuery('page', 'int'),
                'total_pages' => ceil($this->model->count($params) / $this->request->getQuery('limit', 'int')),
            ];
        }

        return $this->response($results);
    }
242470
public function getChildById($id)
	{
		if(isset($this->id2index[$id]))
			return $this->children[$this->id2index[$id]];
		return null;
	}
706838
public static function find_by_id($id)
	{
		$row = self::oneOrNew($id);

		if (!$row->get('id'))
		{
			return false;
		}

		return $row;
	}
303286
protected function get($id = null)
    {
        $this->filter();

        if ($this->eagerLoad) {
            $this->model = $this->model->with($this->eagerLoad);
        }

        if ($id) {
            return $this->model->where('id', $id)->firstOrFail();
        }

        return $this->model->get();
    }
583300
public function get($id)
    {
        $resolved = $this->getResolved($id);

        return $resolved ? $resolved->getInnerExtension() : null;
    }
1273171
public function getParameterByID($id)
    {
        $param = current(array_filter($this->params, function (Param $param) use ($id) {
            return ($param->id === $id);
        }));

        return ($param) ? $param : null;
    }
1055761
private function get($id) {
        if ($id === 0) {
            $this->response->setError();
            return false;
        }
        $entity = $this->entityManager->find(\Emeric0101\PHPAngular\Config::PHPANGULAR_BUNDLE ."\\Entity\\" . $this->name, $id);
        if ($entity === null) {
            $this->response->setError("NOT_FOUND");
            return false;
        }

        $this->response->setResponse($this->name, $entity);
        return true;
    }
206610
public function get_from_id(int $id) {
        $records = $this->get_from_ids([$id]);
        return count($records) ? array_shift($records) : null;
    }
391088
public function loadOneById($id)
    {
        $stmt = $this->getMatchOneByIdCypher($id);
        $result = $this->_em->getDatabaseDriver()->run($stmt->text(), $stmt->parameters());
        $hydrator = $this->_em->getEntityHydrator($this->_className);
        $entities = $hydrator->hydrateAll($result);

        return count($entities) === 1 ? $entities[0] : null;
    }
204955
public function findById($id) {
    $dataConnection = $this->app->getDataConnection($this->connection);
    $result = $dataConnection->findOneByField($this->idColumn, $dataConnection->convertToNativeId($id),
      $this->table, $this->readFields);
    if ($result == NULL) {
      return FALSE;
    }
    $this->load($result);
    return TRUE;
  }
303117
public function find($id = null)
    {
        // ID has to be defined
        if (!isset($id)) {
            throw new \InvalidArgumentException('Undefined ID to find', 400);
        }

        // Return the first found record using the primary key for the where
        $result = $this->where($this->primaryKey, $id, '=', $this->table)->limit(1)->first();

        // Return the first matching record
        return $result;
    }
685349
public function findById($id)
    {
        $post = get_post($id);
        if (!is_null($post)) {
            return self::getEntity($post);
        }
    }
556167
public function findById($id)
    {
        if (!isset($id) || is_null($id)) {
            return null;
        }
        $builder = $this->em->createQueryBuilder();

        $tag = $builder
            ->select('t')
            ->from($this->tagClass, 't')

            ->where($builder->expr()->eq('t.id', $id))

            ->getQuery()
            ->getOneOrNullResult();

        return $tag;
    }