Gc\Document\Model::fromArray PHP Method

fromArray() public static method

Initialize document from array
public static fromArray ( array $array ) : Model
$array array Data
return Model
    public static function fromArray(array $array)
    {
        $documentTable = new Model();
        $documentTable->setData($array);
        $documentTable->setOrigData();
        return $documentTable;
    }

Usage Example

Example #1
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $serviceManager = Registry::get('Application')->getServiceManager();
     $renderer = $serviceManager->get('Zend\\View\\Renderer\\PhpRenderer');
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('currentDocument', Model::fromArray(array('id' => 1)));
     $serviceManager->setAllowOverride(false);
     $this->object = new CurrentDocument($serviceManager);
 }
All Usage Examples Of Gc\Document\Model::fromArray