Get an entity by its ID

@param $id

@return EntityAbstract

@throws \InvalidArgumentException
966161
public function getById($id)
    {
        if (isset($this->elements[$id])) {
            return $this->elements[$id];
        }

        throw new \InvalidArgumentException(sprintf('Element for id %s does not exist', $id));
    }
507030
public function getById($id)
    {
        $database = DatabaseLayer::getInstance();
        $select = $database->select($this->getTableName(), $this->getTableAlias());
        $select->fields($this->getTableAlias());
        $select->condition($this->getIDField(), $id);
        $results = $select->execute(get_called_class());
        $result = end($results);
        return $result;
    }
1317814
private function doFind($id)
    {
        $id = $this->toIdentity($id);
        $entity = null === $id ? null : $this->em->find($this->class, $id);

        if (null === $entity) {
            throw EntityNotFoundException::createForId($this->class, $id);
        }

        return $entity;
    }
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);
    }
1343134
public function findOrderEntityById($id)
    {
        try {
            return $this->em
                ->getRepository(static::$orderEntityName)
                ->find($id);
        } catch (NoResultException $nre) {
            throw new EntityNotFoundException(static::$orderEntityName, $id);
        }
    }
1253763
public function getById($id)
    {
        $volume = $this->adapter->get(sprintf('%s/volumes/%s?per_page=%d', $this->endpoint, $id, 200));

        $volume = json_decode($volume);

        return new VolumeEntity($volume->volume);
    }
1044458
public function getConversation($id)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        return Conversation::fromResponse($this->call('conversations/' . $id, [], 'get'));
    }
666467
public function getById($id)
    {
        $action = $this->adapter->get(sprintf('%s/actions/%d', $this->endpoint, $id));

        $action = json_decode($action);

        $this->meta = null;

        return new ActionEntity($action->action);
    }
1197770
public function get($id)
    {
        $idName = ucfirst($this->idProperty->getName());
        return $this->__call("getBy$idName", array($id));
    }
1107000
public function getById($id)
    {
        if ($this->id == $id) return $this;

        return $this->children->getById($id);
    }
485110
public function get($entityId)
    {
        $key = $this->getEntityDescriptor()->className();
        $key .= '::'.$entityId;
        $entity = $this->getIdentityMap()->get($key, false);
        if ($entity === false) {
            $entity = $this->load($entityId);
        }
        return $entity;
    }
187800
protected function getType($id)
    {
        $type = $this->attributeTypeRepository->find($id);
        if (!$type) {
            throw new EntityNotFoundException(AttributeType::class, $id);
        }

        return $type;
    }
828353
public function get($id)
    {
        if (!array_key_exists($id,$this->services)) {
            throw new \InvalidArgumentException(sprintf(
                'Service with id "%s" is not registered.',
                $id
            ));
        }

        $value = $this->services[$id];
        if (method_exists($value, '__invoke')) {
            $value = $value($this);
        }

        if (method_exists($value,'setContainer')) {
            $value->setContainer($this);
        }

        return $value;
    }
1243731
public function reverseTransform($id)
    {
        if (null == $id) {
            return null;
        }

        $entity = $this->contentManager->getRepository()->find($id);

        return $entity;
    }
87895
public function getOne($id)
    {
        $result = $this->entity->findFirst($id);
        if ($result->countResults() == 0) {
            // This is bad. Throw a 500. Responses should always be objects.
            throw new HTTPException('Resource not available.', 404, [
                'dev' => 'The resource you requested is not available.',
                'code' => '43758093745021'
            ]);
        } else {
            return $result;
        }
    }
188351
public function get($id)
    {
        foreach ($this->instructions as $instruction) {
            if (!$instruction instanceof Node && !$instruction instanceof Subgraph) {
                continue;
            }

            if ($instruction->getId() == $id) {
                return $instruction;
            }
        }

        throw new \InvalidArgumentException(sprintf('Found no node or graph with id "%s" in "%s".', $id, $this->id));
    }
1331911
public function get($id)
    {
        if (!$this->has($id)) {
            // a class name.
            if (strpos($id, '\\') && class_exists($id)) {
                /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
                $this->set($id, $id);
            } else {
                throw new \InvalidArgumentException("The service '$id' was not found, has not been registered!");
            }
        }

        return $this->getInstance($id);
    }