src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
public function GetSQL()
    {
        /**
         * @var array $aNewValues
         */
        $aNewValues = $this->getInputFilterUtil()->getFilteredInput($this->name.'_new');

        if (!is_array($this->data)) {
            $this->data = array();
        } elseif (array_key_exists('x', $this->data)) {
            unset($this->data['x']);
        }

        $oEditorObjectConf = TdbCmsTblConf::GetNewInstance();
        $oEditorObjectConf->LoadFromField('name', 'shop_variant_type_value');

        if (!is_array($aNewValues)) {
            return false;
        }

        foreach ($aNewValues as $sShopVariantTypeId => $sNewValueName) {
            $sNewValueName = trim($sNewValueName);
            if (!empty($sNewValueName)) {
                // first make sure the value does not exist already
                $oValue = TdbShopVariantTypeValue::GetNewInstance();
                if ($oValue->LoadFromFields(
                    array('name' => $sNewValueName, 'shop_variant_type_id' => $sShopVariantTypeId)
                )
                ) {
                    $this->data[$sShopVariantTypeId] = $oValue->id;
                } else {
                    // need to create entry
                    $aNewItemData = array(
                        'shop_variant_type_id' => $sShopVariantTypeId,
                        'name' => $sNewValueName,
                        'url_name' => $this->getUrlNormalizationUtil()->normalizeUrl($sNewValueName),
                    );
                    $oTableManager = new TCMSTableEditorManager();
                    $oTableManager->Init($oEditorObjectConf->id);
                    $oTableManager->Save($aNewItemData);
                    $this->data[$sShopVariantTypeId] = $oTableManager->sId;
                }
            }
        }

        // now save connecting records.... we can use the parent method
        return parent::GetSQL();
    }
public function GetSQL()
    {
        /**
         * @var array $aNewValues
         */
        $aNewValues = $this->getInputFilterUtil()->getFilteredInput($this->name.'_new');

        if (!is_array($this->data)) {
            $this->data = array();
        } elseif (array_key_exists('x', $this->data)) {
            unset($this->data['x']);
        }

        $oEditorObjectConf = TdbCmsTblConf::GetNewInstance();
        $oEditorObjectConf->LoadFromField('name', 'shop_variant_type_value');

        if (!is_array($aNewValues)) {
            return false;
        }

        foreach ($aNewValues as $sShopVariantTypeId => $sNewValueName) {
            $sNewValueName = trim($sNewValueName);
            if (!empty($sNewValueName)) {
                // first make sure the value does not exist already
                $oValue = TdbShopVariantTypeValue::GetNewInstance();
                if ($oValue->LoadFromFields(
                    array('name' => $sNewValueName, 'shop_variant_type_id' => $sShopVariantTypeId)
                )
                ) {
                    $this->data[$sShopVariantTypeId] = $oValue->id;
                } else {
                    // need to create entry
                    $aNewItemData = array(
                        'shop_variant_type_id' => $sShopVariantTypeId,
                        'name' => $sNewValueName,
                        'url_name' => $this->getUrlNormalizationUtil()->normalizeUrl($sNewValueName),
                    );
                    $oTableManager = new TCMSTableEditorManager();
                    $oTableManager->Init($oEditorObjectConf->id);
                    $oTableManager->Save($aNewItemData);
                    $this->data[$sShopVariantTypeId] = $oTableManager->sId;
                }
            }
        }

        // now save connecting records.... we can use the parent method
        return parent::GetSQL();
    }
public function GetSQL ( ) { /**
         * @var array $aNewValues
         */ $ aNewValues = $ this -> getInputFilterUtil ( ) -> getFilteredInput ( $ this -> name . '_new' ) ; if ( ! is_array ( $ this -> data ) ) { $ this -> data = array ( ) ; } elseif ( array_key_exists ( 'x' , $ this -> data ) ) { unset ( $ this -> data [ 'x' ] ) ; } $ oEditorObjectConf = TdbCmsTblConf :: GetNewInstance ( ) ; $ oEditorObjectConf -> LoadFromField ( 'name' , 'shop_variant_type_value' ) ; if ( ! is_array ( $ aNewValues ) ) { return false ; } foreach ( $ aNewValues as $ sShopVariantTypeId => $ sNewValueName ) { $ sNewValueName = trim ( $ sNewValueName ) ; if ( ! empty ( $ sNewValueName ) ) { // first make sure the value does not exist already $ oValue = TdbShopVariantTypeValue :: GetNewInstance ( ) ; if ( $ oValue -> LoadFromFields ( array ( 'name' => $ sNewValueName , 'shop_variant_type_id' => $ sShopVariantTypeId ) ) ) { $ this -> data [ $ sShopVariantTypeId ] = $ oValue -> id ; } else { // need to create entry $ aNewItemData = array ( 'shop_variant_type_id' => $ sShopVariantTypeId , 'name' => $ sNewValueName , 'url_name' => $ this -> getUrlNormalizationUtil ( ) -> normalizeUrl ( $ sNewValueName ) , ) ; $ oTableManager = new TCMSTableEditorManager ( ) ; $ oTableManager -> Init ( $ oEditorObjectConf -> id ) ; $ oTableManager -> Save ( $ aNewItemData ) ; $ this -> data [ $ sShopVariantTypeId ] = $ oTableManager -> sId ; } } } // now save connecting records.... we can use the parent method return parent :: GetSQL ( ) ; }
overwrites sql method to ensure that the connecting mlt is filled properly.

{@inheritdoc}
overwrites sql method to ensure that the connecting mlt is filled properly .