Autoloader Zend Framework 1.12

1

I'm starting (studying) project with zf where I'm not yet using modules.

I have initially the following file ... / projectzend / application / models / Dbtable / Actor.php

<?php
class Application_Model_Actor extends Zend_Db_Table_Abstract
{
    protected $_name = 'actor'; // Nome da tabela
    protected $_id = 'actor_id'; // campo id da tabela
}

I also have the controller index where it has aactionIndex and I'm trying to instantiate this model from above.

public function indexAction()
{
   $actor = new Application_Model_Actor();
}

asked by anonymous 26.05.2014 / 17:21

1 answer

2

Ideally, the class name should be:

class Application_Models_Dbtable_Actor extends Zend_Db_Table_Abstract
{...

This would follow the PSR-0 standard, as autoload follows this pattern.

    
29.05.2014 / 22:13