protected function addMutatorCloseBody(&$script, Column $column)
    {
        $table = $this->getTable();

        if ($column->isForeignKey()) {

            foreach ($column->getForeignKeys() as $fk) {

                $tblFK =  $table->getDatabase()->getTable($fk->getForeignTableName());
                $colFK = $tblFK->getColumn($fk->getMappedForeignColumn($column->getName()));

                if (!$colFK) {
                    continue;
                }

                $varName = $this->getFKVarName($fk);

                $script .= "
        if (\$this->$varName !== null && \$this->".$varName."->get".$colFK->getPhpName()."() !== \$v) {
            \$this->$varName = null;
        }
";
            } // foreach fk
        } /* if col is foreign key */

        foreach ($column->getReferrers() as $refFK) {

            $tblFK = $this->getDatabase()->getTable($refFK->getForeignTableName());

            if ( $tblFK->getName() != $table->getName() ) {

                foreach ($column->getForeignKeys() as $fk) {

                    $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
                    $colFK = $tblFK->getColumn($fk->getMappedForeignColumn($column->getName()));

                    if ($refFK->isLocalPrimaryKey()) {
                        $varName = $this->getPKRefFKVarName($refFK);
                        $script .= "
        // update associated ".$tblFK->getPhpName()."
        if (\$this->$varName !== null) {
            \$this->{$varName}->set".$colFK->getPhpName()."(\$v);
        }
";
                    } else {
                        $collName = $this->getRefFKCollVarName($refFK);
                        $script .= "

        // update associated ".$tblFK->getPhpName()."
        if (\$this->$collName !== null) {
            foreach (\$this->$collName as \$referrerObject) {
                    \$referrerObject->set".$colFK->getPhpName()."(\$v);
                }
            }
";
                    } // if (isLocalPrimaryKey
                } // foreach col->getPrimaryKeys()
            } // if tablFk != table
        } // foreach
    }
protected function addMutatorCloseBody(&$script, Column $column)
    {
        $table = $this->getTable();

        if ($column->isForeignKey()) {

            foreach ($column->getForeignKeys() as $fk) {

                $tblFK =  $table->getDatabase()->getTable($fk->getForeignTableName());
                $colFK = $tblFK->getColumn($fk->getMappedForeignColumn($column->getName()));

                if (!$colFK) {
                    continue;
                }

                $varName = $this->getFKVarName($fk);

                $script .= "
        if (\$this->$varName !== null && \$this->".$varName."->get".$colFK->getPhpName()."() !== \$v) {
            \$this->$varName = null;
        }
";
            } // foreach fk
        } /* if col is foreign key */

        foreach ($column->getReferrers() as $refFK) {

            $tblFK = $this->getDatabase()->getTable($refFK->getForeignTableName());

            if ( $tblFK->getName() != $table->getName() ) {

                foreach ($column->getForeignKeys() as $fk) {

                    $tblFK = $table->getDatabase()->getTable($fk->getForeignTableName());
                    $colFK = $tblFK->getColumn($fk->getMappedForeignColumn($column->getName()));

                    if ($refFK->isLocalPrimaryKey()) {
                        $varName = $this->getPKRefFKVarName($refFK);
                        $script .= "
        // update associated ".$tblFK->getPhpName()."
        if (\$this->$varName !== null) {
            \$this->{$varName}->set".$colFK->getPhpName()."(\$v);
        }
";
                    } else {
                        $collName = $this->getRefFKCollVarName($refFK);
                        $script .= "

        // update associated ".$tblFK->getPhpName()."
        if (\$this->$collName !== null) {
            foreach (\$this->$collName as \$referrerObject) {
                    \$referrerObject->set".$colFK->getPhpName()."(\$v);
                }
            }
";
                    } // if (isLocalPrimaryKey
                } // foreach col->getPrimaryKeys()
            } // if tablFk != table
        } // foreach
    }
protected function addMutatorCloseBody ( & $ script , Column $ column ) { $ table = $ this -> getTable ( ) ; if ( $ column -> isForeignKey ( ) ) { foreach ( $ column -> getForeignKeys ( ) as $ fk ) { $ tblFK = $ table -> getDatabase ( ) -> getTable ( $ fk -> getForeignTableName ( ) ) ; $ colFK = $ tblFK -> getColumn ( $ fk -> getMappedForeignColumn ( $ column -> getName ( ) ) ) ; if ( ! $ colFK ) { continue ; } $ varName = $ this -> getFKVarName ( $ fk ) ; $ script .= "
        if (\$this->$varName !== null && \$this->" . $ varName . "->get" . $ colFK -> getPhpName ( ) . "() !== \$v) {
            \$this->$varName = null;
        }
" ; } // foreach fk } /* if col is foreign key */ foreach ( $ column -> getReferrers ( ) as $ refFK ) { $ tblFK = $ this -> getDatabase ( ) -> getTable ( $ refFK -> getForeignTableName ( ) ) ; if ( $ tblFK -> getName ( ) != $ table -> getName ( ) ) { foreach ( $ column -> getForeignKeys ( ) as $ fk ) { $ tblFK = $ table -> getDatabase ( ) -> getTable ( $ fk -> getForeignTableName ( ) ) ; $ colFK = $ tblFK -> getColumn ( $ fk -> getMappedForeignColumn ( $ column -> getName ( ) ) ) ; if ( $ refFK -> isLocalPrimaryKey ( ) ) { $ varName = $ this -> getPKRefFKVarName ( $ refFK ) ; $ script .= "
        // update associated " . $ tblFK -> getPhpName ( ) . "
        if (\$this->$varName !== null) {
            \$this->{$varName}->set" . $ colFK -> getPhpName ( ) . "(\$v);
        }
" ; } else { $ collName = $ this -> getRefFKCollVarName ( $ refFK ) ; $ script .= "

        // update associated " . $ tblFK -> getPhpName ( ) . "
        if (\$this->$collName !== null) {
            foreach (\$this->$collName as \$referrerObject) {
                    \$referrerObject->set" . $ colFK -> getPhpName ( ) . "(\$v);
                }
            }
" ; } // if (isLocalPrimaryKey } // foreach col->getPrimaryKeys() } // if tablFk != table } // foreach }
Adds the body of the close part of a mutator.

@param string &$script
@param Column $column
Adds the body of the close part of a mutator .