public function createValueHolder($apply_default_values = false)
    {
        if (!$this->value_holder_implementor) {
            $implementor = $this->hasOption(self::OPTION_VALUE_HOLDER)
                ? $this->getOption(self::OPTION_VALUE_HOLDER)
                : $this->buildDefaultValueHolderClassName();

            if (!class_exists($implementor)) {
                throw new InvalidConfigException(
                    sprintf(
                        "Invalid valueholder implementor '%s' configured for attribute '%s' on entity '%s'.",
                        $implementor,
                        $this->getName(),
                        $this->getType() ? $this->getType()->getName() : 'undefined'
                    )
                );
            }

            $test_value_holder = new $implementor($this);

            if (!$test_value_holder instanceof ValueHolderInterface) {
                throw new InvalidTypeException(
                    sprintf(
                        "Invalid valueholder implementation '%s' given for attribute '%s' on entity type '%s'. " .
                        "Make sure to implement '%s'.",
                        $implementor,
                        $this->getName(),
                        $this->getType() ? $this->getType()->getName() : 'undefined',
                        ValueHolderInterface::CLASS
                    )
                );
            }

            $this->value_holder_implementor = $implementor;
        }

        $value_holder = new $this->value_holder_implementor($this);
        if ($apply_default_values === true) {
            $value_holder->setValue($this->getDefaultValue());
        } elseif ($apply_default_values === false) {
            $value_holder->setValue($this->getNullValue());
        } else {
            throw new InvalidTypeException(
                sprintf(
                    "Only boolean arguments are acceptable for attribute '%s' on entity type '%s'. ",
                    $this->getName(),
                    $this->getType() ? $this->getType()->getName() : 'undefined'
                )
            );
        }

        return $value_holder;
    }
public function createValueHolder($apply_default_values = false)
    {
        if (!$this->value_holder_implementor) {
            $implementor = $this->hasOption(self::OPTION_VALUE_HOLDER)
                ? $this->getOption(self::OPTION_VALUE_HOLDER)
                : $this->buildDefaultValueHolderClassName();

            if (!class_exists($implementor)) {
                throw new InvalidConfigException(
                    sprintf(
                        "Invalid valueholder implementor '%s' configured for attribute '%s' on entity '%s'.",
                        $implementor,
                        $this->getName(),
                        $this->getType() ? $this->getType()->getName() : 'undefined'
                    )
                );
            }

            $test_value_holder = new $implementor($this);

            if (!$test_value_holder instanceof ValueHolderInterface) {
                throw new InvalidTypeException(
                    sprintf(
                        "Invalid valueholder implementation '%s' given for attribute '%s' on entity type '%s'. " .
                        "Make sure to implement '%s'.",
                        $implementor,
                        $this->getName(),
                        $this->getType() ? $this->getType()->getName() : 'undefined',
                        ValueHolderInterface::CLASS
                    )
                );
            }

            $this->value_holder_implementor = $implementor;
        }

        $value_holder = new $this->value_holder_implementor($this);
        if ($apply_default_values === true) {
            $value_holder->setValue($this->getDefaultValue());
        } elseif ($apply_default_values === false) {
            $value_holder->setValue($this->getNullValue());
        } else {
            throw new InvalidTypeException(
                sprintf(
                    "Only boolean arguments are acceptable for attribute '%s' on entity type '%s'. ",
                    $this->getName(),
                    $this->getType() ? $this->getType()->getName() : 'undefined'
                )
            );
        }

        return $value_holder;
    }
public function createValueHolder ( $ apply_default_values = false ) { if ( ! $ this -> value_holder_implementor ) { $ implementor = $ this -> hasOption ( self :: OPTION_VALUE_HOLDER ) ? $ this -> getOption ( self :: OPTION_VALUE_HOLDER ) : $ this -> buildDefaultValueHolderClassName ( ) ; if ( ! class_exists ( $ implementor ) ) { throw new InvalidConfigException ( sprintf ( "Invalid valueholder implementor '%s' configured for attribute '%s' on entity '%s'." , $ implementor , $ this -> getName ( ) , $ this -> getType ( ) ? $ this -> getType ( ) -> getName ( ) : 'undefined' ) ) ; } $ test_value_holder = new $ implementor ( $ this ) ; if ( ! $ test_value_holder instanceof ValueHolderInterface ) { throw new InvalidTypeException ( sprintf ( "Invalid valueholder implementation '%s' given for attribute '%s' on entity type '%s'. " . "Make sure to implement '%s'." , $ implementor , $ this -> getName ( ) , $ this -> getType ( ) ? $ this -> getType ( ) -> getName ( ) : 'undefined' , ValueHolderInterface :: CLASS ) ) ; } $ this -> value_holder_implementor = $ implementor ; } $ value_holder = new $ this -> value_holder_implementor ( $ this ) ; if ( $ apply_default_values === true ) { $ value_holder -> setValue ( $ this -> getDefaultValue ( ) ) ; } elseif ( $ apply_default_values === false ) { $ value_holder -> setValue ( $ this -> getNullValue ( ) ) ; } else { throw new InvalidTypeException ( sprintf ( "Only boolean arguments are acceptable for attribute '%s' on entity type '%s'. " , $ this -> getName ( ) , $ this -> getType ( ) ? $ this -> getType ( ) -> getName ( ) : 'undefined' ) ) ; } return $ value_holder ; }
Creates a ValueHolderInterface, that is specific to the current attribute instance.

@return ValueHolderInterface
Creates a ValueHolderInterface that is specific to the current attribute instance .