Why getData() and toArray() on collection have a different behaviour for EAVs tables such as Product?

by Milind Singh   Last Updated July 12, 2019 15:09 PM - source

 $collection = $this->productCollectionFactory->create();
 $collection->addAttributeToSelect('*');
  • collection->getData() -> returns only a few data (most of the main table until explicitly provided in addAttributeToSelect('my_attr_code').
  • collection->toArray() -> returns complete data.

This behaviour is same on the Flat tables, but why different on EAV table such as product?



Related Questions


Filter products by website using AND

Updated July 14, 2015 13:04 PM




Magento 2, filtering product collection and sorting

Updated March 07, 2018 08:09 AM