Пример #1
0
 function __construct($config)
 {
     parent::__construct($config);
     foreach ((array) $config['options']['classname'] as $classname) {
         $class = new $classname();
         $this->fixtures = array_merge($this->fixtures, $class->load()->toArray());
     }
 }
Пример #2
0
 function __construct($config)
 {
     $type = $config['type'];
     foreach ($config['options']['namespaces'] as $namespace) {
         $this->fixtures[] = new $type(new $namespace());
     }
     parent::__construct($config);
 }
Пример #3
0
 function __construct($config)
 {
     $type = $config['type'];
     foreach (glob($config['options']['glob']) as $filename) {
         $namespace = isset($config['options']['mapping'][basename($filename)]) ? $config['options']['mapping'][basename($filename)] : basename($filename);
         $data = json_decode(file_get_contents($filename), true);
         $hydrator = new ClassMethods();
         foreach ((array) $data as $value) {
             $entity = $hydrator->hydrate($value, new $namespace());
             $this->fixtures[] = new $type($entity);
         }
     }
     parent::__construct($config);
 }