What is the difference between these two objects in magento2? (Factory and Repository) I have seen that they have almost the same methods. What proper use does one have?
1 Answer
Different between factory and repository
Factory definition:
Factories are service classes that instantiate non-injectable classes, that is, models that represent a database entity. They create a layer of abstraction between the ObjectManager and business code.
Definition of repository:
A repository object is responsible for reading and writing your object information to an object store
See more details at When Should We Use a Repository and Factory in Magento 2?