/** * @constructor * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data */ public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) { $this->params = $params; $explodeValue = explode('::', $data['value']); if (!empty($explodeValue) && count($explodeValue) > 1) { $fixtureCode = $explodeValue[0]; $dataSet = isset($explodeValue[2]) ? $explodeValue[1] : ''; $searchValue = isset($explodeValue[2]) ? $explodeValue[2] : $explodeValue[1]; $this->product = $fixtureFactory->createByCode($fixtureCode, ['dataSet' => $dataSet]); if (!$this->product->hasData('id')) { $this->product->persist(); } if ($this->product->hasData($searchValue)) { $getProperty = 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $searchValue))); $this->data = $this->product->{$getProperty}(); } else { $this->data = $searchValue; } } else { $this->data = strval($data['value']); } }