Reputation: 1301
i have the following code:
$countries = $em->getRepository("country")->findAll();
$array = array();
$count = 0;
foreach($countries as $country){
if(is_object($country)){
if($country->getCompaniesCount() > 0)
$array[$count] = $country;
$count++;
}
}
And the "getCompaniesCount" function which is called looks like this:
public function getCompaniesCount(){
return $this->_comapanies->count();
}
but it produces an error which i cannot understand.
There ARE countries in "country", and there ARE "companies" which are related to countries. so country and company is a ManyToMany-Relationship. And the attribute "_companies" in "country" is initialised as an ArrayCollection to hold the companies.
But everytime i run this code i get the following error:
Catchable fatal error:
Argument 1 passed to Doctrine\ORM\Mapping\DefaultQuoteStrategy::getJoinTableName() must be an array, null given,
called in /usr/share/pear/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 965
and defined in /usr/share/pear/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php on line 86
does anyone have an idea why?
thanks
Upvotes: 0
Views: 10767
Reputation: 1301
ohhh noooo. i feel so dumb. just a wrong foreign-key-name -.-.
solved.
Upvotes: 0