/** * @param Area $area The area object to add. */ protected function doAddArea($area) { $countryArea = new ChildCountryArea(); $countryArea->setArea($area); $this->addCountryArea($countryArea); // set the back reference to this object directly as using provided method either results // in endless loop or in multiple relations if (!$area->getCountries()->contains($this)) { $foreignCollection = $area->getCountries(); $foreignCollection[] = $this; } }