public function testIfWillDecorateI18NFieldsOnSecondLanguageSet()
 {
     $model = new ModelWithI18N();
     $model->setLang('en');
     $model->setLang('pl');
     $cd = new ConditionDecorator($model);
     $title = $cd->decorate('title', 'Title');
     $active = $cd->decorate('active', 1);
     $this->assertSame('title.pl', key($title));
     $this->assertSame('Title', $title['title.pl']);
     $this->assertSame('active.pl', key($active));
     $this->assertSame(true, $active['active.pl']);
 }
Esempio n. 2
0
 public function getSort()
 {
     $sort = [];
     if (null === $this->cd) {
         $this->cd = new ConditionDecorator($this->model);
     }
     foreach ($this->fields as $fieldName => $order) {
         $decorated = $this->cd->decorate($fieldName);
         $sort[key($decorated)] = $order;
     }
     return $sort;
 }