- \Somnambulist\Components\ReadModels\ModelExporter
- \Somnambulist\Components\ReadModels\PaginatorAdapter
- \Somnambulist\Components\ReadModels\Model (abstract)
- \Somnambulist\Components\ReadModels\ModelMetadata
- \Somnambulist\Components\ReadModels\ConnectionManager
- \Somnambulist\Components\ReadModels\Contracts\Queryable (interface)
- \Somnambulist\Components\ReadModels\EventSubscribers\IdentityMapClearerMessengerSubscriber
- \Somnambulist\Components\ReadModels\EventSubscribers\IdentityMapClearerSubscriber
- \Somnambulist\Components\ReadModels\Exceptions\EntityNotFoundException
- \Somnambulist\Components\ReadModels\Exceptions\NoResultsException
- \Somnambulist\Components\ReadModels\Exceptions\ConnectionManagerException
- \Somnambulist\Components\ReadModels\PHPUnit\PHPUnitListener
- \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship (abstract)
- \Somnambulist\Components\ReadModels\Relationships\HasOneOrMany (abstract)
- \Somnambulist\Components\ReadModels\TypeCasters\DoctrineTypeCaster
- \Somnambulist\Components\ReadModels\Utils\ClassHelpers
- \Somnambulist\Components\ReadModels\Utils\FilterGeneratedKeysFromCollection
- \Somnambulist\Components\ReadModels\Utils\GenerateRelationshipsToEagerLoad
- \Somnambulist\Components\ReadModels\Utils\StrConverter
### Class: \Somnambulist\Components\ReadModels\ModelExporter
Visibility | Function |
---|---|
public | __construct(\Somnambulist\Components\ReadModels\Model $model, array $attributes=array(), array $relationships=array()) : void |
public | attributes(mixed $attributes) : \Somnambulist\Components\ReadModels\ModelExporter Export only the specified attributes; if empty will export all attributes |
public | include(mixed $relationship) : \Somnambulist\Components\ReadModels\ModelExporter Export with the specified relationships; if empty will NOT export any relationships |
public | toArray() : void |
public | toJson(\int $options) : void |
This class implements \Somnambulist\Components\Collection\Contracts\Jsonable
### Class: \Somnambulist\Components\ReadModels\PaginatorAdapter
Visibility | Function |
---|---|
public | __construct(\Somnambulist\Components\ReadModels\ModelBuilder $queryBuilder) : void |
public | getNbResults() : mixed |
public | getSlice(mixed $offset, mixed $length) : mixed |
This class implements \Pagerfanta\Adapter\AdapterInterface
### Class: \Somnambulist\Components\ReadModels\Model (abstract)
Visibility | Function |
---|---|
public | __construct(array $attributes=array()) : void |
public | __toString() : void |
public | export() : void |
public static | find(string $id) : \Somnambulist\Components\ReadModels\Model/null |
public static | findOrFail(string $id) : \Somnambulist\Components\ReadModels\Model |
public | getAttribute(\string $name) : mixed/null Get the requested attribute or relationship If a mutator is defined (getXxxxAttribute method), the attribute will be passed through that first. If the attribute does not exist a virtual accessor will be checked and return if there is one. Finally, if the relationship exists and has not been loaded, it will be at this point. |
public | getAttributes() : mixed |
public | getCollection(array $models=array()) : mixed |
public | getExternalPrimaryKey() : mixed/null Could return an object e.g. Uuid or string, depending on casting |
public | getOwningKey() : mixed Gets the owning side of the relationships key name |
public | getPrimaryKey() : mixed/null Could return an object e.g. Uuid, Identity, depending on casting |
public | getRelationship(\string $method) : \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship Returns the relationship definition defined by the method name E.g. a User model hasMany Roles, the method would be "roles()". |
public static | include(mixed $relations) : \Somnambulist\Components\ReadModels\ModelBuilder Eager load the specified relationships on this model Allows dot notation to load related.related objects. |
public | jsonSerialize() : void |
public | meta() : void |
public | new(array $attributes=array()) : void |
public | newQuery() : void |
public static | query() : \Somnambulist\Components\ReadModels\ModelBuilder Starts a new query builder process without any constraints |
public | setRelationshipValue(\string $method, \object $related) : void |
public | toArray() : void |
public | toJson(\int $options) : void |
protected | belongsTo(\string $class, \string $foreignKey=null, \string $ownerKey=null, \string $relation=null, \bool $nullOnNotFound=true) : \Somnambulist\Components\ReadModels\Relationships\BelongsTo Define an inverse one-to-one or many relationship The table in this case will be the owning side of the relationship i.e. the originator of the foreign key on the specified class. For example: a User has many Addresses, the address table has a key: user_id linking the address to the user. This relationship finds the user from the users table where the users.id = user_addresses.user_id. This will only associate a single model as the inverse side, nor will it update the owner with this models association. |
protected | belongsToMany(\string $class, \string $table, \string $sourceColumnName=null, \string $targetColumnName=null, \string $sourceKey=null, \string $targetKey=null) : \Somnambulist\Components\ReadModels\Relationships\BelongsToMany Define a new many to many relationship The table is the joining table between the source and the target. The source is the object at the left hand side of the relationship, the target is on the right. For example: User -> Roles through a user_roles table, with user_id, role_id as columns. The relationship would be defined as a User has Roles so the source is user_id and the target is role_id. The table name must be provided and will not be guessed. |
protected | hasMany(\string $class, \string $foreignKey=null, \string $parentKey=null, \string $indexBy=null) : \Somnambulist\Components\ReadModels\Relationships\HasOneToMany Define a one to many relationship Here, the parent has many children, so a User can have many addresses. The foreign key is the name of the parents key in the child's table. local key is the child's primary key. indexBy allows a column on the child to be used as the key in the returned collection. Note: if this is specified, then there can be only a single instance of that key returned. This would usually be used on related objects with a type where, the parent can only have one of each type e.g.: a contact has a "type" field for: home, office, cell etc. |
protected | hasOne(\string $class, \string $foreignKey=null, \string $parentKey=null, \bool $nullOnNotFound=true) : \Somnambulist\Components\ReadModels\Relationships\HasOne Defines a one to one relationship Here the parent has only one child and the child only has that parent. If multiple records end up being stored, then only the first will be loaded. |
This class extends \Somnambulist\Components\AttributeModel\AbstractModel
This class implements \Somnambulist\Components\Collection\Contracts\Arrayable, \Somnambulist\Components\Collection\Contracts\Jsonable, \JsonSerializable, \Stringable
### Class: \Somnambulist\Components\ReadModels\ModelMetadata
Visibility | Function |
---|---|
public | __construct(\Somnambulist\Components\ReadModels\Model $model, \string $table, \string $primaryKey='id' , \string $alias=null, \string $externalKey=null, \string $foreignKey=null) : void |
public | externalKeyName() : void |
public | foreignKey() : string Creates a foreign key name from the current class name and primary key name This is used in relationships if a specific foreign key column name is not defined on the relationship. |
public | prefixAlias(\string $column) : void |
public | primaryKeyName() : void |
public | primaryKeyNameWithAlias() : void |
public | removeAlias(\string $key) : void |
public | table() : void |
public | tableAlias() : void |
### Class: \Somnambulist\Components\ReadModels\ConnectionManager
Visibility | Function |
---|---|
public | __construct(array $connections) : void |
public | add(\Doctrine\DBAL\Connection $connection, \string $model='default' ) : voidSet the DBAL Connection to use by default or for a specific model The model class name should be used and then that connection will be used with all instances of that model. A default connection should still be provided as a fallback. |
public | for(\string $model='default' ) : \Doctrine\DBAL\ConnectionGet the model or default connection |
public | forAll(array $connections) : void |
### Interface: \Somnambulist\Components\ReadModels\Contracts\Queryable
Tags an object as supporting or allowing pass through into the Builder object. This allows for type completion and hints where they might not otherwise exist.
Visibility | Function |
---|
### Class: \Somnambulist\Components\ReadModels\EventSubscribers\IdentityMapClearerMessengerSubscriber
Clears the read-model identity map when being used in Messenger to avoid stale data after a command has been executed. Based on DoctrineBridge::DoctrineClearEntityManagerWorkerSubscriber
Visibility | Function |
---|---|
public | __construct(\Somnambulist\Components\ReadModels\Manager $manager) : void |
public static | getSubscribedEvents() : mixed |
public | onWorkerMessageFailed() : void |
public | onWorkerMessageHandled() : void |
This class implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
### Class: \Somnambulist\Components\ReadModels\EventSubscribers\IdentityMapClearerSubscriber
Kernel subscriber that clears the identity map onRequest start, exception or terminate ensuring that the identity map is fresh for each request. When running under php-fpm this should not be needed; however if you use a PHP application server, that does not terminate, then the identity map will not be cleared between request (e.g. PHP-PM).
Visibility | Function |
---|---|
public | __construct(\Somnambulist\Components\ReadModels\Manager $manager) : void |
public static | getSubscribedEvents() : mixed |
public | onException(\Symfony\Component\HttpKernel\Event\KernelEvent $event) : void |
public | onRequest(\Symfony\Component\HttpKernel\Event\KernelEvent $event) : void |
public | onTerminate(\Symfony\Component\HttpKernel\Event\KernelEvent $event) : void |
This class implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
### Class: \Somnambulist\Components\ReadModels\Exceptions\EntityNotFoundException
Visibility | Function |
---|---|
public static | noMatchingRecordFor(\string $class, \string $key, mixed $id) : void |
This class extends \Exception
This class implements \Throwable, \Stringable
### Class: \Somnambulist\Components\ReadModels\Exceptions\NoResultsException
Visibility | Function |
---|---|
public | __construct(\string $class, \Doctrine\DBAL\Query\QueryBuilder $queryBuilder) : void |
public | getQuery() : mixed |
public static | noResultsForQuery(\string $class, \Doctrine\DBAL\Query\QueryBuilder $queryBuilder) : void |
This class extends \Exception
This class implements \Throwable, \Stringable
### Class: \Somnambulist\Components\ReadModels\Exceptions\ConnectionManagerException
Visibility | Function |
---|---|
public static | missingConnectionFor(\string $model) : void |
This class extends \Exception
This class implements \Throwable, \Stringable
### Class: \Somnambulist\Components\ReadModels\PHPUnit\PHPUnitListener
Ensures that the identity map is cleared before and after every test case is run. If this is not used, then the identity map will persist across tests, giving false results. Enable it by adding the following to your phpunit.xml file:
Visibility | Function |
---|---|
public | executeAfterTest(\string $test, \float $time) : void |
public | executeBeforeTest(\string $test) : void |
This class implements \PHPUnit\Runner\BeforeTestHook, \PHPUnit\Runner\AfterTestHook, \PHPUnit\Runner\Hook, \PHPUnit\Runner\TestHook
### Class: \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship (abstract)
Represents a relationship between models. Relationships can be queried separately. Supports proxying calls to the Builder class
Visibility | Function |
---|---|
public | __call(mixed $name, mixed $arguments) : void |
public | __construct(\Somnambulist\Components\ReadModels\ModelBuilder $builder, \Somnambulist\Components\ReadModels\Model $parent) : void |
public | addConstraintCallbackToQuery(\callable $constraint) : \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship Allows a callable to modify the current query before the results are fetched |
public | abstract addConstraints(\Somnambulist\Components\Collection\Contracts\Collection $models) : \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship Add the constraints required for loading a set of results |
public | abstract addRelationshipResultsToModels(\Somnambulist\Components\Collection\Contracts\Collection $models, \string $relationship) : \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship Executes and maps the loaded data to the collection of Models The related models will be inserted in the models relationships array at the key specified by $relationship. |
public | fetch() : mixed |
public | getParent() : mixed |
public | getQuery() : mixed |
public | getRelated() : mixed |
This class implements \Somnambulist\Components\ReadModels\Contracts\Queryable
### Class: \Somnambulist\Components\ReadModels\Relationships\HasOneOrMany (abstract)
Visibility | Function |
---|---|
public | __construct(\Somnambulist\Components\ReadModels\ModelBuilder $builder, \Somnambulist\Components\ReadModels\Model $parent, \string $foreignKey, \string $localKey) : void |
public | addConstraints(\Somnambulist\Components\Collection\Contracts\Collection $models) : void |
This class extends \Somnambulist\Components\ReadModels\Relationships\AbstractRelationship
This class implements \Somnambulist\Components\ReadModels\Contracts\Queryable
### Class: \Somnambulist\Components\ReadModels\TypeCasters\DoctrineTypeCaster
Visibility | Function |
---|---|
public | __construct(\Doctrine\DBAL\Connection $connection) : void |
public | cast(mixed $attributes, mixed $attribute, \string $type) : void |
public | supports(\string $type) : void |
public | types() : void |
This class implements \Somnambulist\Components\AttributeModel\Contracts\AttributeCasterInterface
### Class: \Somnambulist\Components\ReadModels\Utils\ClassHelpers
Assorted helpers, scoped to prevent global functions.
Visibility | Function |
---|---|
public static | getCallingClass() : string Returns the class that made a call to the current class |
public static | getCallingMethod() : string Returns the function (method name) that called the function this is used in |
public static | getObjectShortClassName(\object $object) : string |
public static | set(\object $object, \string $property, \mixed $value, \mixed $scope=null) : object Set the property in object to value If scope is set to a parent class, private properties can be updated. |
public static | setPropertyArrayKey(\object $object, \string $property, \string $key, \mixed $value, \mixed $scope=null) : object Set an array key in the object property to value If scope is set to a parent class, private properties can be updated. |
### Class: \Somnambulist\Components\ReadModels\Utils\FilterGeneratedKeysFromCollection
Visibility | Function |
---|---|
public | __invoke(array/\Somnambulist\Components\ReadModels\Utils\Collection $attributes) : array Filters out library generated keys from the set of attributes |
### Class: \Somnambulist\Components\ReadModels\Utils\GenerateRelationshipsToEagerLoad
Encapsulates the logic for generating eager loaded relationships. Based on the eager loading strategy deployed in Laravel Eloquent.
Visibility | Function |
---|---|
public | __invoke(array $toEagerLoad=array(), mixed $relations) : array Set the relationships that should be eager loaded |
### Class: \Somnambulist\Components\ReadModels\Utils\StrConverter
Visibility | Function |
---|---|
public static | toResource(\string $string) : bool/\Somnambulist\Components\ReadModels\Utils\resource Converts a string to a stream resource by passing it through a memory file |