src/Callbacks/AbstractSelectCallback.php
/**
     * Will be invoked by a observer it has been registered for.
     *
     * @param \TechDivision\Import\Observers\AttributeCodeAndValueAwareObserverInterface|null $observer The observer
     *
     * @return mixed The modified value
     */
Will be invoked by a observer it has been registered for.

@return mixed The modified value
Will be invoked by a observer it has been registered for . @return mixed The modified value
public function handle(AttributeCodeAndValueAwareObserverInterface $observer = null)
    {
        $this->setObserver($observer);
        $attributeCode = $observer->getAttributeCode();
        $attributeValue = $observer->getAttributeValue();
        if ($attributeValue == null || $attributeValue === '') {
            return;
        }
        $storeId = $this->getStoreId(StoreViewCodes::ADMIN);
        if ($eavAttributeOptionValue = $this->loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($this->getEntityTypeId(), $attributeCode, $storeId, $attributeValue)) {
            return $eavAttributeOptionValue[MemberNames::OPTION_ID];
        }
        if ($this->isDebugMode()) {
            $this->getSystemLogger()->warning(
                $this->appendExceptionSuffix(
                    sprintf(
                        'Can\'t find select option value "%s" for attribute "%s"',
                        $attributeValue,
                        $attributeCode
                    )
                )
            );
            $this->mergeAttributesRecursive(
                array(
                    RegistryKeys::MISSING_OPTION_VALUES => array(
                        $attributeCode => array(
                            $attributeValue => array(
                                $this->raiseCounter($attributeValue),
                                array($this->getUniqueIdentifier() => true)
                            )
                        )
                    )
                )
            );
            return;
        }
        throw new \Exception(
            $this->appendExceptionSuffix(
                sprintf(
                    'Can\'t find select option value "%s" for attribute "%s"',
                    $attributeValue,
                    $attributeCode
                )
            )
        );
    }
public function handle ( AttributeCodeAndValueAwareObserverInterface $ observer = null ) { $ this -> setObserver ( $ observer ) ; $ attributeCode = $ observer -> getAttributeCode ( ) ; $ attributeValue = $ observer -> getAttributeValue ( ) ; if ( $ attributeValue == null || $ attributeValue === '' ) { return ; } $ storeId = $ this -> getStoreId ( StoreViewCodes :: ADMIN ) ; if ( $ eavAttributeOptionValue = $ this -> loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue ( $ this -> getEntityTypeId ( ) , $ attributeCode , $ storeId , $ attributeValue ) ) { return $ eavAttributeOptionValue [ MemberNames :: OPTION_ID ] ; } if ( $ this -> isDebugMode ( ) ) { $ this -> getSystemLogger ( ) -> warning ( $ this -> appendExceptionSuffix ( sprintf ( 'Can\'t find select option value "%s" for attribute "%s"' , $ attributeValue , $ attributeCode ) ) ) ; $ this -> mergeAttributesRecursive ( array ( RegistryKeys :: MISSING_OPTION_VALUES => array ( $ attributeCode => array ( $ attributeValue => array ( $ this -> raiseCounter ( $ attributeValue ) , array ( $ this -> getUniqueIdentifier ( ) => true ) ) ) ) ) ) ; return ; } throw new \ Exception ( $ this -> appendExceptionSuffix ( sprintf ( 'Can\'t find select option value "%s" for attribute "%s"' , $ attributeValue , $ attributeCode ) ) ) ; }
Will be invoked by a observer it has been registered for.
Will be invoked by a observer it has been registered for .
// set the observer // load the attribute code and value // query whether or not a value for the attibute with the diven code has been set // load the store ID // try to load the attribute option value and return the option ID // query whether or not we're in debug mode // log a warning and return immediately // add the missing option value to the registry // return NULL, if the value can't be mapped to an option // throw an exception if the attribute is NOT // available and we're not in debug mode