protected function addClearRelatedInstancePool(&$script)
    {
        $table = $this->getTable();
        $script .= "
    /**
     * Method to invalidate the instance pool of all tables related to " . $table->getName() . "
     * by a foreign key with ON DELETE CASCADE
     */
    public static function clearRelatedInstancePool()
    {";
        // Handle ON DELETE CASCADE for updating instance pool

        foreach ($table->getReferrers() as $fk) {

            // $fk is the foreign key in the other table, so localTableName will
            // actually be the table name of other table
            $tblFK = $fk->getTable();

            $joinedTablePeerBuilder = $this->getNewStubPeerBuilder($tblFK);
            $this->declareClassFromBuilder($joinedTablePeerBuilder);
            $tblFKPackage = $joinedTablePeerBuilder->getStubPeerBuilder()->getPackage();

            if (!$tblFK->isForReferenceOnly()) {
                // we can't perform operations on tables that are
                // not within the schema (i.e. that we have no map for, etc.)

                if ($fk->getOnDelete() == ForeignKey::CASCADE || $fk->getOnDelete() == ForeignKey::SETNULL) {
                    $script .= "
        // Invalidate objects in " . $joinedTablePeerBuilder->getClassname() . " instance pool,
        // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
        " . $joinedTablePeerBuilder->getClassname() . "::clearInstancePool();";
                } // if fk is on delete cascade
            } // if (! for ref only)
        } // foreach
        $script .= "
    }
";
    }
protected function addClearRelatedInstancePool(&$script)
    {
        $table = $this->getTable();
        $script .= "
    /**
     * Method to invalidate the instance pool of all tables related to " . $table->getName() . "
     * by a foreign key with ON DELETE CASCADE
     */
    public static function clearRelatedInstancePool()
    {";
        // Handle ON DELETE CASCADE for updating instance pool

        foreach ($table->getReferrers() as $fk) {

            // $fk is the foreign key in the other table, so localTableName will
            // actually be the table name of other table
            $tblFK = $fk->getTable();

            $joinedTablePeerBuilder = $this->getNewStubPeerBuilder($tblFK);
            $this->declareClassFromBuilder($joinedTablePeerBuilder);
            $tblFKPackage = $joinedTablePeerBuilder->getStubPeerBuilder()->getPackage();

            if (!$tblFK->isForReferenceOnly()) {
                // we can't perform operations on tables that are
                // not within the schema (i.e. that we have no map for, etc.)

                if ($fk->getOnDelete() == ForeignKey::CASCADE || $fk->getOnDelete() == ForeignKey::SETNULL) {
                    $script .= "
        // Invalidate objects in " . $joinedTablePeerBuilder->getClassname() . " instance pool,
        // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
        " . $joinedTablePeerBuilder->getClassname() . "::clearInstancePool();";
                } // if fk is on delete cascade
            } // if (! for ref only)
        } // foreach
        $script .= "
    }
";
    }
protected function addClearRelatedInstancePool ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= "
    /**
     * Method to invalidate the instance pool of all tables related to " . $ table -> getName ( ) . "
     * by a foreign key with ON DELETE CASCADE
     */
    public static function clearRelatedInstancePool()
    {" ; // Handle ON DELETE CASCADE for updating instance pool foreach ( $ table -> getReferrers ( ) as $ fk ) { // $fk is the foreign key in the other table, so localTableName will // actually be the table name of other table $ tblFK = $ fk -> getTable ( ) ; $ joinedTablePeerBuilder = $ this -> getNewStubPeerBuilder ( $ tblFK ) ; $ this -> declareClassFromBuilder ( $ joinedTablePeerBuilder ) ; $ tblFKPackage = $ joinedTablePeerBuilder -> getStubPeerBuilder ( ) -> getPackage ( ) ; if ( ! $ tblFK -> isForReferenceOnly ( ) ) { // we can't perform operations on tables that are // not within the schema (i.e. that we have no map for, etc.) if ( $ fk -> getOnDelete ( ) == ForeignKey :: CASCADE || $ fk -> getOnDelete ( ) == ForeignKey :: SETNULL ) { $ script .= "
        // Invalidate objects in " . $ joinedTablePeerBuilder -> getClassname ( ) . " instance pool,
        // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
        " . $ joinedTablePeerBuilder -> getClassname ( ) . "::clearInstancePool();" ; } // if fk is on delete cascade } // if (! for ref only) } // foreach $ script .= "
    }
" ; }
Adds method to clear the instance pool of related tables.

@param string &$script The script will be modified in this method.
Adds method to clear the instance pool of related tables .