followed album tutorial but it is leaving me with questions

For programming and general questions on Zend Framework

followed album tutorial but it is leaving me with questions

Postby kinggoddard on Sun Jan 06, 2013 8:54 am

I started the album tutorial and it was great. A nice start, but I am really confused on how I should go about loading different models based on the request.

What if 1 module does multiple things in different tables?

For example this gets the album table read correct? What if I want to also want to organize multiple albums based on my user class?

Code: Select all
    public function getServiceConfig()
    {
        return array(
            'factories' => array(
                'Album\Model\AlbumTable' =>  function($sm) {
                    $tableGateway = $sm->get('AlbumTableGateway');
                    $table = new AlbumTable($tableGateway);
                    return $table;
                },
                'AlbumTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new Album());
                    return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
                },
            ),
        );
    }
kinggoddard
 
Posts: 6
Joined: Mon May 24, 2010 5:34 pm

Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 8 guests