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.


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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.