public static function setAttribute(AnConfigInterface $config)
    {
        $description = $config->description;

        if (!$description) {
            throw new AnDomainAttributeException('description [AnDomainDescriptionAbstract] option is required');
        }

        if (empty($config->type)) {
            $config->append(array(
                'column' => AnInflector::underscore($config->name),
            ));

            $config->column = $description->getRepository()->getResources()->getColumn($config->column);

            if ($config->column) {
                $config->type = $config->column->type;
            } else {
                $config->type = 'string';
            }
        }

        //if a default options is set then
        //making the property requires allows using default options
        //for cases when a property is null unless stated otherwise
        if (isset($config->default)) {
            /*
            $config->append(array(
                    'required'=>true
            ));
            */
        }

        //prevents having a null value if
        //a default option is set or the require is set
        /*
        if ( $config->required || $config->default )
        {
            $config->append(array(
                    'required'	=> true,
                    'default' 	=> $config->type
            ));            
        }*/

        $config->append(array(
            'column' => AnInflector::underscore($config->name),
        ));

        if (is_string($config->column)) {
            $config->column = $description->getRepository()->getResources()->getColumn($config->column);
        }

        if (!$config->column) {
            throw new AnDomainPropertyException('Property '.$config->name.' is mapped to an invalid column for entity '.$description->getEntityIdentifier());
        }

        $property = AnDomainPropertyAbstract::getInstance('attribute.property', $config);

        if ($config->key) {
            $description->addIdentifyingProperty($property);
        }

        return $property;
    }
public static function setAttribute(AnConfigInterface $config)
    {
        $description = $config->description;

        if (!$description) {
            throw new AnDomainAttributeException('description [AnDomainDescriptionAbstract] option is required');
        }

        if (empty($config->type)) {
            $config->append(array(
                'column' => AnInflector::underscore($config->name),
            ));

            $config->column = $description->getRepository()->getResources()->getColumn($config->column);

            if ($config->column) {
                $config->type = $config->column->type;
            } else {
                $config->type = 'string';
            }
        }

        //if a default options is set then
        //making the property requires allows using default options
        //for cases when a property is null unless stated otherwise
        if (isset($config->default)) {
            /*
            $config->append(array(
                    'required'=>true
            ));
            */
        }

        //prevents having a null value if
        //a default option is set or the require is set
        /*
        if ( $config->required || $config->default )
        {
            $config->append(array(
                    'required'	=> true,
                    'default' 	=> $config->type
            ));            
        }*/

        $config->append(array(
            'column' => AnInflector::underscore($config->name),
        ));

        if (is_string($config->column)) {
            $config->column = $description->getRepository()->getResources()->getColumn($config->column);
        }

        if (!$config->column) {
            throw new AnDomainPropertyException('Property '.$config->name.' is mapped to an invalid column for entity '.$description->getEntityIdentifier());
        }

        $property = AnDomainPropertyAbstract::getInstance('attribute.property', $config);

        if ($config->key) {
            $description->addIdentifyingProperty($property);
        }

        return $property;
    }
public static function setAttribute ( AnConfigInterface $ config ) { $ description = $ config -> description ; if ( ! $ description ) { throw new AnDomainAttributeException ( 'description [AnDomainDescriptionAbstract] option is required' ) ; } if ( empty ( $ config -> type ) ) { $ config -> append ( array ( 'column' => AnInflector :: underscore ( $ config -> name ) , ) ) ; $ config -> column = $ description -> getRepository ( ) -> getResources ( ) -> getColumn ( $ config -> column ) ; if ( $ config -> column ) { $ config -> type = $ config -> column -> type ; } else { $ config -> type = 'string' ; } } //if a default options is set then //making the property requires allows using default options //for cases when a property is null unless stated otherwise if ( isset ( $ config -> default ) ) { /*
            $config->append(array(
                    'required'=>true
            ));
            */ } //prevents having a null value if //a default option is set or the require is set /*
        if ( $config->required || $config->default )
        {
            $config->append(array(
                    'required'	=> true,
                    'default' 	=> $config->type
            ));            
        }*/ $ config -> append ( array ( 'column' => AnInflector :: underscore ( $ config -> name ) , ) ) ; if ( is_string ( $ config -> column ) ) { $ config -> column = $ description -> getRepository ( ) -> getResources ( ) -> getColumn ( $ config -> column ) ; } if ( ! $ config -> column ) { throw new AnDomainPropertyException ( 'Property ' . $ config -> name . ' is mapped to an invalid column for entity ' . $ description -> getEntityIdentifier ( ) ) ; } $ property = AnDomainPropertyAbstract :: getInstance ( 'attribute.property' , $ config ) ; if ( $ config -> key ) { $ description -> addIdentifyingProperty ( $ property ) ; } return $ property ; }
Attribute factory method.

@param AnConfigInterface $config An optional AnConfig object with configuration options

@return AnServiceInstantiatable
Attribute factory method .