CakePHP ignoring my Model

0

Why is cake ignoring my Model? Do not understand. I have several other models working perfectly, but this one is not working. It is being ignored.

Name of the model: Typeservers.php

Model Content:

App::uses('AppModel', 'Model');

class TiposObservacao extends AppModel {

    public $useTable = 'tipos_observacoes';
    public $primaryKey = 'tipo_observacao_id';

   public $hasMany = array(
     "Observacao" => array(
              'className' => 'Atendimento.Observacao',
              'foreignKey' => 'tipo_observacao_id',
            )
   );

}
    
asked by anonymous 24.03.2014 / 22:47

1 answer

1

If your controller associated with this model is called "ObserveType", obeying the established naming convention, then Cake should recognize it with no problem.

If the model is used in any other controller, use the $ uses:

class QualquerController extends AppController
{
     public $uses = array('TiposObservacao');
}

In this way, Cake will instantiate the model for you in the variable $ TypesObservation

$this->TiposObservacao->find();
    
25.03.2014 / 00:20