fromArray() public static method

Initiliaze from array
public static fromArray ( array $array ) : Model
$array array Data
return Model
Example #1
0
 /**
  * Return all documents with Event(s)
  *
  * @return array
  */
 public function getEvents()
 {
     $events = array();
     $rows = $this->fetchAll($this->select(function (Select $select) {
         $select->order('created_at DESC');
     }));
     foreach ($rows as $row) {
         $events[] = Model::fromArray($row);
     }
     return $events;
 }
Example #2
0
 /**
  * Test
  *
  * @return void
  */
 public function testRemoveEventAction()
 {
     $model = Model::fromArray(array('content' => '', 'template_id' => 1));
     $model->save();
     $this->dispatch('/admin/module/activity-log/remove-event/' . $model->getId());
     $this->assertResponseStatusCode(200);
     $this->assertModuleName('ActivityLog');
     $this->assertControllerName('ActivityLogController');
     $this->assertControllerClass('IndexController');
     $this->assertMatchedRouteName('module/activity-log/remove-event');
 }