Menu Close
    Start a Project 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.

    . . .

    Comments (2)

    Add Your Comment

  • Hiep Mai
    Thanks for shared!
    • Sanjay Chouhan
      You are most welcome.
  • Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again