src/Charcoal/Model/Service/ModelBuilder.php
public function build($objType, $metadataIdent = null, $sourceIdent = null)
    {
        $metadata = $this->createMetadata($objType, $metadataIdent);
        $source = $this->createSource($metadata, $sourceIdent);
        $args = array_merge($this->factory->arguments(), [
            'metadata'  => $metadata,
            'source'    => $source
        ]);
        $model = $this->factory->create($objType, $args);
        $model->source()->setModel($model);
        return $model;
    }
public function build($objType, $metadataIdent = null, $sourceIdent = null)
    {
        $metadata = $this->createMetadata($objType, $metadataIdent);
        $source = $this->createSource($metadata, $sourceIdent);
        $args = array_merge($this->factory->arguments(), [
            'metadata'  => $metadata,
            'source'    => $source
        ]);
        $model = $this->factory->create($objType, $args);
        $model->source()->setModel($model);
        return $model;
    }
public function build ( $ objType , $ metadataIdent = null , $ sourceIdent = null ) { $ metadata = $ this -> createMetadata ( $ objType , $ metadataIdent ) ; $ source = $ this -> createSource ( $ metadata , $ sourceIdent ) ; $ args = array_merge ( $ this -> factory -> arguments ( ) , [ 'metadata' => $ metadata , 'source' => $ source ] ) ; $ model = $ this -> factory -> create ( $ objType , $ args ) ; $ model -> source ( ) -> setModel ( $ model ) ; return $ model ; }
Build a model, pre-initializing its metadata and its source.

By default, the name of the "obj type" (the model class name) is used to determine the metadata ident to load.
To load a custom metadata for the object, use the `$metadataIdent` argument.

By default, the object's _default_ source (from its metadata) is used as source.
To load a custom source for the object, use the `$sourceIdent` argument.

@param string      $objType       The object type of the Model.
@param string|null $metadataIdent Optional. The metadata ident of the object.
@param string|null $sourceIdent   Optional. The custom source ident to load as source.
@return \Charcoal\Model\ModelInterface
Build a model pre - initializing its metadata and its source .