Witam,

Mam 3 tabele jak poniżej:

games:
    id:          ~
    title:       varchar(255)
  categories:
    id:          ~
    title:       varchar(255)
  catgame:
    id:          ~
    categories_id: ~
    games_id: ~

i kod:

$pager = new sfPropelPager('Games', 5);
        $c = new Criteria();
        $c->addDescendingOrderByColumn(GamesPeer::CREATED_AT);
        $c->add(CatgamePeer::CATEGORIES_ID, $this->getRequestParameter('id',1));
        $c->addJoin(GamesPeer::ID,CatgamePeer::GAMES_ID, 'LEFT JOIN');
        $pager->setCriteria($c);
        $pager->setPage($this->getRequestParameter('page', 1));
        $pager->setPeerMethod('doSelect');
        $pager->init();
        $this->games_pager = $pager;

                foreach($this->games_pager->getResults() as $games) {
                 $catRefs = $games->getCatgamesJoinCategories();
                 $cat = null;
                  foreach($catRefs as $ref) {
                            $cat[] = $ref->getCategories(); 
                   }
                 $games->sth = $cat;
                    }

        foreach($this->games_pager->getResults() as $games) {
                             print_r($games->sth);
                    }

Niestety taki sposób dodania kolejnego obiektu do games nie przechodzi bo w drugim foreach mam:

Notice: Undefined property: Games::$sth

Chodzi mi o to iż chcę pobrać 5 gier z danej kategorie i dla każdej z nich chcę mieć przypisane wszystkie kategorie do których należy? Jak mogę to zrobić?