Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge with Propel/master

  • Loading branch information...
commit fb30d630a5a0a54ebb81b4a9ba2b45a9b271de6c 2 parents 9df7198 + 8b02639
@rozwell authored
Showing with 26,492 additions and 25,580 deletions.
  1. +1 −0  .gitignore
  2. +130 −0 CHANGELOG
  3. +5 −3 composer.json
  4. +17 −14 generator/bin/phing.php
  5. +32 −55 generator/bin/propel-gen
  6. +1 −1  generator/build.properties-sample
  7. +2 −1  generator/default.properties
  8. +78 −78 generator/lib/behavior/AlternativeCodingStandardsBehavior.php
  9. +31 −31 generator/lib/behavior/AutoAddPkBehavior.php
  10. +107 −105 generator/lib/behavior/DelegateBehavior.php
  11. +278 −271 generator/lib/behavior/SoftDeleteBehavior.php
  12. +123 −94 generator/lib/behavior/TimestampableBehavior.php
  13. +125 −111 generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php
  14. +151 −143 generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php
  15. +5 −4 generator/lib/behavior/aggregate_column/templates/objectCompute.php
  16. +6 −0 generator/lib/behavior/aggregate_column/templates/objectPostSave.php
  17. +2 −2 generator/lib/behavior/aggregate_column/templates/objectUpdate.php
  18. +9 −7 generator/lib/behavior/aggregate_column/templates/objectUpdateRelated.php
  19. +11 −11 generator/lib/behavior/aggregate_column/templates/queryFindRelated.php
  20. +4 −4 generator/lib/behavior/aggregate_column/templates/queryUpdateRelated.php
  21. +201 −199 generator/lib/behavior/archivable/ArchivableBehavior.php
  22. +182 −171 generator/lib/behavior/archivable/ArchivableBehaviorObjectBuilderModifier.php
  23. +94 −92 generator/lib/behavior/archivable/ArchivableBehaviorQueryBuilderModifier.php
  24. +29 −29 generator/lib/behavior/archivable/templates/objectArchive.php
  25. +14 −13 generator/lib/behavior/archivable/templates/objectDeleteWithoutArchive.php
  26. +19 −19 generator/lib/behavior/archivable/templates/objectGetArchive.php
  27. +31 −32 generator/lib/behavior/archivable/templates/objectPopulateFromArchive.php
  28. +17 −17 generator/lib/behavior/archivable/templates/objectPreDelete.php
  29. +20 −20 generator/lib/behavior/archivable/templates/objectRestoreFromArchive.php
  30. +28 −28 generator/lib/behavior/archivable/templates/objectSaveWithoutArchive.php
  31. +43 −42 generator/lib/behavior/archivable/templates/queryArchive.php
  32. +28 −28 generator/lib/behavior/archivable/templates/queryDeleteWithoutArchive.php
  33. +10 −10 generator/lib/behavior/archivable/templates/querySetArchiveOnDelete.php
  34. +10 −10 generator/lib/behavior/archivable/templates/querySetArchiveOnUpdate.php
  35. +16 −16 generator/lib/behavior/archivable/templates/queryUpdateWithoutArchive.php
  36. +202 −196 generator/lib/behavior/concrete_inheritance/ConcreteInheritanceBehavior.php
  37. +44 −43 generator/lib/behavior/concrete_inheritance/ConcreteInheritanceParentBehavior.php
  38. +258 −244 generator/lib/behavior/i18n/I18nBehavior.php
  39. +193 −188 generator/lib/behavior/i18n/I18nBehaviorObjectBuilderModifier.php
  40. +10 −10 generator/lib/behavior/i18n/I18nBehaviorPeerBuilderModifier.php
  41. +50 −47 generator/lib/behavior/i18n/I18nBehaviorQueryBuilderModifier.php
  42. +1 −1  generator/lib/behavior/i18n/templates/objectClearReferences.php
  43. +1 −1  generator/lib/behavior/i18n/templates/objectGetCurrentTranslation.php
  44. +1 −1  generator/lib/behavior/i18n/templates/objectGetLocale.php
  45. +1 −1  generator/lib/behavior/i18n/templates/objectGetLocaleAlias.php
  46. +22 −21 generator/lib/behavior/i18n/templates/objectGetTranslation.php
  47. +2 −2 generator/lib/behavior/i18n/templates/objectPostDelete.php
  48. +15 −15 generator/lib/behavior/i18n/templates/objectRemoveTranslation.php
  49. +2 −2 generator/lib/behavior/i18n/templates/objectSetLocale.php
  50. +1 −1  generator/lib/behavior/i18n/templates/objectSetLocaleAlias.php
  51. +4 −4 generator/lib/behavior/i18n/templates/objectSetTranslation.php
  52. +2 −1  generator/lib/behavior/i18n/templates/objectTranslatedColumnGetter.php
  53. +2 −2 generator/lib/behavior/i18n/templates/objectTranslatedColumnSetter.php
  54. +5 −4 generator/lib/behavior/i18n/templates/queryJoinI18n.php
  55. +6 −5 generator/lib/behavior/i18n/templates/queryJoinWithI18n.php
  56. +3 −3 generator/lib/behavior/i18n/templates/queryUseI18nQuery.php
  57. +69 −70 generator/lib/behavior/nestedset/NestedSetBehavior.php
  58. +899 −883 generator/lib/behavior/nestedset/NestedSetBehaviorObjectBuilderModifier.php
  59. +395 −394 generator/lib/behavior/nestedset/NestedSetBehaviorPeerBuilderModifier.php
  60. +194 −194 generator/lib/behavior/nestedset/NestedSetBehaviorQueryBuilderModifier.php
  61. +193 −188 generator/lib/behavior/query_cache/QueryCacheBehavior.php
  62. +213 −199 generator/lib/behavior/sluggable/SluggableBehavior.php
  63. +54 −51 generator/lib/behavior/sortable/SortableBehavior.php
  64. +409 −403 generator/lib/behavior/sortable/SortableBehaviorObjectBuilderModifier.php
  65. +222 −222 generator/lib/behavior/sortable/SortableBehaviorPeerBuilderModifier.php
  66. +160 −160 generator/lib/behavior/sortable/SortableBehaviorQueryBuilderModifier.php
  67. +230 −227 generator/lib/behavior/versionable/VersionableBehavior.php
  68. +476 −410 generator/lib/behavior/versionable/VersionableBehaviorObjectBuilderModifier.php
  69. +28 −28 generator/lib/behavior/versionable/VersionableBehaviorPeerBuilderModifier.php
  70. +68 −68 generator/lib/behavior/versionable/VersionableBehaviorQueryBuilderModifier.php
  71. +613 −590 generator/lib/builder/DataModelBuilder.php
  72. +119 −111 generator/lib/builder/om/ClassTools.php
  73. +99 −95 generator/lib/builder/om/ExtensionQueryBuilder.php
  74. +96 −95 generator/lib/builder/om/ExtensionQueryInheritanceBuilder.php
  75. +572 −506 generator/lib/builder/om/OMBuilder.php
  76. +186 −178 generator/lib/builder/om/ObjectBuilder.php
  77. +53 −53 generator/lib/builder/om/PHP5ExtensionNodeBuilder.php
  78. +53 −53 generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php
  79. +82 −79 generator/lib/builder/om/PHP5ExtensionObjectBuilder.php
  80. +92 −89 generator/lib/builder/om/PHP5ExtensionPeerBuilder.php
  81. +52 −52 generator/lib/builder/om/PHP5InterfaceBuilder.php
  82. +152 −151 generator/lib/builder/om/PHP5MultiExtendObjectBuilder.php
  83. +1,045 −1,024 generator/lib/builder/om/PHP5NestedSetBuilder.php
  84. +1,631 −1,619 generator/lib/builder/om/PHP5NestedSetPeerBuilder.php
  85. +1,004 −1,028 generator/lib/builder/om/PHP5NodeBuilder.php
  86. +660 −676 generator/lib/builder/om/PHP5NodePeerBuilder.php
  87. +5,518 −5,228 generator/lib/builder/om/PHP5ObjectBuilder.php
  88. +899 −885 generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php
  89. +2,764 −2,721 generator/lib/builder/om/PHP5PeerBuilder.php
  90. +297 −298 generator/lib/builder/om/PHP5TableMapBuilder.php
  91. +262 −256 generator/lib/builder/om/PeerBuilder.php
  92. +1,404 −1,337 generator/lib/builder/om/QueryBuilder.php
  93. +222 −219 generator/lib/builder/om/QueryInheritanceBuilder.php
  94. +225 −227 generator/lib/builder/sql/DataSQLBuilder.php
  95. +15 −14 generator/lib/builder/sql/mssql/MssqlDataSQLBuilder.php
  96. +81 −78 generator/lib/builder/sql/pgsql/PgsqlDataSQLBuilder.php
  97. +14 −13 generator/lib/builder/sql/sqlite/SqliteDataSQLBuilder.php
  98. +22 −22 generator/lib/builder/sql/sqlsrv/SqlsrvDataSQLBuilder.php
  99. +9 −9 generator/lib/builder/util/DefaultEnglishPluralizer.php
  100. +6 −6 generator/lib/builder/util/Pluralizer.php
  101. +70 −69 generator/lib/builder/util/PropelStringReader.php
  102. +66 −66 generator/lib/builder/util/PropelTemplate.php
  103. +124 −123 generator/lib/builder/util/StandardEnglishPluralizer.php
  104. +379 −375 generator/lib/builder/util/XmlToAppData.php
  105. +228 −227 generator/lib/builder/util/XmlToDataSQL.php
  106. +297 −288 generator/lib/config/GeneratorConfig.php
  107. +36 −36 generator/lib/config/GeneratorConfigInterface.php
  108. +161 −158 generator/lib/config/QuickGeneratorConfig.php
  109. +309 −299 generator/lib/model/AppData.php
  110. +280 −277 generator/lib/model/Behavior.php
Sorry, we could not display the entire diff because too many files (467) changed.
View
1  .gitignore
@@ -6,3 +6,4 @@ test/fixtures/schemas/build/
test/fixtures/treetest/build/
vendor/
composer.lock
+composer.phar
View
130 CHANGELOG
@@ -1,5 +1,135 @@
# Changelog Of The Propel 1.6 Branch #
+## 2012-07-30: Version 1.6.7 ##
+
+38cfc9e Update generator/build.properties-sample
+f90dfa9 fix for issue 425
+74ee4e1 fix for issue 425
+88e21e6 Avoid blank line in object stub class
+8709d3a Fix tests
+cefc9ef More CS fixes
+e1e1078 Fix doc blocks
+29c9db3 Fix NULL => null
+3c1717b Improve code generation to follow PSR recommendations
+6bae0ca Changed FIXME to TODO
+bfef0d7 Changed comments
+5e9dfc1 PropelSQLParser with delimiter and fixed tests
+39d7958 fix for issue 425
+9667675 SQL Parser Delimiter Tests
+8cafbd6 Merge remote-tracking branch 'upstream/master' into delimiter-trigger-parser
+5522fbf fix test to pass on platform with EOF != \n
+cad1ac6 fix test 2 new relations added to book ;) for issue #421
+a9097da this fix issue #409 thank to toaotc for the patch
+2ca7067 add test to prove issue #409
+e84c67c add chaining in PropelObjectCollection::toKeyValue
+5dd5394 Revert "Fix platform loading" as it breaks multiple builds using the runtime config
+55fef69 Fix regression that removed Persistent interfaces in base classes
+d87e9a5 Add test that prove a regression
+7c7a608 Fix composer config
+c476e50 Add generator classes to the classmap
+0d1515d Added column positioning ability to mysql migration
+66e7a59 fixes translateFieldname and concrete inheritance
+3c891ed add test to show the inheritance issue with php5.4
+66f91c9 Fix platform loading
+2874edb fix call on a non object ;)
+790b3e4 [aggregate_column behavior] computeCall call reduced from n+1 to 1 or 2 fix #403, add computeCall on main object save() add isAlreadyInSave(),
+ddd028c add test to prove to much query on aggregate_column behavior
+c36fc7f Add back previous include but change the order of the include path
+c107e8e Issue #388: Fix propel-gen path issues Fixes an issue with the check for the propel-gen home-path in propel-gen script Fixes an issue with classes being redeclared because of custom include in phing.php (code is not there in the phing.php version from phing itself)
+9731032 Fix collection cache overriding existing one when related object are fetched with criteria
+f371602 Fix data loss where parent object won't save related objects when fetched with criteria
+3a3ad2c Fixed Versionable Object Modifier not to reload object collection after populateFromVersion
+dde4460 Fix joining related object
+abc7fc8 Change ObjectBuilder to reload related objects when collection is partially loaded
+05b7e1d Fixed possible bug
+5d9517a Improved SQLParser to work with triggers in additional .sql files
+
+## 2012-07-02: Version 1.6.6 ##
+
+17edd0f Prepare 1.6.6 release
+f15d36d Added defaultValue support for type ARRAY
+3fc74cc Added tests for setIgnoreCase() method
+b03569a Fixed package path if no parent package found
+ec4ea3d [NestedSet] Fixed CS
+b100492 Fixed small memory leak. Closes #358
+efb2b4a Added limit to phing version. It's now >= 2.4.12, but just for 2.4.* versions.
+1f74be0 Better composer constraint, fixes #387
+da1e6ce Fixed bin scripts
+b41b746 Cosmetic changes
+62fd2bf fix regressions introduced in 841d477db7
+841d477 add @throws and @return where missing
+94aae82 fix several generated phpDoc, missing declarations
+66f9eda Fixed CS for sluggable behavior
+e76f854 add sluggable scope schema
+a0e7463 add test for sluggable with scope and alter make unique in behavior to include scope
+ec0a762 added support for scope_column
+3b34b07 add test for sluggable with scope and alter make unique in behavior to include scope
+dd1ce76 tweak for proper php format
+f32733f added support for scope_column
+a051a60 Fixed CS
+ca773b3 fix several phpDoc and type hints
+0661d18 fix #378 change for self::PEER
+70e572b add enforceVersioning
+3b15493 Fixed propel-gen script
+3849529 [Timestampable] Maded 'updated_at' column optional using a parameter. Fixes #370
+ee711c7 Added bin-info in the composer Added bin-feature as described on http://getcomposer.org/doc/articles/vendor-bins.md
+88b8b48 fix remove one-to-many, add test for one-to-mmany
+a5d3096 fix rebase code duplication
+a1f26b5 fix setter one-to-many schedule for deletion, fix remove many-to-many
+b1f993a fix CS
+d57ae1e fix-m2m-schedule-for-deletion
+f511569 [Runtime] Avoided possibility issue
+e074ecf [Runtime] Avoided BC break
+f9ae6da [Runtime] Fixed PropelObjectFormatter for 1-N relations thanks to @fabeat
+d636134 [Versionable] Added missing use statement
+1c5c378 Fixed bad indentation
+56025fa [Timestampable] Disabled update_at column if versionable is used on the same table. Closes #362
+afad075 Fixed CS according to PSR-1, and PSR-2
+afd35b4 [test] [generator] fixed test suite for XmlToAppData class.
+1b3389c [test] [generator] fixed test suite according to last changes in previous commit.
+ddde376 [generator] fixed the skipSql attribute value when exported to XML.
+2710aa6 Fixed composer autoloading
+9016436 [Archivable] Fixed file format (unix instead of dos), fixed issue with namespaces
+8b9449a fix: Illegal offset type in /propel/runtime/lib/collection/PropelObjectCollection.php line 222
+84d4c66 fix a wrong var name => , close #350
+4f637d8 Adjusted last commit
+c614915 Fix some typo (thanks to havvg and willdurand)
+76e5eca Fixed ARRAY columns in hydrate() method
+4db2d79 Add a little set of features in the README.md
+c0af4bd Added new schema for setPk tests
+da9bad3 line back.
+5615f71 unit tests for pre-defined key type
+f209122 new method `getDefaultKeyType` for PHP5ObjectBuilder provided. checks if `defaultKeyType` parameter provided. if not returns `TYPE_PHPNAME` by default. unit test for `getDefaultKeyType`
+359cd80 added default key type for object builder. could be re-defined in project configuration. default key name is 'phpName'
+f747823 Fixed Table::setInterface(), Table::getInterface() usages
+1fd5b18 Added test to prove #318
+108a0b7 added cross ref table to schema and code to BookstoreTest to test patched cross ref setter
+2097c08 Updates to PropelMigrationTask to better handle multiple datasources.
+84b49eb patched addCrossFKSet: use cross FK related name and check if object in current collection
+c3e9bbd Added test to prove #321
+e388798 Fixed SimpleArrayFormatter. Closes #338
+d15c389 Fixed problem when pk already exists on parent table
+3d68575 [Generator] Added more methods to the GeneratorConfigInterface, allowed to load behaviors from a QuickGeneratorConfig instance
+db47b84 Fixed setting PK on child objects of concrete-inheritance
+d6506a5 Fixed propel-gen
+bfa9f14 [Runtime] [ModelCriteria] Allowed insensitive case for column names
+94d8c3f [Generator/Tests] Updated paths
+ee23c82 [composer] Used phing/phing 2.4.12
+678676a Add: support for EXPLAIN queries in postgres
+8280f6e Fixed license, added a README
+21bdf18 [Tests] Fixed db settings
+64a5f40 Added bootstrap.php file for phpunit
+58c4861 Fixed travis-ci setup
+44b6d26 [Tests] [Fixtures] Fixed default database settings
+2b0d0a9 Updated gitignore
+8927b97 Added travis-ci file
+39d0a88 Added a way to autoload Phing classes using composer
+ee007fa Added branch alias to composer.json
+21ceeeb Updated the composer.json file
+60b4c05 create version when deleting many-to-many refs
+22fec05 cs corrections
+eac4262 fix #320 reverse engineering : select tablename can returns quoted name on mssql
+
## 2012-03-27: Version 1.6.5 ##
cd69910 Preparing the 1.6.5 release
View
8 composer.json
@@ -10,15 +10,17 @@
"homepage": "http://www.willdurand.fr"
}],
"autoload": {
- "classmap": ["runtime/lib/"]
+ "classmap": ["runtime/lib", "generator/lib"]
},
+ "include-path": ["runtime/lib", "generator/lib"],
"require": {
"php": ">=5.2.4",
- "phing/phing": "2.4.*"
+ "phing/phing": ">=2.4.12,2.4.*"
},
"extra": {
"branch-alias": {
"dev-master": "1.6-dev"
}
- }
+ },
+ "bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"]
}
View
31 generator/bin/phing.php
@@ -11,24 +11,33 @@
// Set any INI options for PHP
// ---------------------------
-if (file_exists($file = dirname(__FILE__) . '/../../vendor/.composer/autoload.php')) {
- set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../vendor/phing/phing/classes');
-
- require_once $file;
+$dirname = dirname(__FILE__);
+$autolaoded = false;
+foreach (array($dirname . '/../../', $dirname . '/../../../../../') as $dir) {
+ if (file_exists($file = realpath($dir) . '/vendor/autoload.php')) {
+ set_include_path($dir . '/vendor/phing/phing/classes' . PATH_SEPARATOR . get_include_path() );
+ include_once $file;
+
+ $autoloaded = true;
+ break;
+ }
}
/* set classpath */
if (getenv('PHP_CLASSPATH')) {
- if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); }
- ini_set('include_path', PHP_CLASSPATH);
+ if (!defined('PHP_CLASSPATH')) {
+ define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path());
+ }
+ ini_set('include_path', PHP_CLASSPATH);
} else {
- if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', get_include_path()); }
+ if (!defined('PHP_CLASSPATH')) {
+ define('PHP_CLASSPATH', get_include_path());
+ }
}
require_once 'phing/Phing.php';
try {
-
/* Setup Phing environment */
Phing::startup();
@@ -45,18 +54,12 @@
// Invoke any shutdown routines.
Phing::shutdown();
-
} catch (ConfigurationException $x) {
-
Phing::printMessage($x);
exit(-1); // This was convention previously for configuration errors.
-
} catch (Exception $x) {
-
// Assume the message was already printed as part of the build and
// exit with non-0 error code.
-
exit(1);
-
}
View
87 generator/bin/propel-gen
@@ -1,74 +1,51 @@
-#!/bin/sh
-# Shell wrapper for Propel generator
-# $Id$
-#
-# This script will do the following:
-# - check for PHING_COMMAND env, if found, use it.
-# - if not found assume php is on the path
-# - check for PROPEL_GEN_HOME env, if found use it
-# - if not look for it
+#!/usr/bin/env bash
if [ -z "$PROPEL_GEN_HOME" ] ; then
-
- # try to find Propel
- if [ -d /opt/propel/generator ] ; then
- PROPEL_GEN_HOME=/opt/propel/generator
- fi
-
- if [ -d "${HOME}/opt/propel/generator" ] ; then
- PROPEL_GEN_HOME="${HOME}/opt/propel/generator"
- fi
-
- if [ -d "/usr/local/propel/generator" ] ; then
- PROPEL_GEN_HOME="/usr/local/propel/generator"
- fi
-
- if [ -d "${HOME}/usr/propel/generator" ] ; then
- PROPEL_GEN_HOME="${HOME}/usr/propel/generator"
- fi
-
- ## resolve links - the script name may be a link to phing's home
- PRG="$0"
- progname=`basename "$0"`
- saveddir=`pwd`
-
- # need this for relative symlinks
- dirname_prg=`dirname "$PRG"`
- cd "$dirname_prg"
-
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
+ # try to find Propel
+ if [ -d /opt/propel/generator ] ; then
+ PROPEL_GEN_HOME=/opt/propel/generator
fi
- done
- cd "$saveddir"
+ if [ -d "${HOME}/opt/propel/generator" ] ; then
+ PROPEL_GEN_HOME="${HOME}/opt/propel/generator"
+ fi
- PROPEL_GEN_HOME=`dirname "$PRG"`/..
+ if [ -d "/usr/local/propel/generator" ] ; then
+ PROPEL_GEN_HOME="/usr/local/propel/generator"
+ fi
- # make it fully qualified
- PROPEL_GEN_HOME=`cd "$PROPEL_GEN_HOME" && pwd`
+ if [ -d "${HOME}/usr/propel/generator" ] ; then
+ PROPEL_GEN_HOME="${HOME}/usr/propel/generator"
+ fi
- # make it available in PHP via getenv("PROPEL_GEN_HOME")
- export PROPEL_GEN_HOME
+ ## resolve links - the script name may be a link to phing's home
+ SOURCE="${BASH_SOURCE[0]}"
+ PRG="$( dirname "$SOURCE" )"
+ while [ -h "$SOURCE" ]
+ do
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$PRG/$SOURCE"
+ PRG="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ done
+ PRG="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+
+ if [ -d "`dirname $PRG`" ] ; then
+ PROPEL_GEN_HOME="`dirname $PRG`"
+ fi
+ export PROPEL_GEN_HOME
fi
-if [ -d "vendor/phing/phing" ] ; then
+if [ -f "$PROPEL_GEN_HOME/bin/phing.php" ] ; then
export PHING_COMMAND="$PROPEL_GEN_HOME/bin/phing.php"
fi
if [ -z "$PHING_COMMAND" ] ; then
- # echo "WARNING: PHING_COMMAND environment not set. (Assuming phing on PATH)"
- export PHING_COMMAND="phing"
+ export PHING_COMMAND="phing"
fi
if [ $# = 1 ] ; then
- $PHING_COMMAND -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$saveddir $*
+ "$PHING_COMMAND" -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$saveddir $*
else
- $PHING_COMMAND -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$*
+ "$PHING_COMMAND" -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$*
fi
View
2  generator/build.properties-sample
@@ -84,7 +84,7 @@ propel.home = .
# or php4 (experimental).
#
# packageObjectModel
-# Sets whether Propel is packaging ObjectModel fro several
+# Sets whether Propel is packaging ObjectModel for several
# [package].schema.xml files. The <database package="packageName">
# attribute has to be set then. (warning: this is experimental!)
#
View
3  generator/default.properties
@@ -16,7 +16,7 @@
#
# -------------------------------------------------------------------
-propel.version = 1.6.6-dev
+propel.version = 1.6.7
propel.home = .
@@ -86,6 +86,7 @@ propel.addGenericAccessors = true
propel.addGenericMutators = true
propel.addSaveMethod = true
propel.addTimeStamp = false
+propel.addClassLevelComment = true
propel.addValidateMethod = true
propel.addIncludes = false
propel.addHooks = true
View
156 generator/lib/behavior/AlternativeCodingStandardsBehavior.php
@@ -38,96 +38,96 @@
*/
class AlternativeCodingStandardsBehavior extends Behavior
{
- // default parameters value
- protected $parameters = array(
- 'brackets_newline' => 'true',
- 'remove_closing_comments' => 'true',
- 'use_whitespace' => 'true',
- 'tab_size' => 2,
- 'strip_comments' => 'false'
- );
+ // default parameters value
+ protected $parameters = array(
+ 'brackets_newline' => 'true',
+ 'remove_closing_comments' => 'true',
+ 'use_whitespace' => 'true',
+ 'tab_size' => 2,
+ 'strip_comments' => 'false'
+ );
- public function objectFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function objectFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- public function extensionObjectFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function extensionObjectFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- public function queryFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function queryFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- public function extensionQueryFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function extensionQueryFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- public function peerFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function peerFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- public function extensionPeerFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function extensionPeerFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- public function tableMapFilter(&$script)
- {
- return $this->filter($script);
- }
+ public function tableMapFilter(&$script)
+ {
+ return $this->filter($script);
+ }
- /**
- * Transform the coding standards of a PHP sourcecode string
- *
- * @param string $script A script string to be filtered, passed as reference
- */
- protected function filter(&$script)
- {
- $filter = array();
- if($this->getParameter('brackets_newline') == 'true') {
- $filter['#^(\t*)\}\h(else|elseif|catch)(.*)\h\{$#m'] = "$1}
+ /**
+ * Transform the coding standards of a PHP sourcecode string
+ *
+ * @param string $script A script string to be filtered, passed as reference
+ */
+ protected function filter(&$script)
+ {
+ $filter = array();
+ if($this->getParameter('brackets_newline') == 'true') {
+ $filter['#^(\t*)\}\h(else|elseif|catch)(.*)\h\{$#m'] = "$1}
$1$2$3
$1{";
- $filter['#^(\t*)(\w.*)\h\{$#m'] = "$1$2
+ $filter['#^(\t*)(\w.*)\h\{$#m'] = "$1$2
$1{";
- }
- if ($this->getParameter('remove_closing_comments') == 'true') {
- $filter['#^(\t*)} //.*$#m'] = "$1}";
- }
- if ($this->getParameter('use_whitespace') == 'true') {
- $filter['#\t#'] = str_repeat(' ', $this->getParameter('tab_size'));
- }
+ }
+ if ($this->getParameter('remove_closing_comments') == 'true') {
+ $filter['#^(\t*)} //.*$#m'] = "$1}";
+ }
+ if ($this->getParameter('use_whitespace') == 'true') {
+ $filter['#\t#'] = str_repeat(' ', $this->getParameter('tab_size'));
+ }
- $script = preg_replace(array_keys($filter), array_values($filter), $script);
+ $script = preg_replace(array_keys($filter), array_values($filter), $script);
- if ($this->getParameter('strip_comments') == 'true') {
- $script = self::stripComments($script);
- }
- }
+ if ($this->getParameter('strip_comments') == 'true') {
+ $script = self::stripComments($script);
+ }
+ }
- /**
- * Remove inline and codeblock comments from a PHP code string
- * @param string $code The input code
- * @return string The input code, without comments
- */
- public static function stripComments($code)
- {
- $output = '';
- $commentTokens = array(T_COMMENT, T_DOC_COMMENT);
- foreach (token_get_all($code) as $token) {
- if (is_array($token)) {
- if (in_array($token[0], $commentTokens)) continue;
- $token = $token[1];
- }
- $output .= $token;
- }
+ /**
+ * Remove inline and codeblock comments from a PHP code string
+ * @param string $code The input code
+ * @return string The input code, without comments
+ */
+ public static function stripComments($code)
+ {
+ $output = '';
+ $commentTokens = array(T_COMMENT, T_DOC_COMMENT);
+ foreach (token_get_all($code) as $token) {
+ if (is_array($token)) {
+ if (in_array($token[0], $commentTokens)) continue;
+ $token = $token[1];
+ }
+ $output .= $token;
+ }
- return $output;
- }
-}
+ return $output;
+ }
+}
View
62 generator/lib/behavior/AutoAddPkBehavior.php
@@ -18,36 +18,36 @@
class AutoAddPkBehavior extends Behavior
{
- // default parameters value
- protected $parameters = array(
- 'name' => 'id',
- 'autoIncrement' => 'true',
- 'type' => 'INTEGER'
- );
+ // default parameters value
+ protected $parameters = array(
+ 'name' => 'id',
+ 'autoIncrement' => 'true',
+ 'type' => 'INTEGER'
+ );
- /**
- * Copy the behavior to the database tables
- * Only for tables that have no Pk
- */
- public function modifyDatabase()
- {
- foreach ($this->getDatabase()->getTables() as $table) {
- if(!$table->hasPrimaryKey()) {
- $b = clone $this;
- $table->addBehavior($b);
- }
- }
- }
+ /**
+ * Copy the behavior to the database tables
+ * Only for tables that have no Pk
+ */
+ public function modifyDatabase()
+ {
+ foreach ($this->getDatabase()->getTables() as $table) {
+ if (!$table->hasPrimaryKey()) {
+ $b = clone $this;
+ $table->addBehavior($b);
+ }
+ }
+ }
- /**
- * Add the primary key to the current table
- */
- public function modifyTable()
- {
- $table = $this->getTable();
- if (!$table->hasPrimaryKey() && !$table->hasBehavior('concrete_inheritance')) {
- $columnAttributes = array_merge(array('primaryKey' => 'true'), $this->getParameters());
- $this->getTable()->addColumn($columnAttributes);
- }
- }
-}
+ /**
+ * Add the primary key to the current table
+ */
+ public function modifyTable()
+ {
+ $table = $this->getTable();
+ if (!$table->hasPrimaryKey() && !$table->hasBehavior('concrete_inheritance')) {
+ $columnAttributes = array_merge(array('primaryKey' => 'true'), $this->getParameters());
+ $this->getTable()->addColumn($columnAttributes);
+ }
+ }
+}
View
212 generator/lib/behavior/DelegateBehavior.php
@@ -16,118 +16,120 @@
*/
class DelegateBehavior extends Behavior
{
- const ONE_TO_ONE = 1;
- const MANY_TO_ONE = 2;
+ const ONE_TO_ONE = 1;
+ const MANY_TO_ONE = 2;
- // default parameters value
- protected $parameters = array(
- 'to' => ''
- );
+ // default parameters value
+ protected $parameters = array(
+ 'to' => ''
+ );
- protected $delegates = array();
+ protected $delegates = array();
- /**
- * Lists the delegates and checks that the behavior can use them,
- * And adds a fk from the delegate to the main table if not already set
- */
- public function modifyTable()
- {
- $table = $this->getTable();
- $database = $table->getDatabase();
- $delegates = explode(',', $this->parameters['to']);
- foreach ($delegates as $delegate) {
- $delegate = $database->getTablePrefix() . trim($delegate);
- if (!$database->hasTable($delegate)) {
- throw new InvalidArgumentException(sprintf(
- 'No delegate table "%s" found for table "%s"',
- $delegate,
- $table->getName()
- ));
- }
- if (in_array($delegate, $table->getForeignTableNames())) {
- // existing many-to-one relationship
- $type = self::MANY_TO_ONE;
- } else {
- // one_to_one relationship
- $delegateTable = $this->getDelegateTable($delegate);
- if (in_array($table->getName(), $delegateTable->getForeignTableNames())) {
- // existing one-to-one relationship
- $fks = $delegateTable->getForeignKeysReferencingTable($this->getTable()->getName());
- $fk = $fks[0];
- if (!$fk->isLocalPrimaryKey()) {
- throw new InvalidArgumentException(sprintf(
- 'Delegate table "%s" has a relationship with table "%s", but it\'s a one-to-many relationship. The `delegate` behavior only supports one-to-one relationships in this case.',
- $delegate,
- $table->getName()
- ));
- }
- } else {
- // no relationship yet: must be created
- $this->relateDelegateToMainTable($this->getDelegateTable($delegate), $table);
- }
- $type = self::ONE_TO_ONE;
- }
- $this->delegates[$delegate] = $type;
- }
- }
+ /**
+ * Lists the delegates and checks that the behavior can use them,
+ * And adds a fk from the delegate to the main table if not already set
+ */
+ public function modifyTable()
+ {
+ $table = $this->getTable();
+ $database = $table->getDatabase();
+ $delegates = explode(',', $this->parameters['to']);
+ foreach ($delegates as $delegate) {
+ $delegate = $database->getTablePrefix() . trim($delegate);
+ if (!$database->hasTable($delegate)) {
+ throw new InvalidArgumentException(sprintf(
+ 'No delegate table "%s" found for table "%s"',
+ $delegate,
+ $table->getName()
+ ));
+ }
+ if (in_array($delegate, $table->getForeignTableNames())) {
+ // existing many-to-one relationship
+ $type = self::MANY_TO_ONE;
+ } else {
+ // one_to_one relationship
+ $delegateTable = $this->getDelegateTable($delegate);
+ if (in_array($table->getName(), $delegateTable->getForeignTableNames())) {
+ // existing one-to-one relationship
+ $fks = $delegateTable->getForeignKeysReferencingTable($this->getTable()->getName());
+ $fk = $fks[0];
+ if (!$fk->isLocalPrimaryKey()) {
+ throw new InvalidArgumentException(sprintf(
+ 'Delegate table "%s" has a relationship with table "%s", but it\'s a one-to-many relationship. The `delegate` behavior only supports one-to-one relationships in this case.',
+ $delegate,
+ $table->getName()
+ ));
+ }
+ } else {
+ // no relationship yet: must be created
+ $this->relateDelegateToMainTable($this->getDelegateTable($delegate), $table);
+ }
+ $type = self::ONE_TO_ONE;
+ }
+ $this->delegates[$delegate] = $type;
+ }
+ }
- protected function relateDelegateToMainTable($delegateTable, $mainTable)
- {
- $pks = $mainTable->getPrimaryKey();
- foreach ($pks as $column) {
- $mainColumnName = $column->getName();
- if (!$delegateTable->hasColumn($mainColumnName)) {
- $column = clone $column;
- $column->setAutoIncrement(false);
- $delegateTable->addColumn($column);
- }
- }
- // Add a one-to-one fk
- $fk = new ForeignKey();
- $fk->setForeignTableCommonName($mainTable->getCommonName());
- $fk->setForeignSchemaName($mainTable->getSchema());
- $fk->setDefaultJoin('LEFT JOIN');
- $fk->setOnDelete(ForeignKey::CASCADE);
- $fk->setOnUpdate(ForeignKey::NONE);
- foreach ($pks as $column) {
- $fk->addReference($column->getName(), $column->getName());
- }
- $delegateTable->addForeignKey($fk);
- }
+ protected function relateDelegateToMainTable($delegateTable, $mainTable)
+ {
+ $pks = $mainTable->getPrimaryKey();
+ foreach ($pks as $column) {
+ $mainColumnName = $column->getName();
+ if (!$delegateTable->hasColumn($mainColumnName)) {
+ $column = clone $column;
+ $column->setAutoIncrement(false);
+ $delegateTable->addColumn($column);
+ }
+ }
+ // Add a one-to-one fk
+ $fk = new ForeignKey();
+ $fk->setForeignTableCommonName($mainTable->getCommonName());
+ $fk->setForeignSchemaName($mainTable->getSchema());
+ $fk->setDefaultJoin('LEFT JOIN');
+ $fk->setOnDelete(ForeignKey::CASCADE);
+ $fk->setOnUpdate(ForeignKey::NONE);
+ foreach ($pks as $column) {
+ $fk->addReference($column->getName(), $column->getName());
+ }
+ $delegateTable->addForeignKey($fk);
+ }
- protected function getDelegateTable($delegateTableName)
- {
- return $this->getTable()->getDatabase()->getTable($delegateTableName);
- }
+ protected function getDelegateTable($delegateTableName)
+ {
+ return $this->getTable()->getDatabase()->getTable($delegateTableName);
+ }
- public function objectCall($builder)
- {
- $script = '';
- foreach ($this->delegates as $delegate => $type) {
- $delegateTable = $this->getDelegateTable($delegate);
- if ($type == self::ONE_TO_ONE) {
- $fks = $delegateTable->getForeignKeysReferencingTable($this->getTable()->getName());
- $fk = $fks[0];
- $ARFQCN = $builder->getNewStubObjectBuilder($fk->getTable())->getFullyQualifiedClassname();
- $ARClassName = $builder->getNewStubObjectBuilder($fk->getTable())->getClassname();
- $relationName = $builder->getRefFKPhpNameAffix($fk, $plural = false);
- } else {
- $fks = $this->getTable()->getForeignKeysReferencingTable($delegate);
- $fk = $fks[0];
- $ARFQCN = $builder->getNewStubObjectBuilder($delegateTable)->getFullyQualifiedClassname();
- $ARClassName = $builder->getNewStubObjectBuilder($delegateTable)->getClassname();
- $relationName = $builder->getFKPhpNameAffix($fk);
- }
- $script .= "
+ public function objectCall($builder)
+ {
+ $script = '';
+ foreach ($this->delegates as $delegate => $type) {
+ $delegateTable = $this->getDelegateTable($delegate);
+ if ($type == self::ONE_TO_ONE) {
+ $fks = $delegateTable->getForeignKeysReferencingTable($this->getTable()->getName());
+ $fk = $fks[0];
+ $ARFQCN = $builder->getNewStubObjectBuilder($fk->getTable())->getFullyQualifiedClassname();
+ $ARClassName = $builder->getNewStubObjectBuilder($fk->getTable())->getClassname();
+ $relationName = $builder->getRefFKPhpNameAffix($fk, $plural = false);
+ } else {
+ $fks = $this->getTable()->getForeignKeysReferencingTable($delegate);
+ $fk = $fks[0];
+ $ARFQCN = $builder->getNewStubObjectBuilder($delegateTable)->getFullyQualifiedClassname();
+ $ARClassName = $builder->getNewStubObjectBuilder($delegateTable)->getClassname();
+ $relationName = $builder->getFKPhpNameAffix($fk);
+ }
+ $script .= "
if (is_callable(array('$ARFQCN', \$name))) {
- if (!\$delegate = \$this->get$relationName()) {
- \$delegate = new $ARClassName();
- \$this->set$relationName(\$delegate);
- }
- return call_user_func_array(array(\$delegate, \$name), \$params);
+ if (!\$delegate = \$this->get$relationName()) {
+ \$delegate = new $ARClassName();
+ \$this->set$relationName(\$delegate);
+ }
+
+ return call_user_func_array(array(\$delegate, \$name), \$params);
}";
- }
- return $script;
- }
+ }
+
+ return $script;
+ }
}
View
549 generator/lib/behavior/SoftDeleteBehavior.php
@@ -19,61 +19,62 @@
*/
class SoftDeleteBehavior extends Behavior
{
- // default parameters value
- protected $parameters = array(
- 'deleted_column' => 'deleted_at',
- );
-
- /**
- * Add the deleted_column to the current table
- */
- public function modifyTable()
- {
- if(!$this->getTable()->containsColumn($this->getParameter('deleted_column'))) {
- $this->getTable()->addColumn(array(
- 'name' => $this->getParameter('deleted_column'),
- 'type' => 'TIMESTAMP'
- ));
- }
- }
-
- protected function getColumnSetter()
- {
- return 'set' . $this->getColumnForParameter('deleted_column')->getPhpName();
- }
-
- public function objectMethods($builder)
- {
- $this->builder = $builder;
- $script = '';
- $this->addObjectForceDelete($script);
- $this->addObjectUndelete($script);
- return $script;
- }
-
- public function addObjectForceDelete(&$script)
- {
- $peerClassName = $this->builder->getPeerClassname();
- $script .= "
+ // default parameters value
+ protected $parameters = array(
+ 'deleted_column' => 'deleted_at',
+ );
+
+ /**
+ * Add the deleted_column to the current table
+ */
+ public function modifyTable()
+ {
+ if (!$this->getTable()->containsColumn($this->getParameter('deleted_column'))) {
+ $this->getTable()->addColumn(array(
+ 'name' => $this->getParameter('deleted_column'),
+ 'type' => 'TIMESTAMP'
+ ));
+ }
+ }
+
+ protected function getColumnSetter()
+ {
+ return 'set' . $this->getColumnForParameter('deleted_column')->getPhpName();
+ }
+
+ public function objectMethods($builder)
+ {
+ $this->builder = $builder;
+ $script = '';
+ $this->addObjectForceDelete($script);
+ $this->addObjectUndelete($script);
+
+ return $script;
+ }
+
+ public function addObjectForceDelete(&$script)
+ {
+ $peerClassName = $this->builder->getPeerClassname();
+ $script .= "
/**
* Bypass the soft_delete behavior and force a hard delete of the current object
*/
public function forceDelete(PropelPDO \$con = null)
{
- if(\$isSoftDeleteEnabled = {$peerClassName}::isSoftDeleteEnabled()) {
- {$peerClassName}::disableSoftDelete();
- }
- \$this->delete(\$con);
- if (\$isSoftDeleteEnabled) {
- {$peerClassName}::enableSoftDelete();
- }
+ if (\$isSoftDeleteEnabled = {$peerClassName}::isSoftDeleteEnabled()) {
+ {$peerClassName}::disableSoftDelete();
+ }
+ \$this->delete(\$con);
+ if (\$isSoftDeleteEnabled) {
+ {$peerClassName}::enableSoftDelete();
+ }
}
";
- }
+ }
- public function addObjectUndelete(&$script)
- {
- $script .= "
+ public function addObjectUndelete(&$script)
+ {
+ $script .= "
/**
* Undelete a row that was soft_deleted
*
@@ -81,66 +82,69 @@ public function addObjectUndelete(&$script)
*/
public function unDelete(PropelPDO \$con = null)
{
- \$this->{$this->getColumnSetter()}(null);
- return \$this->save(\$con);
+ \$this->{$this->getColumnSetter()}(null);
+
+ return \$this->save(\$con);
}
";
- }
-
- public function preDelete($builder)
- {
- $script = "if (!empty(\$ret) && {$builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled()) {";
-
- // prevent updated_at from changing when using a timestampable behavior
- if ($this->getTable()->hasBehavior('timestampable')) {
- $script .= "
- \$this->keepUpdateDateUnchanged();";
- }
-
- $script .= "
- \$this->{$this->getColumnSetter()}(time());
- \$this->save(\$con);";
-
- if ($builder->getGeneratorConfig()->getBuildProperty('addHooks')) {
- $script .= "
- \$this->postDelete(\$con);";
- }
-
- $script .= "
- \$con->commit();
- {$builder->getStubPeerBuilder()->getClassname()}::removeInstanceFromPool(\$this);
- return;
+ }
+
+ public function preDelete($builder)
+ {
+ $script = "if (!empty(\$ret) && {$builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled()) {";
+
+ // prevent updated_at from changing when using a timestampable behavior
+ if ($this->getTable()->hasBehavior('timestampable')) {
+ $script .= "
+ \$this->keepUpdateDateUnchanged();";
+ }
+
+ $script .= "
+ \$this->{$this->getColumnSetter()}(time());
+ \$this->save(\$con);";
+
+ if ($builder->getGeneratorConfig()->getBuildProperty('addHooks')) {
+ $script .= "
+ \$this->postDelete(\$con);";
+ }
+
+ $script .= "
+ \$con->commit();
+ {$builder->getStubPeerBuilder()->getClassname()}::removeInstanceFromPool(\$this);
+
+ return;
}
";
- return $script;
- }
- public function queryAttributes()
- {
- return "protected static \$softDelete = true;
+ return $script;
+ }
+
+ public function queryAttributes()
+ {
+ return "protected static \$softDelete = true;
protected \$localSoftDelete = true;
";
- }
-
- public function queryMethods($builder)
- {
- $this->builder = $builder;
- $script = '';
- $this->addQueryIncludeDeleted($script);
- $this->addQuerySoftDelete($script);
- $this->addQueryForceDelete($script);
- $this->addQueryForceDeleteAll($script);
- $this->addQueryUnDelete($script);
- $this->addQueryEnableSoftDelete($script);
- $this->addQueryDisableSoftDelete($script);
- $this->addQueryIsSoftDeleteEnabled($script);
-
- return $script;
- }
-
- public function addQueryIncludeDeleted(&$script)
- {
- $script .= "
+ }
+
+ public function queryMethods($builder)
+ {
+ $this->builder = $builder;
+ $script = '';
+ $this->addQueryIncludeDeleted($script);
+ $this->addQuerySoftDelete($script);
+ $this->addQueryForceDelete($script);
+ $this->addQueryForceDeleteAll($script);
+ $this->addQueryUnDelete($script);
+ $this->addQueryEnableSoftDelete($script);
+ $this->addQueryDisableSoftDelete($script);
+ $this->addQueryIsSoftDeleteEnabled($script);
+
+ return $script;
+ }
+
+ public function addQueryIncludeDeleted(&$script)
+ {
+ $script .= "
/**
* Temporarily disable the filter on deleted rows
* Valid only for the current query
@@ -151,15 +155,16 @@ public function addQueryIncludeDeleted(&$script)
*/
public function includeDeleted()
{
- \$this->localSoftDelete = false;
- return \$this;
+ \$this->localSoftDelete = false;
+
+ return \$this;
}
";
- }
+ }
- public function addQuerySoftDelete(&$script)
- {
- $script .= "
+ public function addQuerySoftDelete(&$script)
+ {
+ $script .= "
/**
* Soft delete the selected rows
*
@@ -169,14 +174,14 @@ public function addQuerySoftDelete(&$script)
*/
public function softDelete(PropelPDO \$con = null)
{
- return \$this->update(array('{$this->getColumnForParameter('deleted_column')->getPhpName()}' => time()), \$con);
+ return \$this->update(array('{$this->getColumnForParameter('deleted_column')->getPhpName()}' => time()), \$con);
}
";
- }
+ }
- public function addQueryForceDelete(&$script)
- {
- $script .= "
+ public function addQueryForceDelete(&$script)
+ {
+ $script .= "
/**
* Bypass the soft_delete behavior and force a hard delete of the selected rows
*
@@ -186,14 +191,14 @@ public function addQueryForceDelete(&$script)
*/
public function forceDelete(PropelPDO \$con = null)
{
- return {$this->builder->getPeerClassname()}::doForceDelete(\$this, \$con);
+ return {$this->builder->getPeerClassname()}::doForceDelete(\$this, \$con);
}
";
- }
+ }
- public function addQueryForceDeleteAll(&$script)
- {
- $script .= "
+ public function addQueryForceDeleteAll(&$script)
+ {
+ $script .= "
/**
* Bypass the soft_delete behavior and force a hard delete of all the rows
*
@@ -203,13 +208,13 @@ public function addQueryForceDeleteAll(&$script)
*/
public function forceDeleteAll(PropelPDO \$con = null)
{
- return {$this->builder->getPeerClassname()}::doForceDeleteAll(\$con);}
+ return {$this->builder->getPeerClassname()}::doForceDeleteAll(\$con);}
";
- }
+ }
- public function addQueryUnDelete(&$script)
- {
- $script .= "
+ public function addQueryUnDelete(&$script)
+ {
+ $script .= "
/**
* Undelete selected rows
*
@@ -219,40 +224,40 @@ public function addQueryUnDelete(&$script)
*/
public function unDelete(PropelPDO \$con = null)
{
- return \$this->update(array('{$this->getColumnForParameter('deleted_column')->getPhpName()}' => null), \$con);
+ return \$this->update(array('{$this->getColumnForParameter('deleted_column')->getPhpName()}' => null), \$con);
}
";
- }
+ }
- public function addQueryEnableSoftDelete(&$script)
- {
- $script .= "
+ public function addQueryEnableSoftDelete(&$script)
+ {
+ $script .= "
/**
* Enable the soft_delete behavior for this model
*/
public static function enableSoftDelete()
{
- self::\$softDelete = true;
+ self::\$softDelete = true;
}
";
- }
+ }
- public function addQueryDisableSoftDelete(&$script)
- {
- $script .= "
+ public function addQueryDisableSoftDelete(&$script)
+ {
+ $script .= "
/**
* Disable the soft_delete behavior for this model
*/
public static function disableSoftDelete()
{
- self::\$softDelete = false;
+ self::\$softDelete = false;
}
";
- }
+ }
- public function addQueryIsSoftDeleteEnabled(&$script)
- {
- $script .= "
+ public function addQueryIsSoftDeleteEnabled(&$script)
+ {
+ $script .= "
/**
* Check the soft_delete behavior for this model
*
@@ -260,94 +265,94 @@ public function addQueryIsSoftDeleteEnabled(&$script)
*/
public static function isSoftDeleteEnabled()
{
- return self::\$softDelete;
+ return self::\$softDelete;
}
";
- }
+ }
- public function preSelectQuery($builder)
- {
- return <<<EOT
+ public function preSelectQuery($builder)
+ {
+ return <<<EOT
if ({$builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled() && \$this->localSoftDelete) {
- \$this->addUsingAlias({$builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, null, Criteria::ISNULL);
+ \$this->addUsingAlias({$builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, null, Criteria::ISNULL);
} else {
- {$builder->getPeerClassname()}::enableSoftDelete();
+ {$builder->getPeerClassname()}::enableSoftDelete();
}
EOT;
- }
+ }
- public function preDeleteQuery($builder)
- {
- return <<<EOT
+ public function preDeleteQuery($builder)
+ {
+ return <<<EOT
if ({$builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled() && \$this->localSoftDelete) {
- return \$this->softDelete(\$con);
+ return \$this->softDelete(\$con);
} else {
- return \$this->hasWhereClause() ? \$this->forceDelete(\$con) : \$this->forceDeleteAll(\$con);
+ return \$this->hasWhereClause() ? \$this->forceDelete(\$con) : \$this->forceDeleteAll(\$con);
}
EOT;
- }
-
- public function staticMethods($builder)
- {
- $builder->declareClassFromBuilder($builder->getStubQueryBuilder());
- $this->builder = $builder;
- $script = '';
- $this->addPeerEnableSoftDelete($script);
- $this->addPeerDisableSoftDelete($script);
- $this->addPeerIsSoftDeleteEnabled($script);
- $this->addPeerDoSoftDelete($script);
- $this->addPeerDoDelete2($script);
- $this->addPeerDoSoftDeleteAll($script);
- $this->addPeerDoDeleteAll2($script);
-
- return $script;
- }
-
- public function addPeerEnableSoftDelete(&$script)
- {
- $script .= "
+ }
+
+ public function staticMethods($builder)
+ {
+ $builder->declareClassFromBuilder($builder->getStubQueryBuilder());
+ $this->builder = $builder;
+ $script = '';
+ $this->addPeerEnableSoftDelete($script);
+ $this->addPeerDisableSoftDelete($script);
+ $this->addPeerIsSoftDeleteEnabled($script);
+ $this->addPeerDoSoftDelete($script);
+ $this->addPeerDoDelete2($script);
+ $this->addPeerDoSoftDeleteAll($script);
+ $this->addPeerDoDeleteAll2($script);
+
+ return $script;
+ }
+
+ public function addPeerEnableSoftDelete(&$script)
+ {
+ $script .= "
/**
* Enable the soft_delete behavior for this model
*/
public static function enableSoftDelete()
{
- {$this->builder->getStubQueryBuilder()->getClassname()}::enableSoftDelete();
- // some soft_deleted objects may be in the instance pool
- {$this->builder->getStubPeerBuilder()->getClassname()}::clearInstancePool();
+ {$this->builder->getStubQueryBuilder()->getClassname()}::enableSoftDelete();
+ // some soft_deleted objects may be in the instance pool
+ {$this->builder->getStubPeerBuilder()->getClassname()}::clearInstancePool();
}
";
- }
+ }
- public function addPeerDisableSoftDelete(&$script)
- {
- $script .= "
+ public function addPeerDisableSoftDelete(&$script)
+ {
+ $script .= "
/**
* Disable the soft_delete behavior for this model
*/
public static function disableSoftDelete()
{
- {$this->builder->getStubQueryBuilder()->getClassname()}::disableSoftDelete();
+ {$this->builder->getStubQueryBuilder()->getClassname()}::disableSoftDelete();
}
";
- }
+ }
- public function addPeerIsSoftDeleteEnabled(&$script)
- {
- $script .= "
+ public function addPeerIsSoftDeleteEnabled(&$script)
+ {
+ $script .= "
/**
* Check the soft_delete behavior for this model
* @return boolean true if the soft_delete behavior is enabled
*/
public static function isSoftDeleteEnabled()
{
- return {$this->builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled();
+ return {$this->builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled();
}
";
- }
+ }
- public function addPeerDoSoftDelete(&$script)
- {
- $script .= "
+ public function addPeerDoSoftDelete(&$script)
+ {
+ $script .= "
/**
* Soft delete records, given a {$this->builder->getStubObjectBuilder()->getClassname()} or Criteria object OR a primary key value.
*
@@ -360,45 +365,46 @@ public function addPeerDoSoftDelete(&$script)
*/
public static function doSoftDelete(\$values, PropelPDO \$con = null)
{
- if (\$con === null) {
- \$con = Propel::getConnection({$this->getTable()->getPhpName()}Peer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
- if (\$values instanceof Criteria) {
- // rename for clarity
- \$selectCriteria = clone \$values;
- } elseif (\$values instanceof {$this->builder->getStubObjectBuilder()->getClassname()}) {
- // create criteria based on pk values
- \$selectCriteria = \$values->buildPkeyCriteria();
- } else {
- // it must be the primary key
- \$selectCriteria = new Criteria(self::DATABASE_NAME);";
- $pks = $this->getTable()->getPrimaryKey();
- if (count($pks)>1) {
- $i = 0;
- foreach ($pks as $col) {
- $script .= "
- \$selectCriteria->add({$this->builder->getColumnConstant($col)}, \$values[$i], Criteria::EQUAL);";
- $i++;
- }
- } else {
- $col = $pks[0];
- $script .= "
- \$selectCriteria->add({$this->builder->getColumnConstant($col)}, (array) \$values, Criteria::IN);";
- }
- $script .= "
- }
- // Set the correct dbName
- \$selectCriteria->setDbName({$this->getTable()->getPhpName()}Peer::DATABASE_NAME);
- \$updateCriteria = new Criteria(self::DATABASE_NAME);
+ if (\$con === null) {
+ \$con = Propel::getConnection({$this->getTable()->getPhpName()}Peer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ if (\$values instanceof Criteria) {
+ // rename for clarity
+ \$selectCriteria = clone \$values;
+ } elseif (\$values instanceof {$this->builder->getStubObjectBuilder()->getClassname()}) {
+ // create criteria based on pk values
+ \$selectCriteria = \$values->buildPkeyCriteria();
+ } else {
+ // it must be the primary key
+ \$selectCriteria = new Criteria(self::DATABASE_NAME);";
+ $pks = $this->getTable()->getPrimaryKey();
+ if (count($pks)>1) {
+ $i = 0;
+ foreach ($pks as $col) {
+ $script .= "
+ \$selectCriteria->add({$this->builder->getColumnConstant($col)}, \$values[$i], Criteria::EQUAL);";
+ $i++;
+ }
+ } else {
+ $col = $pks[0];
+ $script .= "
+ \$selectCriteria->add({$this->builder->getColumnConstant($col)}, (array) \$values, Criteria::IN);";
+ }
+ $script .= "
+ }
+ // Set the correct dbName
+ \$selectCriteria->setDbName({$this->getTable()->getPhpName()}Peer::DATABASE_NAME);
+ \$updateCriteria = new Criteria(self::DATABASE_NAME);
\$updateCriteria->add({$this->builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, time());
- return {$this->builder->getBasePeerClassname()}::doUpdate(\$selectCriteria, \$updateCriteria, \$con);
+
+ return {$this->builder->getBasePeerClassname()}::doUpdate(\$selectCriteria, \$updateCriteria, \$con);
}
";
- }
+ }
- public function addPeerDoDelete2(&$script)
- {
- $script .= "
+ public function addPeerDoDelete2(&$script)
+ {
+ $script .= "
/**
* Delete or soft delete records, depending on {$this->builder->getPeerClassname()}::\$softDelete
*
@@ -411,17 +417,17 @@ public function addPeerDoDelete2(&$script)
*/
public static function doDelete2(\$values, PropelPDO \$con = null)
{
- if ({$this->builder->getPeerClassname()}::isSoftDeleteEnabled()) {
- return {$this->builder->getPeerClassname()}::doSoftDelete(\$values, \$con);
- } else {
- return {$this->builder->getPeerClassname()}::doForceDelete(\$values, \$con);
- }
+ if ({$this->builder->getPeerClassname()}::isSoftDeleteEnabled()) {
+ return {$this->builder->getPeerClassname()}::doSoftDelete(\$values, \$con);
+ } else {
+ return {$this->builder->getPeerClassname()}::doForceDelete(\$values, \$con);
+ }
}";
- }
+ }
- public function addPeerDoSoftDeleteAll(&$script)
- {
- $script .= "
+ public function addPeerDoSoftDeleteAll(&$script)
+ {
+ $script .= "
/**
* Method to soft delete all rows from the {$this->getTable()->getName()} table.
*
@@ -432,22 +438,23 @@ public function addPeerDoSoftDeleteAll(&$script)
*/
public static function doSoftDeleteAll(PropelPDO \$con = null)
{
- if (\$con === null) {
- \$con = Propel::getConnection({$this->builder->getPeerClassname()}::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
- \$selectCriteria = new Criteria();
- \$selectCriteria->add({$this->builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, null, Criteria::ISNULL);
- \$selectCriteria->setDbName({$this->builder->getPeerClassname()}::DATABASE_NAME);
- \$modifyCriteria = new Criteria();
- \$modifyCriteria->add({$this->builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, time());
- return BasePeer::doUpdate(\$selectCriteria, \$modifyCriteria, \$con);
+ if (\$con === null) {
+ \$con = Propel::getConnection({$this->builder->getPeerClassname()}::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ \$selectCriteria = new Criteria();
+ \$selectCriteria->add({$this->builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, null, Criteria::ISNULL);
+ \$selectCriteria->setDbName({$this->builder->getPeerClassname()}::DATABASE_NAME);
+ \$modifyCriteria = new Criteria();
+ \$modifyCriteria->add({$this->builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, time());
+
+ return BasePeer::doUpdate(\$selectCriteria, \$modifyCriteria, \$con);
}
";
- }
+ }
- public function addPeerDoDeleteAll2(&$script)
- {
- $script .= "
+ public function addPeerDoDeleteAll2(&$script)
+ {
+ $script .= "
/**
* Delete or soft delete all records, depending on {$this->builder->getPeerClassname()}::\$softDelete
*
@@ -458,38 +465,38 @@ public function addPeerDoDeleteAll2(&$script)
*/
public static function doDeleteAll2(PropelPDO \$con = null)
{
- if ({$this->builder->getPeerClassname()}::isSoftDeleteEnabled()) {
- return {$this->builder->getPeerClassname()}::doSoftDeleteAll(\$con);
- } else {
- return {$this->builder->getPeerClassname()}::doForceDeleteAll(\$con);
- }
+ if ({$this->builder->getPeerClassname()}::isSoftDeleteEnabled()) {
+ return {$this->builder->getPeerClassname()}::doSoftDeleteAll(\$con);
+ } else {
+ return {$this->builder->getPeerClassname()}::doForceDeleteAll(\$con);
+ }
}
";
- }
+ }
- public function preSelect($builder)
- {
- return <<<EOT
+ public function preSelect($builder)
+ {
+ return <<<EOT
if ({$builder->getStubQueryBuilder()->getClassname()}::isSoftDeleteEnabled()) {
- \$criteria->add({$builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, null, Criteria::ISNULL);
+ \$criteria->add({$builder->getColumnConstant($this->getColumnForParameter('deleted_column'))}, null, Criteria::ISNULL);
} else {
- {$builder->getPeerClassname()}::enableSoftDelete();
+ {$builder->getPeerClassname()}::enableSoftDelete();
}
EOT;
- }
-
- public function peerFilter(&$script)
- {
- $script = str_replace(array(
- 'public static function doDelete(',
- 'public static function doDelete2(',
- 'public static function doDeleteAll(',
- 'public static function doDeleteAll2('
- ), array(
- 'public static function doForceDelete(',
- 'public static function doDelete(',
- 'public static function doForceDeleteAll(',
- 'public static function doDeleteAll('
- ), $script);
- }
+ }
+
+ public function peerFilter(&$script)
+ {
+ $script = str_replace(array(
+ 'public static function doDelete(',
+ 'public static function doDelete2(',
+ 'public static function doDeleteAll(',
+ 'public static function doDeleteAll2('
+ ), array(
+ 'public static function doForceDelete(',
+ 'public static function doDelete(',
+ 'public static function doForceDeleteAll(',
+ 'public static function doDeleteAll('
+ ), $script);
+ }
}
View
217 generator/lib/behavior/TimestampableBehavior.php
@@ -18,77 +18,90 @@
*/
class TimestampableBehavior extends Behavior
{
- // default parameters value
- protected $parameters = array(
- 'create_column' => 'created_at',
- 'update_column' => 'updated_at'
- );
-
- /**
- * Add the create_column and update_columns to the current table
- */
- public function modifyTable()
- {
- if(!$this->getTable()->containsColumn($this->getParameter('create_column'))) {
- $this->getTable()->addColumn(array(
- 'name' => $this->getParameter('create_column'),
- 'type' => 'TIMESTAMP'
- ));
- }
- if(!$this->getTable()->containsColumn($this->getParameter('update_column'))) {
- $this->getTable()->addColumn(array(
- 'name' => $this->getParameter('update_column'),
- 'type' => 'TIMESTAMP'
- ));
- }
- }
-
- /**
- * Get the setter of one of the columns of the behavior
- *
- * @param string $column One of the behavior colums, 'create_column' or 'update_column'
- * @return string The related setter, 'setCreatedOn' or 'setUpdatedOn'
- */
- protected function getColumnSetter($column)
- {
- return 'set' . $this->getColumnForParameter($column)->getPhpName();
- }
-
- protected function getColumnConstant($columnName, $builder)
- {
- return $builder->getColumnConstant($this->getColumnForParameter($columnName));
- }
-
- /**
- * Add code in ObjectBuilder::preUpdate
- *
- * @return string The code to put at the hook
- */
- public function preUpdate($builder)
- {
- return "if (\$this->isModified() && !\$this->isColumnModified(" . $this->getColumnConstant('update_column', $builder) . ")) {
- \$this->" . $this->getColumnSetter('update_column') . "(time());
+ // default parameters value
+ protected $parameters = array(
+ 'create_column' => 'created_at',
+ 'update_column' => 'updated_at',
+ 'disable_updated_at' => 'false',
+ );
+
+ /**
+ * Add the create_column and update_columns to the current table
+ */
+ public function modifyTable()
+ {
+ if (!$this->getTable()->containsColumn($this->getParameter('create_column'))) {
+ $this->getTable()->addColumn(array(
+ 'name' => $this->getParameter('create_column'),
+ 'type' => 'TIMESTAMP'
+ ));
+ }
+
+ if ($this->withUpdatedAt()) {
+ if (!$this->getTable()->containsColumn($this->getParameter('update_column'))) {
+ $this->getTable()->addColumn(array(
+ 'name' => $this->getParameter('update_column'),
+ 'type' => 'TIMESTAMP'
+ ));
+ }
+ }
+ }
+
+ /**
+ * Get the setter of one of the columns of the behavior
+ *
+ * @param string $column One of the behavior colums, 'create_column' or 'update_column'
+ * @return string The related setter, 'setCreatedOn' or 'setUpdatedOn'
+ */
+ protected function getColumnSetter($column)
+ {
+ return 'set' . $this->getColumnForParameter($column)->getPhpName();
+ }
+
+ protected function getColumnConstant($columnName, $builder)
+ {
+ return $builder->getColumnConstant($this->getColumnForParameter($columnName));
+ }
+
+ /**
+ * Add code in ObjectBuilder::preUpdate
+ *
+ * @return string The code to put at the hook
+ */
+ public function preUpdate($builder)
+ {
+ if ($this->withUpdatedAt()) {
+ return "if (\$this->isModified() && !\$this->isColumnModified(" . $this->getColumnConstant('update_column', $builder) . ")) {
+ \$this->" . $this->getColumnSetter('update_column') . "(time());
}";
- }
-
- /**
- * Add code in ObjectBuilder::preInsert
- *
- * @return string The code to put at the hook
- */
- public function preInsert($builder)
- {
- return "if (!\$this->isColumnModified(" . $this->getColumnConstant('create_column', $builder) . ")) {
- \$this->" . $this->getColumnSetter('create_column') . "(time());
-}
+ }
+ }
+
+ /**
+ * Add code in ObjectBuilder::preInsert
+ *
+ * @return string The code to put at the hook
+ */
+ public function preInsert($builder)
+ {
+ $script = "if (!\$this->isColumnModified(" . $this->getColumnConstant('create_column', $builder) . ")) {
+ \$this->" . $this->getColumnSetter('create_column') . "(time());
+}";
+
+ if ($this->withUpdatedAt()) {
+ $script .= "
if (!\$this->isColumnModified(" . $this->getColumnConstant('update_column', $builder) . ")) {
- \$this->" . $this->getColumnSetter('update_column') . "(time());
+ \$this->" . $this->getColumnSetter('update_column') . "(time());
}";
- }
+ }
- public function objectMethods($builder)
- {
- return "
+ return $script;
+ }
+
+ public function objectMethods($builder)
+ {
+ if ($this->withUpdatedAt()) {
+ return "
/**
* Mark the current object so that the update date doesn't get updated during next save
*
@@ -96,18 +109,25 @@ public function objectMethods($builder)
*/
public function keepUpdateDateUnchanged()
{
- \$this->modifiedColumns[] = " . $this->getColumnConstant('update_column', $builder) . ";
- return \$this;
+ \$this->modifiedColumns[] = " . $this->getColumnConstant('update_column', $builder) . ";
+
+ return \$this;
}
";
- }
-
- public function queryMethods($builder)
- {
- $queryClassName = $builder->getStubQueryBuilder()->getClassname();
- $updateColumnConstant = $this->getColumnConstant('update_column', $builder);
- $createColumnConstant = $this->getColumnConstant('create_column', $builder);
- return "
+ }
+ }
+
+ public function queryMethods($builder)
+ {
+ $script = '';
+
+ $queryClassName = $builder->getStubQueryBuilder()->getClassname();
+ $createColumnConstant = $this->getColumnConstant('create_column', $builder);
+
+ if ($this->withUpdatedAt()) {
+ $updateColumnConstant = $this->getColumnConstant('update_column', $builder);
+
+ $script .= "
/**
* Filter by the latest updated
*
@@ -117,39 +137,42 @@ public function queryMethods($builder)
*/
public function recentlyUpdated(\$nbDays = 7)
{
- return \$this->addUsingAlias($updateColumnConstant, time() - \$nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ return \$this->addUsingAlias($updateColumnConstant, time() - \$nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
- * Filter by the latest created
- *
- * @param int \$nbDays Maximum age of in days
+ * Order by update date desc
*
* @return $queryClassName The current query, for fluid interface
*/
-public function recentlyCreated(\$nbDays = 7)
+public function lastUpdatedFirst()
{
- return \$this->addUsingAlias($createColumnConstant, time() - \$nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ return \$this->addDescendingOrderByColumn($updateColumnConstant);
}
/**
- * Order by update date desc
+ * Order by update date asc
*
* @return $queryClassName The current query, for fluid interface
*/
-public function lastUpdatedFirst()
+public function firstUpdatedFirst()
{
- return \$this->addDescendingOrderByColumn($updateColumnConstant);
+ return \$this->addAscendingOrderByColumn($updateColumnConstant);
}
+";
+ }
+ $script .= "
/**
- * Order by update date asc
+ * Filter by the latest created
+ *
+ * @param int \$nbDays Maximum age of in days
*
* @return $queryClassName The current query, for fluid interface
*/
-public function firstUpdatedFirst()
+public function recentlyCreated(\$nbDays = 7)
{
- return \$this->addAscendingOrderByColumn($updateColumnConstant);
+ return \$this->addUsingAlias($createColumnConstant, time() - \$nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
@@ -159,7 +182,7 @@ public function firstUpdatedFirst()
*/
public function lastCreatedFirst()
{
- return \$this->addDescendingOrderByColumn($createColumnConstant);
+ return \$this->addDescendingOrderByColumn($createColumnConstant);
}
/**
@@ -169,8 +192,14 @@ public function lastCreatedFirst()
*/
public function firstCreatedFirst()
{
- return \$this->addAscendingOrderByColumn($createColumnConstant);
+ return \$this->addAscendingOrderByColumn($createColumnConstant);
+}";
+
+ return $script;
+ }
+
+ protected function withUpdatedAt()
+ {
+ return 'true' !== $this->getParameter('disable_updated_at');
+ }
}
-";
- }
-}
View
236 generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php
@@ -20,114 +20,128 @@
class AggregateColumnBehavior extends Behavior
{
- // default parameters value
- protected $parameters = array(
- 'name' => null,
- 'expression' => null,
- 'foreign_table' => null,
- 'foreign_schema' => null,
- );
-
- /**
- * Add the aggregate key to the current table
- */
- public function modifyTable()
- {
- $table = $this->getTable();
- if (!$columnName = $this->getParameter('name')) {
- throw new InvalidArgumentException(sprintf('You must define a \'name\' parameter for the \'aggregate_column\' behavior in the \'%s\' table', $table->getName()));
- }
-
- // add the aggregate column if not present
- if(!$this->getTable()->containsColumn($columnName)) {
- $column = $this->getTable()->addColumn(array(
- 'name' => $columnName,
- 'type' => 'INTEGER',
- ));
- }
-
- // add a behavior in the foreign table to autoupdate the aggregate column
- $foreignTable = $this->getForeignTable();
- if (!$foreignTable->hasBehavior('concrete_inheritance_parent')) {
- $relationBehavior = new AggregateColumnRelationBehavior();
- $relationBehavior->setName('aggregate_column_relation');
- $foreignKey = $this->getForeignKey();
- $relationBehavior->addParameter(array('name' => 'foreign_table', 'value' => $table->getName()));
- $relationBehavior->addParameter(array('name' => 'update_method', 'value