Hi i'm relatively new to Magento2 development and it has really been difficult to find straight answers to programmatical problems.
For instance; a simple: How to i retrieve an sales_order record from the database so that i can read and update all of it's fields in the database.
- Some people say use the ObjectManager directly.
- Some people say use the ObjectManager but through DI
- Some people say don't do that, use a OrderRepository
- Some people say yes, do that last one but do it with a OrderRepositoryInterface and do it directly
- Some people say yes, do that last one but do it with a OrderRepositoryInterface and use DI
- Some people give examples what to do not, but fail to mention what to do.
- Some people give examples that don't work.
- etc etc etc
So, if i want to retrieve an Order in the Sales module and i want to be able to update and read all fields in the databases table what is the correct official and preferred way to do that in Magento2?
Where can i find examples, and where can i find the logic behind this. I just bought 4 magento2 developer books, and all are quite useless in this aspect.