Listing 30.20. Metoda klasy Autor odpowiedzialna za zliczanie artykułów pojedynczego autora
public function przeliczArtykuly()
{
    $ahas = $this->getArtykulHasAutorsJoinArtykul();
    $this->setLiczbaartykulow(count($ahas));
    $liczba_stron = 0;
    foreach ($ahas as $aha) {
        $liczba_stron += $aha->getArtykul()->getLiczbastron();
    }
    $this->setLiczbastron($liczba_stron);
    $this->save();
}
