Wednesday, August 14, 2013

CakePHP - find function and subsequently added multilanguage field

This is my Model:
...
    class Portfolio extends AppModel {
        public $name = 'Portfolio';
        public $useTable = 'portfolios';
        public $actsAs = array('Translate' =>  array('title','text1'));
    }
.....
In my Controller:
....

    public function index() {
        $this->Portfolio->locale = $this->lang;
        $this->Portfolio->recursive = 0;
        $Portfolios=$this->Portfolio->find('all');
        $this->set('portfolios', $Portfolios);
    }
Everything works fine until the moment when I want to add a new multilanguage field .
If I add new field in Model eg. 'text2'

    class Portfolio extends AppModel {
        public $name = 'Portfolio';
        public $useTable = 'portfolios';
        public $actsAs = array('Translate' =>  array('title','text1','text2'));
    }

find() function in my controller return empty array. WHY??? I must mention that in the database stored dozen records. How to re-display the data no matter what I added additional multilanguage field?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: