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);
}