public function getMainCategory() { foreach ($this->getProductCategories() as $productCategory) { if ($productCategory->getMain()) { return $productCategory->getCategory(); } } }