private function generateGetSetLinksCallback( &$get, &$set, $name, $link )
    {

        foreach( $link->foreignEntities as $foreignEntity ) {

            $nameForeignEntity = $this->getSetAlias( "{$foreignEntity}s", 'data' );

            $this->additionalProperties[] = $nameForeignEntity;

            $this->class->addUses('Bond\\Repository');
            $this->class->addUses( 'Bond\\Entity\\StaticMethods' );

            // we got a ranking column?
            $sort = '';
            if( isset( $link->linkSortColumn ) ) {
                $sort = sprintf(
                    "->sortByProperty('%s')",
                    addslashes( $link->linkSortColumn )
                );
            }

            // get
            $getCaseStatement = explode( "\n", sprintf( <<<CASE
case '%s':
    return Repository::linksGet( \$this, '%s', '%s', null, true )%s;\n
CASE
                ,
                $nameForeignEntity,
                $name,
                $foreignEntity,
                $sort
            ));

            $get = array_merge( $get, $getCaseStatement );

            // set
            $setCaseStatement = explode( "\n", sprintf( <<<CASE
case '%s':
    return StaticMethods::set_links( \$this, '%s', \$value );\n
CASE
                ,
                $nameForeignEntity,
                $name
            ));

            $set = array_merge( $set, $setCaseStatement );

        }

    }