I want to know, what is the correct way to implement CRUD operations in Magento 2?
because I found a lot of examples but they use deprecated methods.
I created a table ('quote reserved item') with some. id (PK) quote_id FK on entity_id form quote table. product_id.
I want to save update and read information from this table. So i created the following classes :
Api\ReservedItemRepositoryInterface.php that has a method save(); Api\Data\ReservedItemInterface.php
Model\ResourceModel\ReservedItem\Collection.php Model\ResourceModel\ReservedItem.php Model\ReservedItem.php Model\ReservedItemRepository.php here i want to implement that save method without using deprecated methods. If that is not possible which method should i use.
class ReservedItemRepository implements ReservedItemRepositoryInterface{
protected $collectionFactory; protected $reservedItemFactory; public function __construct( CollectionFactory $collectionFactory, ReservedItemFactory $reservedItemFactory ) { $this->collectionFactory = $collectionFactory; $this->reservedItemFactory = $reservedItemFactory; } /** * @param ReservedItemInterface $reservedItem * @return ReservedItemInterface */ public function save(ReservedItemInterface $reservedItem, $saveOptions = false) { }