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

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

        //determine the relationship type if not set
        //If name is sinuglar, then it's belongs 
        //If name is plurarl, then it's has
        if (empty($config['type'])) {
            if (AnInflector::isSingular($config['name'])) {
                $config['type'] = 'belongs_to';
            } else {
                $config['type'] = 'has';
            }
        }

        if ($config['type'] != 'has' && $config['type'] != 'belongs_to') {
            throw new AnDomainPropertyException("Incorrect relationship type specified: {$config->type}");
        }

        //create the relationship based on its type        
        if ($config['type'] == 'belongs_to') {
            $relationship = self::_belongsTo($config);
        } else {
            $relationship = self::_has($config);
        }

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

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

        //determine the relationship type if not set
        //If name is sinuglar, then it's belongs 
        //If name is plurarl, then it's has
        if (empty($config['type'])) {
            if (AnInflector::isSingular($config['name'])) {
                $config['type'] = 'belongs_to';
            } else {
                $config['type'] = 'has';
            }
        }

        if ($config['type'] != 'has' && $config['type'] != 'belongs_to') {
            throw new AnDomainPropertyException("Incorrect relationship type specified: {$config->type}");
        }

        //create the relationship based on its type        
        if ($config['type'] == 'belongs_to') {
            $relationship = self::_belongsTo($config);
        } else {
            $relationship = self::_has($config);
        }

        return $relationship;
    }
public static function setRelationship ( AnConfigInterface $ config ) { $ description = $ config -> description ; if ( ! $ description ) { throw new AnDomainPropertyException ( 'description [AnDomainDescriptionAbstract] option is required' ) ; } //determine the relationship type if not set //If name is sinuglar, then it's belongs  //If name is plurarl, then it's has if ( empty ( $ config [ 'type' ] ) ) { if ( AnInflector :: isSingular ( $ config [ 'name' ] ) ) { $ config [ 'type' ] = 'belongs_to' ; } else { $ config [ 'type' ] = 'has' ; } } if ( $ config [ 'type' ] != 'has' && $ config [ 'type' ] != 'belongs_to' ) { throw new AnDomainPropertyException ( "Incorrect relationship type specified: {$config->type}" ) ; } //create the relationship based on its type         if ( $ config [ 'type' ] == 'belongs_to' ) { $ relationship = self :: _belongsTo ( $ config ) ; } else { $ relationship = self :: _has ( $ config ) ; } return $ relationship ; }
Relationship factory method.

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

@return AnServiceInstantiatable
Relationship factory method .