/**
  * @param  string  $model
  */
 private function seedTable($model, array $data)
 {
     $metadata = Metadata::get($model);
     foreach ($data as $row) {
         $metadata['orm:query']->insert($row);
     }
 }
Example #2
0
 /**
  * Returns the metadata for this specific model.
  *
  * @return  Metadata
  */
 public static function metadata()
 {
     return Metadata::get(get_called_class());
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     $this->subject = Metadata::get('Mismatch\\Mock\\Orm');
 }
Example #4
0
 /**
  * Allows calling static methods on the class as if
  * they were the start of query chains.
  *
  * @param   string  $method
  * @param   array   $args
  * @return  Query
  */
 public static function __callStatic($method, array $args)
 {
     $query = Metadata::get(get_called_class())['orm:query'];
     return call_user_func_array([$query, $method], $args);
 }
Example #5
0
 /**
  * @return  Metadata
  */
 protected function foreignMeta()
 {
     if (!$this->class instanceof Metadata) {
         $this->class = Metadata::get($this->class);
     }
     return $this->class;
 }