nitcorn :: HttpRequest :: mentity_arg
Lookup first by MEntity::full_name
then by MEntity::name
.
Return null
if the mentity name does not exist or return a conflict.
# Get arg as a MEntity
#
# Lookup first by `MEntity::full_name` then by `MEntity::name`.
# Return `null` if the mentity name does not exist or return a conflict.
private fun mentity_arg(model: Model, key: String): nullable MEntity do
var value = string_arg(key)
if value == null or value.is_empty then return null
var mentity = model.mentity_by_full_name(value)
if mentity != null then return mentity
var mentities = model.mentities_by_name(value)
if mentities.is_empty or mentities.length > 1 then return null
return mentities.first
end
src/doc/commands/commands_http.nit:252,2--266,4