Example #1
0
 /**
  * {@inheritdoc}
  */
 public function __construct(ORM $orm, $container, array $definition = [], LoaderInterface $parent = null)
 {
     $this->orm = $orm;
     //Related record schema
     $this->schema = $orm->schema($definition[static::RELATION_TYPE]);
     $this->container = $container;
     $this->definition = $definition;
     $this->parent = $parent;
     //Compiling options
     $this->options['method'] = static::LOAD_METHOD;
     if (!empty($parent)) {
         if (!$parent instanceof Loader || $parent->getDatabase() != $this->getDatabase()) {
             //We have to force post-load (separate query) if parent loader database is different
             $this->options['method'] = self::POSTLOAD;
         }
     }
     $this->dataColumns = array_keys($this->schema[ORM::M_COLUMNS]);
 }