public function accueilAction($id) { $article = new Article(); $article->setTitle('Titre article'); $array = array('brothers' => 'John', 'sisters' => ['Jil', 'Ana'], 'parents' => ['father' => 'Marc', 'mother' => 'Jade']); $names = new Collection($array); while ($name = $names->fetch()) { echo $name->isEven() ? '* ' : ''; if ($name->isCollection()) { echo $name->key() . ' (' . $name->length() . ') : ' . $name->implode(', ') . '<br>'; } else { echo $name->key() . ' (' . $name->length() . ') : ' . $name . '<br>'; } } $user = new User(); $user->setLogin('Grégory'); $tab = ['id' => 1254, 'title' => 'Mon titre', 'author' => $user]; $article->fill($tab); $data = $article->getRecord(); $article->save(); $test = ['test' => '<html>', 'roles' => ['admin' => '<body>', 'user' => ['<truc>', '<machin>']]]; $test = new Collection($test); App::debug($test->toArray()); $this->vars->set('page_title', 'Accueil'); $this->render('index'); }
public function loadModel($model_name) { $model_path = MODEL . 'model.' . $model_name . '.php'; if (file_exists($model_path)) { require_once $model_path; } else { if (ENVIRONMENT == 'development') { App::debug($this->translation->translate("The model file %model% doesn't exists", $model_path, false, 'sybil', 'debug')); die; } } }