public function objectMethods(PHP5ObjectBuilder $builder)
 {
     $script = "\n/**\n * In addition to checking if this object has been modified, it can also check if any of the related objects have been modified.\n *\n * @param bool \$check_relations\n * @return bool\n */\npublic function isModified(\$check_relations = false)\n{\n    if (!\$check_relations) {\n        return parent::isModified();\n    }\n\n    if (\$this->alreadyInModified) {\n        return null;\n    }\n\n    \$this->alreadyInModified = true;\n\n    \$modified = false;\n\n    if (parent::isModified()) {\n        \$modified = true;\n    } else {";
     $table = $builder->getTable();
     if (count($table->getForeignKeys())) {
         foreach ($table->getForeignKeys() as $fk) {
             $aVarName = $builder->getFKVarName($fk);
             $script .= "\n        if (\$this->{$aVarName} !== null) {\n            if (\$this->" . $aVarName . "->isModified() || \$this->" . $aVarName . "->isNew()) {\n                \$modified = true;\n            }\n        }";
         }
     }
     foreach ($table->getReferrers() as $refFK) {
         if ($refFK->isLocalPrimaryKey()) {
             $varName = $builder->getPKRefFKVarName($refFK);
             $script .= "\n        if (\$this->{$varName} !== null) {\n            if (\$this->{$varName}->isDeleted() || \$this->{$varName}->isNew() || \$this->{$varName}->isModified()) {\n                \$modified = true;\n            }\n        }\n                ";
         } else {
             //                $this->addRefFkScheduledForDeletion($script, $refFK);
             $collName = $builder->getRefFKCollVarName($refFK);
             $script .= "\n        if (\$this->{$collName} !== null) {\n            foreach (\$this->{$collName} as \$referrerFK) {\n                if (\$referrerFK->isDeleted() || \$referrerFK->isNew() || \$referrerFK->isModified()) {\n                    \$modified = true;\n                    break;\n                }\n            }\n        }";
         }
     }
     $script .= "\n    }\n\n    \$this->alreadyInModified = false;\n\n    return \$modified;\n}";
     return $script;
 }