The problem is that I import a model.
App::import('Model', 'Carrier');
$this->Carrier = new Carrier;
And I re-import and instacing this model later. Normally it would work as well. However, this is a multi-language site. And the second instacing it returns with an empty string.
I tried this
App::import('Model', 'Carrier');
$this->Carrier = new Carrier;
... blabla...
App::import('Model', 'Carrier');
$this->getCarrier = new Carrier;
... blabla...
and tried this:
App::import('Model', 'Carrier');
$this->Carrier = new Carrier;
... blabla...
unset($this->Carrier);
App::import('Model', 'Carrier');
$this->Carrier = new Carrier;
... blabla...
Same result: the second instacing it returns with an empty string from database.
My translate model:
<?php
class Carrier extends AppModel
{
var $name = 'Carrier';
public $actsAs = array('Translate' => array(
'name',
'description'
)
);
}
?>
- i18n database table to the variety of languages... (http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html)
UPDATE:
Normally result:
Array ( [Carrier] => Array ( [id] => 1 [name] => TestCarrier [description] => Example [status] => 1 ) )
Wrong result with re-imported model:
Array ( [Carrier] => Array ( [id] => 1 [name] => [description] => [status] => 1 ) )