There is one more work around, you can add a property to your object, which will receive all the entry entries related to this, and in the getter return __toString() related functions, I had the same script for orders, and I also need a list of if products related to order, so I did it this way by creating exportProducts in orders entity
protected $exportProducts; public function getExportProducts() { $exportProducts = array(); $i = 1; foreach ($this->getItems() as $key => $val) { $exportProducts[] = $i . ') Name:' . $val->getProduct()->__toString()() . ' Size:' . $val->getProductsize() . ...; $i++; } return $this->exportProducts = join(' , ', $exportProducts); }
And for the admin class, I defined the exportProducts property in getExportFields() as
public function getExportFields(){ return array( 'Products'=>'exportProducts', ....
In the loaded csv, each order contains a list of products in the Products cell as a comma separated list
source share