convert to id

@param id string id
@return MODEL_ID
@throws NotFoundException response status 404
495269
@SuppressWarnings("unchecked")
    protected final MODEL_ID tryConvertId(Object id) {
        try {
            return (MODEL_ID) getModelBeanDescriptor().convertId(id);
        } catch (Exception e) {
            throw new UnprocessableEntityException(Messages.get("info.query.id.unprocessable.entity"), e);
        }
    }
983670
public function find($id)
    {
        if (!$this->modelClass) {
            throw new ModelNotFoundException('setModelClass');
        }

        return $this->manager->getRepository($this->modelClass)->find($id);
    }
239935
public T byId(Object id) {
        this.beforeCheck();
        this.where(primaryKeyColumn, id);

        String sql = this.buildSelectSQL(false);

        T model = this.queryOne(modelClass, sql, paramValues);

        ifNotNullThen(model, () -> this.setJoin(Collections.singletonList(model)));

        return model;
    }
1043769
protected function findModel($id)
    {
        if (($model = Rubric::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(Module::t('core', 'The requested model does not exist.'));
        }
    }
387626
public E getById(String id) {
        if (id == null) {
            for (E element : this) {
                if (element != null && element.getId() == null) {
                    return element;
                }
            }
        } else {
            for (E element : this) {
                if (element != null && id.equals(element.getId())) {
                    return element;
                }
            }
        }
        return null;
    }
1041000
public static String getCustomID(String id) {
        int[] fields = new int[4];
        if (parseCustomID(id, fields)) {
            return formatCustomID(fields[1], fields[2], fields[3], fields[0] < 0);
        }
        return null;
    }
1137522
public function setId($id = null)
    {
        if ($id == null) {
            $this->id = mt_rand(0, 255);
        } else {
            $this->id = (int)$id;
        }

        return $this;
    }
818733
public function revive(int $id): PodiumResponse
    {
        $postArchiver = $this->getArchiver($id);

        if ($postArchiver === null) {
            throw new ModelNotFoundException('Post of given ID can not be found.');
        }

        return $postArchiver->revive();
    }
149265
public static function create($id = null)
    {
        $obj = new self();

        $obj->id = ($id) ? (string) $id : Uuid::uuid4()->toString();

        return $obj;
    }
765905
static public function createObjectID($id=null)
    {
        if ($id === null) {
            return new \MongoDB\BSON\ObjectId;
        }

        try {
            return new \MongoDB\BSON\ObjectId($id);
        } catch(\MongoDB\Driver\Exception\InvalidArgumentException $e) {
        }

        throw new Exception('Invalid ObjectId');
    }
90942
public function id($id = null)
    {
        if ($id) {
            if (!$this->isValidId($id)) {
                throw new \InvalidArgumentException('$id may contain only [a-zA-Z0-9-_]');
            }
            if ($this->id) {
                throw new Exception('Cannot set id while session is active');
            }
            $this->requestedId = $id;
        }
        return $this->id;
    }
270852
public function get($id)
    {
        if (! $this->has($id)) {
            throw new NotFoundException(
                sprintf('Identifier %s is not defined in container', $id)
            );
        }

        $entry = $this->container[$id]->instance();

        if (is_callable($entry)) {
            return $entry($this);
        }

        return $entry;
    }
9999
protected Person getPersonById(String id) {
		Person person = null;
		try {
			Long personId = Long.valueOf(id);
			if (logger.isDebugEnabled()) {
				logger.debug("Retrieving Person with id=[{}]", personId);
			}
			person = entityManager.find(Person.class, personId);
		} catch (NumberFormatException e) {
			if (logger.isWarnEnabled()) {
				logger.warn("Invalid number format: {}", id);
			}
		}
		if (person == null) {
			throw new IllegalArgumentException();
		}
		return person;
	}
1162370
public function convertId($id, $format = null)
    {
        $this->convertToAll($id);

        switch ($format) {
            case 'ID32':
            case 'id32':
            case 32:
                return $this->formatted->{self::$ID32};
            case 'ID64':
            case 'id64':
            case 64:
                return $this->formatted->{self::$ID64};
            case 'ID3':
            case 'id3':
            case 3:
                return $this->formatted->{self::$ID3};
            default:
                return $this->formatted;
        }
    }
137962
public function getOrFail($id)
    {

        if ($model = $this->get($id)) {
            return $model;
        }

        $typeName = Type::of($this->prototype());

        throw new ResourceNotFoundException("$typeName #$id not found.");
    }
1137270
public function update($id, $data)
    {
        $modelName = $this->modelFullName;
        if($this->validate($data, $modelName::$rules))
        {
            $model = $modelName::find($id);
            if(!$model) throw new NotFoundException('There is no Resource with id = ' . $id . ' !');
            $model->update($data);
            return $model;
        }
    }
171579
public function setId($id)
    {
        if (!empty($id) && is_string($id) && ctype_print($id)) {
            $this->id = trim($id);
        }

        return $this;
    }