public function addReference( PgAttribute $primaryKey, $includeChildTables = true )
    {

        $this->references->add( $primaryKey );
        $primaryKey->isReferencedBy->add( $this );

        if( $includeChildTables || true ) {
            foreach( $primaryKey->getRelation()->getChildren() as $child ) {
                $this->addReference($child->getAttributeByName($primaryKey->name), true);
            }
        }

        return;

        // TODO. Add support for inheritance
        $query = new Query(
            "SELECT oid::text || '.' || %attnum:int%::text FROM dev.relationDescendants( %oid:int%::oid ) as _ ( oid );",
            array(
                'attnum' => $pk->get('attnum'),
                'oid' => $pk->get('relation')->get('oid')
            )
        );

    }
public function addReference( PgAttribute $primaryKey, $includeChildTables = true )
    {

        $this->references->add( $primaryKey );
        $primaryKey->isReferencedBy->add( $this );

        if( $includeChildTables || true ) {
            foreach( $primaryKey->getRelation()->getChildren() as $child ) {
                $this->addReference($child->getAttributeByName($primaryKey->name), true);
            }
        }

        return;

        // TODO. Add support for inheritance
        $query = new Query(
            "SELECT oid::text || '.' || %attnum:int%::text FROM dev.relationDescendants( %oid:int%::oid ) as _ ( oid );",
            array(
                'attnum' => $pk->get('attnum'),
                'oid' => $pk->get('relation')->get('oid')
            )
        );

    }
public function addReference ( PgAttribute $ primaryKey , $ includeChildTables = true ) { $ this -> references -> add ( $ primaryKey ) ; $ primaryKey -> isReferencedBy -> add ( $ this ) ; if ( $ includeChildTables || true ) { foreach ( $ primaryKey -> getRelation ( ) -> getChildren ( ) as $ child ) { $ this -> addReference ( $ child -> getAttributeByName ( $ primaryKey -> name ) , true ) ; } } return ; // TODO. Add support for inheritance $ query = new Query ( "SELECT oid::text || '.' || %attnum:int%::text FROM dev.relationDescendants( %oid:int%::oid ) as _ ( oid );" , array ( 'attnum' => $ pk -> get ( 'attnum' ) , 'oid' => $ pk -> get ( 'relation' ) -> get ( 'oid' ) ) ) ; }
Add a reference to this attribute
@param Attribute $primaryKey The attribute we're referencing
Add a reference to this attribute