As of my observation, core team used the object manager as added
Example flow taken from module-cms
public function __construct(
//.....
\Magento\Framework\ObjectManagerInterface $objectManager
//.....
)
{
$this->_objectManager = $objectManager;
}
Later used
$resultPage = $this->_objectManager->get('Magento\Cms\Helper\Page')->prepareResultPage($this, $pageId);
- Is it recommended to use object manager like this ?
- Why core team not passing this class directly to constructor as a dependency ?
- Is there any specific case/reason to use the object manager like this ?
Can any one provide the detailed answer. Thanks.
Yes some of the answer can be found in the link but my questions/ambiguity not solved yet.