Doctrine2 ArrayCollection Count () PHPPhp

PHP-Programmierer chatten hier
Anonymous
 Doctrine2 ArrayCollection Count () PHP

Post by Anonymous »

Ich habe den folgenden Code: < /p>

$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++;
}
}
< /code>

Und die Funktion "getCompaniesCount", die als folgt bezeichnet wird public function getCompaniesCount(){
return $this->_comapanies->count();
}
< /code>

, aber es erzeugt einen Fehler, den ich nicht verstehen kann. Und das Attribut "_companies" in "Country" wird als ArrayCollection initialisiert, um die Unternehmen zu halten.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
< /code>

Hat jemand eine Idee, warum? < /p>

Danke < /P.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post