Ejemplo n.º 1
0
 public static function create(array $data = array())
 {
     $file = new File();
     $file->fill($data);
     $file->save();
     $element = new Element();
     $element->fill($data);
     $file->content()->save($element);
 }
Ejemplo n.º 2
0
 public function actionSave()
 {
     $item = new File();
     $periodStart = date('Y-m-d', strtotime($this->app->request->post->periodStart));
     $periodEnd = date('Y-m-d', strtotime($this->app->request->post->periodEnd));
     $this->app->request->post->periodStart = $periodStart;
     $this->app->request->post->periodEnd = $periodEnd;
     $item->fill($this->app->request->post);
     $item->save();
     $this->redirect('/sources/default/');
 }