예제 #1
0
 /**
  * Create instance of relation schema based on relation type and given definition (declared in
  * record). Resolve using container to support any possible relation type. You can create your
  * own relations, loaders and schemas by altering ORM config.
  *
  * @param mixed         $type
  * @param SchemaBuilder $builder
  * @param RecordSchema  $record
  * @param string        $name
  * @param array         $definition
  * @return Schemas\RelationInterface
  */
 public function relationSchema($type, SchemaBuilder $builder, RecordSchema $record, $name, array $definition)
 {
     if (!$this->config->hasRelation($type, 'schema')) {
         throw new ORMException("Undefined relation schema '{$type}'.");
     }
     //Getting needed relation schema builder
     return $this->factory->make($this->config->relationClass($type, 'schema'), compact('builder', 'record', 'name', 'definition'));
 }
예제 #2
0
 /**
  * Get mutator alias if presented. Aliases used to simplify schema (accessors) definition.
  *
  * @param string $alias
  * @return string|array
  */
 public function mutatorAlias($alias)
 {
     return $this->config->mutatorAlias($alias);
 }