Comment on page
getOrFail
Get an entity using a primary key, if the id is not found this method throws an
EntityNotFound
ExceptionNo casting is necessary on the Id value type as we do this automatically for you.
- This function returns any
Key | Type | Required | Default | Description |
entityName | string | Yes | --- | |
id | any | Yes | --- | |
var account = ormService.getOrFail("Account",1);
var account = ormService.getOrFail("Account",4);
var newAccount = ormService.getOrFail("Account",0);
Last modified 1yr ago