I have 2 ways to fetch a model object:
$orderId = 18;
/** @var \Magento\Sales\Model\Order $firstOrder */
$firstOrder = $this->_orderFactory->create()->load( $orderId);
/** @var \Magento\Sales\Model\ResourceModel\Order\Collection $orderCollection */
$orderCollection = $this->_orderCollectionFactory->create();
$secondOrder = $orderCollection->addFieldToFilter('entity_id', $orderId)->getFirstItem();
/** @var \Magento\Sales\Model\ResourceModel\Order\Collection $orderCollection */
$orderCollection = $this->_orderCollectionFactory->create();
$thirdOrder = $orderCollection->addFilter('entity_id', $orderId)->getFirstItem();
The first one is using load() method of model object.
The 2 last one use collection to fetch and then get the first item of those collections.
I know load() is deprecated, but as I can see Magento 2 core modules use it a lot.
Somebody, please tell me what option is better?
And by the way, what is the diffirent between addFilter() and addFieldToFilter().