I have two entities. Category and Eshop. I need get all categories by Eshop entity. The code working. Returned array contain table data, but returned array is too big, so I don't know how extract what I want. Method look. The method looks like this:
/**
* @param Eshop $eshop
* @return Category[]
*/
private function getCategoriesFromDatabaseByEshop(Eshop $eshop)
{
return $eshop->getCategories();
}
When I was inspired by the example here, so that I get the following output:
Code
print_r(\Doctrine\Common\Util\Debug::dump($this->getCategoriesFromDatabaseByEshop($eshop)));
Output
[84]=> object(stdClass)#2799 (12) {
["__CLASS__"]=> string(25) "AppBundle\Entity\Category"
["id"]=> int(85)
["name"]=> string(42) "/akcni-nabidky/akcni-nabidky-produkty/vina"
["parentCategory"]=> NULL
["link"]=> string(42) "/akcni-nabidky/akcni-nabidky-produkty/vina"
["createdAt"]=> string(8) "DateTime"
["lastCheckAt"]=> string(8) "DateTime"
["lastHttpStatusCode"]=> int(200)
["active"]=> bool(true)
["eshop"]=> string(22) "AppBundle\Entity\Eshop"
["products"]=> string(8) "Array(0)"
["leaf"]=> bool(false)
}
I need extract ["name"]
?
Thank you very much for any advice.