traits/helpers/PriceHelperTrait.php
protected static function addPriceFiledMethods($obElement)
    {
        if (empty($obElement->arPriceField) || !is_array($obElement->arPriceField)) {
            return;
        }

        foreach ($obElement->arPriceField as $sFieldName) {
            if (empty($sFieldName) || !is_string($sFieldName)) {
                continue;
            }

            $sFieldConvert = Str::studly($sFieldName);

            self::addGetPriceFieldMethod($obElement, $sFieldName, $sFieldConvert);

            if ($obElement instanceof Model) {
                self::addSetPriceFieldMethod($obElement, $sFieldName, $sFieldConvert);
                self::addGetPriceValueFieldMethod($obElement, $sFieldName, $sFieldConvert);

                self::addScopePriceFieldMethod($obElement, $sFieldName, $sFieldConvert);
            }
        }
    }
protected static function addPriceFiledMethods($obElement)
    {
        if (empty($obElement->arPriceField) || !is_array($obElement->arPriceField)) {
            return;
        }

        foreach ($obElement->arPriceField as $sFieldName) {
            if (empty($sFieldName) || !is_string($sFieldName)) {
                continue;
            }

            $sFieldConvert = Str::studly($sFieldName);

            self::addGetPriceFieldMethod($obElement, $sFieldName, $sFieldConvert);

            if ($obElement instanceof Model) {
                self::addSetPriceFieldMethod($obElement, $sFieldName, $sFieldConvert);
                self::addGetPriceValueFieldMethod($obElement, $sFieldName, $sFieldConvert);

                self::addScopePriceFieldMethod($obElement, $sFieldName, $sFieldConvert);
            }
        }
    }
protected static function addPriceFiledMethods ( $ obElement ) { if ( empty ( $ obElement -> arPriceField ) || ! is_array ( $ obElement -> arPriceField ) ) { return ; } foreach ( $ obElement -> arPriceField as $ sFieldName ) { if ( empty ( $ sFieldName ) || ! is_string ( $ sFieldName ) ) { continue ; } $ sFieldConvert = Str :: studly ( $ sFieldName ) ; self :: addGetPriceFieldMethod ( $ obElement , $ sFieldName , $ sFieldConvert ) ; if ( $ obElement instanceof Model ) { self :: addSetPriceFieldMethod ( $ obElement , $ sFieldName , $ sFieldConvert ) ; self :: addGetPriceValueFieldMethod ( $ obElement , $ sFieldName , $ sFieldConvert ) ; self :: addScopePriceFieldMethod ( $ obElement , $ sFieldName , $ sFieldConvert ) ; } } }
Check arPriceField array and add price methods to model object
@param \Model|\Eloquent|\Lovata\Toolbox\Classes\Item\ElementItem $obElement $obElement
Check arPriceField array and add price methods to model object