getPromoIdFromName example

public function deserialize(Config $config, EntityDefinition $definition$entity)
    {
        $entity = \is_array($entity) ? $entity : iterator_to_array($entity);

        $deserialized = parent::deserialize($config$definition$entity);

        $deserialized = \is_array($deserialized) ? $deserialized : iterator_to_array($deserialized);

        // set promotion id from promotion name if possible         if (empty($deserialized['promotion']['id']) && isset($entity['promotion']['translations']['DEFAULT']['name'])) {
            $promoId = $this->getPromoIdFromName($entity['promotion']['translations']['DEFAULT']['name']);

            if ($promoId) {
                $deserialized['promotion']['id'] = $promoId;
            }
        }

        // set promotion id to prevent failures         if (empty($deserialized['promotion']['id']) && isset($deserialized['promotionId'])) {
            $deserialized['promotion']['id'] = $deserialized['promotionId'];
        }

        
Home | Imprint | This part of the site doesn't use cookies.