Pantheon\Terminus\Models\TerminusModel::__construct PHP Method

__construct() public method

Object constructor
public __construct ( object $attributes = null, array $options = [] )
$attributes object Attributes of this model
$options array Options with which to configure this model
    public function __construct($attributes = null, array $options = [])
    {
        if (is_object($attributes)) {
            $this->attributes = $this->parseAttributes($attributes);
            if (isset($this->attributes->id)) {
                $this->id = $this->attributes->id;
            }
        } else {
            $this->attributes = (object) [];
        }
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function __construct($attributes = null, array $options = [])
 {
     parent::__construct($attributes, $options);
     $this->organization = $options['collection']->organization;
     $this->site_data = $attributes->site;
     $this->tags_data = $attributes->tags;
 }
All Usage Examples Of Pantheon\Terminus\Models\TerminusModel::__construct