/** * {@inheritdoc} */ public function hydrate(Context\ContextInterface $context, array $rawData) { if (!isset($rawData['info'])) { $rawData['info'] = []; } $this->validateRawData($rawData); $context->setName($rawData['name'])->setFullInfo($rawData['info'])->setHash($rawData['hash']); }
public function generateCode(ContextInterface $context) { list($type, $resource, $action) = array_slice(explode('.', $context->getName()), -3); // all marketplace contexts have this getPartner or getVenture // additional info on contexts $company = $this->get($context->getPartner() ?: $context->getVenture()); return [['name' => 'TYPE', 'code' => $this->get($type)], ['name' => 'RESOURCE', 'code' => $this->get($resource)], ['name' => 'ACTION', 'code' => $this->get($action)], ['name' => 'COMPANY', 'code' => $company]]; }
public function generateCode(ContextInterface $context) { return new DataWrapper\FragmentCollection([['name' => 'TEST', 'code' => $this->get($context->getName())]]); }