Overview

Namespaces

  • Charcoal
    • Loader
    • Model
      • Service
      • ServiceProvider
    • Source
      • Database
    • Validator

Classes

  • MetadataLoader
  • ModelBuilder
  • ModelLoader
  • ModelLoaderBuilder
  • Overview
  • Namespace
  • Class

Class ModelBuilder

Final
Namespace: Charcoal\Model\Service
Located at Charcoal/Model/Service/ModelBuilder.php
Methods summary
public
# __construct( array $data )

Parameters

$data
Constructor dependencies.
public ModelInterface
# build( string $objType, string|null $metadataIdent = null, string|null $sourceIdent = null )

Build a model, pre-initializing its metadata and its source.

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.

Parameters

$objType
The object type of the Model.
$metadataIdent
Optional. The metadata ident of the object.
$sourceIdent
Optional. The custom source ident to load as source.

Returns

ModelInterface
public ModelInterface
# __invoke( string $objType, string|null $metadataIdent = null, string|null $sourceIdent = null )

The builder can be invoked (used as function).

The builder can be invoked (used as function).

Parameters

$objType
The object type of the Model.
$metadataIdent
Optional. The metadata ident of the object.
$sourceIdent
Optional. The custom source ident to load as source.

Returns

ModelInterface
Constants summary
string DEFAULT_SOURCE_TYPE
# 'database'
API documentation generated by ApiGen