I am building an ajax using webapi. and it instantiates a repository model. How do I load a single row by a field? I need to check if an email already exist in the table.
1 Answer
I think you can load first item as follows from model.
$firstItem = $repositoryObject->create()->getCollection()->getFirstItem();
And if you want field name then as follows.
$firstItemField = $repositoryObject->create()->getCollection()->getFirstItem()->getXxx();