LazyRecord\Schema\DeclareSchema::mixin PHP Method

mixin() public method

Availabel mixins $this->mixin('Metadata' , array( options ) ); $this->mixin('I18n');
public mixin ( string $class, array $options = [] )
$class string mixin class name
$options array
    public function mixin($class, array $options = array())
    {
        if (!class_exists($class, true)) {
            $class = 'LazyRecord\\Schema\\Mixin\\' . $class;
            if (!class_exists($class, true)) {
                throw new Exception("Mixin class {$class} not found.");
            }
        }
        $mixin = new $class($this, $options);
        $this->addMixinSchemaClass($class);
        $this->mixinSchemas[] = $mixin;
        /* merge columns into self */
        $this->columns = array_merge($this->columns, $mixin->columns);
        $this->relations = array_merge($this->relations, $mixin->relations);
        $this->indexes = array_merge($this->indexes, $mixin->indexes);
        $this->modelTraitClasses = array_merge($this->modelTraitClasses, $mixin->modelTraitClasses);
    }