Autoloader Zend Framework 1.12

Asked

Viewed 95 times

1

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

I initially have the following file .../projectozend/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 there is aactionIndex and I’m trying to instantiate this model from above.

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

Oh beauty but I have the following problem: Fatal error: Class 'Application_model_actor' not found [...]

I see I need to set up the autoloader of the project in which I have already done a web search, but cannot understand and implement. The end which is the most correct way to make this configuration?

Well I’m using ZF1 because I’m on stage and here is using this version.

1 answer

2

Ideally the class name would be:

class Application_Models_Dbtable_Actor extends Zend_Db_Table_Abstract
{...

Thus it would follow the standard PSR-0, because the autoload follows this pattern.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.