TypeHintMapping
extends TagBasedMapping
in package
Routes commands based on typehints in the handler.
If your handler has a public method with a single, non-scalar, no-interface type hinted parameter, we'll assume that typehint is a command and route it to this service definition as the handler.
So, a class like this:
class MyHandler { public function handle(RegisterUser $command) {...} private function foobar(SomeObject $obj) {...} public function checkThings(OtherObject $obj, WhatObject $obj2) public function setADependency(ManagerInterface $interface) {...} }
would have RegisterUser routed to it, but not SomeObject (because it's used in a private method), not OtherObject or WhatObject (because they don't appear as the only parameter) and not setADependency (because it has an interface type hinted parameter).
Table of Contents
- TAG_NAME = 'tactician.handler'
- build() : Routing
- findCommandsForService() : array<string|int, mixed>
- isSupported() : bool
- mapServiceByTag() : mixed
Constants
TAG_NAME
public
mixed
TAG_NAME
= 'tactician.handler'
Methods
build()
public
build(ContainerBuilder $container, Routing $routing) : Routing
Parameters
- $container : ContainerBuilder
- $routing : Routing
Return values
Routing —findCommandsForService()
protected
findCommandsForService(ContainerBuilder $container, Definition $definition, array<string|int, mixed> $tagAttributes) : array<string|int, mixed>
Parameters
- $container : ContainerBuilder
- $definition : Definition
- $tagAttributes : array<string|int, mixed>
Return values
array<string|int, mixed> —isSupported()
protected
isSupported(ContainerBuilder $container, Definition $definition, array<string|int, mixed> $tagAttributes) : bool
Parameters
- $container : ContainerBuilder
- $definition : Definition
- $tagAttributes : array<string|int, mixed>
Return values
bool —mapServiceByTag()
private
mapServiceByTag(ContainerBuilder $container, Routing $routing, mixed $serviceId, mixed $attributes) : mixed
Parameters
- $container : ContainerBuilder
- $routing : Routing
- $serviceId : mixed
- $attributes : mixed