httpClient = $httpClient; $this->params = $params; $this->story = $story; } /** * @param ProjectCommandView $elementValueView * * @return mixed */ public function __invoke(ProjectCommandView $projectView) { $version = 1; if ($this->params->get('story_enabled')) { foreach ($projectView->projects as $project) { $call = $this->httpClient->data('POST', $this->params->get('domain_story') . '/story/element_value_version.json', [ 'json' => [ 'objectId' => $project->getId(), 'module' => 'pim', 'className' => get_class($project), ], 'headers' => [ 'x-auth-token' => $projectView->token, ], ]); if ($call && null !== $call['version']) { $version = ++$call['version']; } $this->story->execute('workflow', ['value' => $project->getValue()], $project->getId(), get_class($project), $version); } } return null; } }