Esempio n. 1
0
 /**
  * Override the constructor to provide support for the {@link ACTIVERECORD_CLASS} tag and
  * extended support for the {@link EXTENDING} tag.
  *
  * If {@link EXTENDING} is defined but the model has no schema ({@link SCHEMA} is empty),
  * the name of the model and the schema are inherited from the extended model and
  * {@link EXTENDING} is set to the parent model object. If {@link ACTIVERECORD_CLASS} is
  * empty, its value is set to the extended model's active record class.
  *
  * If {@link ACTIVERECORD_CLASS} is set, its value is saved in the
  * {@link $activerecord_class} property.
  *
  * @param ModelCollection $models
  * @param array $attributes Attributes used to construct the model.
  */
 public function __construct(ModelCollection $models, array $attributes)
 {
     $this->models = $models;
     $this->attributes = $attributes = $this->resolve_attributes($attributes);
     $this->parent = $attributes[self::EXTENDING];
     $this->relations = new RelationCollection($this);
     parent::__construct($attributes);
     #
     # Resolve the active record class.
     #
     $this->activerecord_class = $this->resolve_activerecord_class();
     $this->resolve_relations();
 }