public function setInverse($config = array())
    {
        $config = new AnConfig($config);

        if (!isset($this->_parent)) {
            throw new AnException('Can not have an inverse relationship with a polymorphic parent');
        }

        $config->append(array(
             'cardinality' => 'many',
        ));

        $config->append(array(
             'name' => (int) $config->cardinality == 1 ? $this->_child->name : AnInflector::pluralize($this->_child->name),
        ));

        $name = $config->name;
        $cardinality = $config->cardinality;
        unset($config['name']);
        unset($config['cardinality']);

        $config['child'] = $this->_child;
        $config['child_key'] = $this->_name;
        $config['type'] = 'has';
        $config['cardinality'] = $cardinality;

        $this->getParentRepository()->getDescription()
            ->setRelationship($name, AnConfig::unbox($config));
    }
public function setInverse($config = array())
    {
        $config = new AnConfig($config);

        if (!isset($this->_parent)) {
            throw new AnException('Can not have an inverse relationship with a polymorphic parent');
        }

        $config->append(array(
             'cardinality' => 'many',
        ));

        $config->append(array(
             'name' => (int) $config->cardinality == 1 ? $this->_child->name : AnInflector::pluralize($this->_child->name),
        ));

        $name = $config->name;
        $cardinality = $config->cardinality;
        unset($config['name']);
        unset($config['cardinality']);

        $config['child'] = $this->_child;
        $config['child_key'] = $this->_name;
        $config['type'] = 'has';
        $config['cardinality'] = $cardinality;

        $this->getParentRepository()->getDescription()
            ->setRelationship($name, AnConfig::unbox($config));
    }
public function setInverse ( $ config = array ( ) ) { $ config = new AnConfig ( $ config ) ; if ( ! isset ( $ this -> _parent ) ) { throw new AnException ( 'Can not have an inverse relationship with a polymorphic parent' ) ; } $ config -> append ( array ( 'cardinality' => 'many' , ) ) ; $ config -> append ( array ( 'name' => ( int ) $ config -> cardinality == 1 ? $ this -> _child -> name : AnInflector :: pluralize ( $ this -> _child -> name ) , ) ) ; $ name = $ config -> name ; $ cardinality = $ config -> cardinality ; unset ( $ config [ 'name' ] ) ; unset ( $ config [ 'cardinality' ] ) ; $ config [ 'child' ] = $ this -> _child ; $ config [ 'child_key' ] = $ this -> _name ; $ config [ 'type' ] = 'has' ; $ config [ 'cardinality' ] = $ cardinality ; $ this -> getParentRepository ( ) -> getDescription ( ) -> setRelationship ( $ name , AnConfig :: unbox ( $ config ) ) ; }
Set an invere relationship. ie. if x belongs to y, then y has at least one x.

@param array $config An array of configuration
Set an invere relationship . ie . if x belongs to y then y has at least one x .