8 use Doctrine\Instantiator\Exception\InvalidArgumentException;
22 private $communicationConfig;
34 $topicConfig = $this->getCommunicationConfig()->getTopic($topic);
35 if ($topicConfig ===
null) {
40 'schema_type' => $topicConfig[CommunicationConfig::TOPIC_REQUEST_TYPE],
41 'schema_value' => $topicConfig[CommunicationConfig::TOPIC_REQUEST]
45 'schema_type' => isset($topicConfig[CommunicationConfig::TOPIC_RESPONSE])
46 ? CommunicationConfig::TOPIC_REQUEST_TYPE_CLASS
48 'schema_value' => $topicConfig[CommunicationConfig::TOPIC_RESPONSE]
65 if ($topicSchema[
'schema_type'] == CommunicationConfig::TOPIC_REQUEST_TYPE_CLASS) {
66 $messageDataType = $topicSchema[
'schema_value'];
72 foreach ($topicSchema[
'schema_value'] as $methodParameterMeta) {
73 $paramName = $methodParameterMeta[CommunicationConfig::SCHEMA_METHOD_PARAM_NAME];
74 $paramType = $methodParameterMeta[CommunicationConfig::SCHEMA_METHOD_PARAM_TYPE];
75 if ($isIndexedArray) {
76 $paramPosition = $methodParameterMeta[CommunicationConfig::SCHEMA_METHOD_PARAM_POSITION];
77 if (isset(
$message[$paramPosition])) {
99 if (preg_match_all(
"/\\\\/", $messageType)) {
114 $compareType = $messageType;
115 $realType = $this->getRealType(
$message);
116 if ($realType ==
'array' && count(
$message) == 0) {
119 $realType = $this->getRealType(
$message[0]);
120 $compareType = preg_replace(
'/\[\]/',
'', $messageType);
122 if ($realType !== $compareType) {
123 throw new InvalidArgumentException(
125 'Data in topic "%topic" must be of type "%expectedType". ' 126 .
'"%actualType" given.',
129 'expectedType' => $messageType,
130 'actualType' => $this->getRealType(
$message)
146 $compareType = $messageType;
147 $realType = $this->getRealType(
$message);
148 if ($realType ==
'array' && count(
$message) == 0) {
152 $compareType = preg_replace(
'/\[\]/',
'', $messageType);
154 if (!(
$message instanceof $compareType)) {
155 throw new InvalidArgumentException(
157 'Data in topic "%topic" must be of type "%expectedType". ' 158 .
'"%actualType" given.',
161 'expectedType' => $messageType,
162 'actualType' => $this->getRealType($origMessage)
173 private function getRealType(
$message)
188 private function getCommunicationConfig()
190 if ($this->communicationConfig ===
null) {
192 CommunicationConfig::class
195 return $this->communicationConfig;
elseif(isset( $params[ 'redirect_parent']))
validateMessage($message, $messageType, $topic)
validateClassType($message, $messageType, $topic)
validatePrimitiveType($message, $messageType, $topic)
validate($topic, $message, $requestType=true)
getTopicSchema($topic, $requestType)