Menu Close
    Hire us Request quote Reading list Switch to dark mode

    How to load Model by another field in Magento 2

    In this blog I will explain how you can load model by another custom field in Magento 2. Mostly we use addFieldToFilter on collection and getFirstItem or loop over the collection. However we can use the model to load based on some custom column.

    In the below example we have loaded the Student model based on email column.


    Thanks for reading. Feel free to comment if you face any issue.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close