Skip to content

Commit d24a5c2

Browse files
jwong-dayspringmichalmagic42tworzeniewebmentalstring
authored andcommitted
compatibility with php 7.4 and 8.x (propelorm#4)
* Correct deprecated methods in PHP7.4 (propelorm#1079) * runtime/lib/query/Join.php implode() was used against the definition (wrong PHP documentation * runtime/lib/query/ModelCriteria.php count() was used on non-countable variable (non-array) * 7.4 and phpunit9 changes. Tests are passing * Compatibility changes * Added docker setup * updated travis * added correct path * 7.4 final travis setup * propelorm#1086: Code review suggestions applying * remove dependency on docker mysql * remove 5.6 and 7.2 from test matrix; add 8.0 and 8.1 * Upgraded PHP version and removed some deprecations * Migrated phpunit.xml.dist * Switched to PHP8.0 in Dockerfile * Removed usage of ReflectionClass->getClass in favor of ReflectionClass->getType * Changed order of arguments in ModelCriteriaTest.php and ModelCriteriaWithNamespaceTest.php * Fixed signatures of PropelOnDemandCollection::asort and PropelOnDemandCollection::ksort * Removed require_once from all the classes because we have autoloading via composer * Rector automated upgrade to PHP8 * Fixed invalid handling of resource type for binded value in DebugPDOStatement.php * Fixed invalid way of checking if method exists in delegated class via is_callable. Switched to method_exists * Replaced order of params because of failed tests * [STYLE]: Added simplified usage because of version support dropping * Fix use of abs() with string on PHP8.0 Can happen when using Yaml's multiline syntax * specify minimum version of phing for php8 * drop php 7.3 from test matrix * update to ubuntu-20.04 * fork propel/propel1 for versions >=1.8 Co-authored-by: Michal Drozd <[email protected]> Co-authored-by: Luke Adamczewski <[email protected]> Co-authored-by: Łukasz Adamczewski <[email protected]> Co-authored-by: Jeffrey Wong <[email protected]> Co-authored-by: Luke Adamczewski <[email protected]> Co-authored-by: Paulo Magalhaes <[email protected]>
1 parent 678736a commit d24a5c2

File tree

149 files changed

+176
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+176
-272
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ jobs:
88
env:
99
DB: mysql
1010
DB_USER: root
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-20.04
1212
strategy:
1313
fail-fast: false
1414
matrix:
1515
php:
16-
- '5.6'
17-
- '7.2'
18-
- '7.3'
1916
- '7.4'
20-
# - '8.0'
21-
# - '8.1'
17+
- '8.0'
18+
- '8.1'
2219
composer:
2320
- ''
2421
- '--prefer-lowest'

composer.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "propel/propel1",
2+
"name": "dayspring-tech/propel1",
33
"description": "Propel is an open-source Object-Relational Mapping (ORM) for PHP5.",
44
"keywords": ["orm", "active record", "mapping", "database", "persistence"],
55
"homepage": "http://www.propelorm.org/",
@@ -14,6 +14,7 @@
1414
},
1515
"include-path": ["runtime/lib", "generator/lib"],
1616
"require": {
17+
<<<<<<< HEAD
1718
"php": "^7.1",
1819
"phing/phing": "~2.4"
1920

@@ -23,18 +24,31 @@
2324
"phpunit/phpunit": "^9.0.0",
2425
"phpcompatibility/php-compatibility": "^9.3",
2526
"squizlabs/php_codesniffer": "^3.5"
27+
=======
28+
"php": "^8.0|^7.4",
29+
"phing/phing": "^2.17",
30+
"ext-pdo": "*"
2631
},
27-
"extra": {
28-
"branch-alias": {
29-
"dev-master": "1.7-dev"
30-
}
32+
"require-dev": {
33+
"phpunit/phpunit": "^9.0.0",
34+
"phpcompatibility/php-compatibility": "^9.3",
35+
"squizlabs/php_codesniffer": "^3.5",
36+
"ext-simplexml": "*",
37+
"ext-dom": "*"
38+
>>>>>>> 73148f83 (compatibility with php 7.4 and 8.x (#4))
39+
},
40+
"replace": {
41+
"propel/propel1": "^1.8"
3142
},
43+
<<<<<<< HEAD
3244
"repositories": [
3345
{
3446
"type": "pear",
3547
"url": "https://pear.php.net"
3648
}
3749
],
50+
=======
51+
>>>>>>> 73148f83 (compatibility with php 7.4 and 8.x (#4))
3852
"bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"],
3953
"scripts": {
4054
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM thecodingmachine/php:7.4-v3-cli
1+
FROM thecodingmachine/php:8.0-v4-cli
22
USER root
33
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
44

docker/docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ services:
99
volumes:
1010
- ../:/usr/src/app
1111
environment:
12+
<<<<<<< HEAD
1213
- PHP_EXTENSIONS=intl pdo_sqlite sqlite3
1314
- STARTUP_COMMAND_1=composer install
1415
- STARTUP_COMMAND_2=bash test/reset_tests.sh
16+
=======
17+
- PHP_EXTENSIONS=intl pdo_sqlite sqlite3 xdebug
18+
- STARTUP_COMMAND_1=composer install
19+
- STARTUP_COMMAND_2=bash test/reset_tests.sh
20+
- PHP_IDE_CONFIG="serverName=propel"
21+
- XDEBUG_MODE=debug
22+
- XDEBUG_SESSION=1
23+
>>>>>>> 73148f83 (compatibility with php 7.4 and 8.x (#4))
1524

1625
db:
1726
image: percona

generator/lib/behavior/DelegateBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function objectCall($builder)
111111
$relationName = $builder->getFKPhpNameAffix($fk);
112112
}
113113
$script .= "
114-
if (is_callable(array('$ARFQCN', \$name))) {
114+
if (method_exists('$ARFQCN', \$name)) {
115115
if (!\$delegate = \$this->get$relationName()) {
116116
\$delegate = new $ARClassName();
117117
\$this->set$relationName(\$delegate);

generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once 'AggregateColumnRelationBehavior.php';
12-
1311
/**
1412
* Keeps an aggregate column updated with related table
1513
*

generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once 'AggregateColumnRelationBehavior.php';
12-
1311
/**
1412
* Keeps an aggregate column updated with related table
1513
*

generator/lib/behavior/aggregate_column/templates/objectCompute.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Computes the value of the aggregate column <?php echo $column->getName() ?>
43
*

generator/lib/behavior/aggregate_column/templates/objectUpdate.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Updates the aggregate column <?php echo $column->getName() ?>
43
*

generator/lib/behavior/aggregate_column/templates/objectUpdateRelated.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Update the aggregate column in the related <?php echo $relationName ?> object
43
*

generator/lib/behavior/aggregate_column/templates/queryFindRelated.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Finds the related <?php echo $foreignTable->getPhpName() ?> objects and keep them for later
43
*

generator/lib/behavior/aggregate_column/templates/queryUpdateRelated.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
protected function updateRelated<?php echo $relationName ?>s($con)
32
{
43
foreach ($this-><?php echo $variableName ?>s as $<?php echo $variableName ?>) {

generator/lib/behavior/archivable/ArchivableBehavior.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/ArchivableBehaviorObjectBuilderModifier.php';
12-
require_once dirname(__FILE__) . '/ArchivableBehaviorQueryBuilderModifier.php';
11+
1312

1413
/**
1514
* Keeps tracks of an ActiveRecord object, even after deletion

generator/lib/behavior/archivable/templates/objectDeleteWithoutArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Removes the object from the database without archiving it.
43
*

generator/lib/behavior/archivable/templates/objectGetArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Get an archived version of the current object.
43
*

generator/lib/behavior/archivable/templates/objectPopulateFromArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Populates the the current object based on a $archiveTablePhpName archive object.
43
*

generator/lib/behavior/archivable/templates/objectRestoreFromArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Revert the the current object to the state it had when it was last archived.
43
* The object must be saved afterwards if the changes must persist.

generator/lib/behavior/archivable/templates/objectSaveWithoutArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Persists the object to the database without archiving it.
43
*

generator/lib/behavior/archivable/templates/queryArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Copy the data of the objects satisfying the query into <?php echo $archiveTablePhpName ?> archive objects.
43
* The archived objects are then saved.

generator/lib/behavior/archivable/templates/queryDeleteWithoutArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Delete records matching the current query without archiving them.
43
*

generator/lib/behavior/archivable/templates/querySetArchiveOnDelete.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Enable/disable auto-archiving on delete for the next query.
43
*

generator/lib/behavior/archivable/templates/querySetArchiveOnUpdate.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Enable/disable auto-archiving on update for the next query.
43
*

generator/lib/behavior/archivable/templates/queryUpdateWithoutArchive.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Delete records matching the current query without archiving them.
43
*

generator/lib/behavior/concrete_inheritance/ConcreteInheritanceBehavior.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once 'ConcreteInheritanceParentBehavior.php';
1211

1312
/**
1413
* Makes a model inherit another one. The model with this behavior gets a copy

generator/lib/behavior/i18n/I18nBehavior.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/I18nBehaviorObjectBuilderModifier.php';
12-
require_once dirname(__FILE__) . '/I18nBehaviorQueryBuilderModifier.php';
13-
require_once dirname(__FILE__) . '/I18nBehaviorPeerBuilderModifier.php';
11+
12+
1413

1514
/**
1615
* Allows translation of text columns through transparent one-to-many relationship

generator/lib/behavior/i18n/templates/objectAttributes.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Current locale
43
* @var string

generator/lib/behavior/i18n/templates/objectGetCurrentTranslation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Returns the current translation
43
*

generator/lib/behavior/i18n/templates/objectGetLocale.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Gets the locale for translations
43
*

generator/lib/behavior/i18n/templates/objectGetLocaleAlias.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Gets the locale for translations.
43
* Alias for getLocale(), for BC purpose.

generator/lib/behavior/i18n/templates/objectGetTranslation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Returns the current translation for a given locale
43
*

generator/lib/behavior/i18n/templates/objectPostDelete.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// emulate delete cascade
32
<?php echo $i18nQueryName ?>::create()
43
->filterBy<?php echo $objectClassname ?>($this)

generator/lib/behavior/i18n/templates/objectRemoveTranslation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Remove the translation for a given locale
43
*

generator/lib/behavior/i18n/templates/objectSetLocale.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Sets the locale for translations
43
*

generator/lib/behavior/i18n/templates/objectSetLocaleAlias.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Sets the locale for translations.
43
* Alias for setLocale(), for BC purpose.

generator/lib/behavior/i18n/templates/objectSetTranslation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Sets the translation for a given locale
43
*

generator/lib/behavior/i18n/templates/objectTranslatedColumnGetter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<?php echo $comment ?>
32
<?php echo $functionStatement ?>
43

generator/lib/behavior/i18n/templates/objectTranslatedColumnSetter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<?php echo $comment ?>
32
<?php echo $functionStatement ?>
43
$this->getCurrentTranslation()->set<?php echo $columnPhpName ?>(<?php echo $params ?>);

generator/lib/behavior/i18n/templates/queryJoinI18n.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Adds a JOIN clause to the query using the i18n relation
43
*

generator/lib/behavior/i18n/templates/queryJoinWithI18n.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Adds a JOIN clause to the query and hydrates the related I18n object.
43
* Shortcut for $c->joinI18n($locale)->with()

generator/lib/behavior/i18n/templates/queryUseI18nQuery.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Use the I18n relation query object
43
*

generator/lib/behavior/nestedset/NestedSetBehavior.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/NestedSetBehaviorObjectBuilderModifier.php';
12-
require_once dirname(__FILE__) . '/NestedSetBehaviorQueryBuilderModifier.php';
13-
require_once dirname(__FILE__) . '/NestedSetBehaviorPeerBuilderModifier.php';
11+
12+
1413

1514
/**
1615
* Behavior to adds nested set tree structure columns and abilities

generator/lib/behavior/sortable/SortableBehavior.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/SortableBehaviorObjectBuilderModifier.php';
12-
require_once dirname(__FILE__) . '/SortableBehaviorQueryBuilderModifier.php';
13-
require_once dirname(__FILE__) . '/SortableBehaviorPeerBuilderModifier.php';
14-
require_once dirname(__FILE__) . '/SortableRelationBehavior.php';
11+
12+
13+
1514

1615
/**
1716
* Gives a model class the ability to be ordered

generator/lib/behavior/versionable/VersionableBehavior.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/VersionableBehaviorObjectBuilderModifier.php';
12-
require_once dirname(__FILE__) . '/VersionableBehaviorQueryBuilderModifier.php';
13-
require_once dirname(__FILE__) . '/VersionableBehaviorPeerBuilderModifier.php';
11+
12+
1413

1514
/**
1615
* Keeps tracks of all the modifications in an ActiveRecord object

generator/lib/builder/om/ExtensionQueryBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/OMBuilder.php';
1211

1312
/**
1413
* Generates the empty PHP5 stub class for object query

generator/lib/builder/om/ExtensionQueryInheritanceBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/OMBuilder.php';
1211

1312
/**
1413
* Generates the empty PHP5 stub query class for use with single table inheritance.

generator/lib/builder/om/OMBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/../DataModelBuilder.php';
1211

1312
/**
1413
* Baseclass for OM-building classes.

generator/lib/builder/om/ObjectBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/OMBuilder.php';
1211

1312
/**
1413
* Base class for Peer-building classes.

generator/lib/builder/om/PHP5ExtensionNodeBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/ObjectBuilder.php';
1211

1312
/**
1413
* Generates the empty PHP5 stub node object class for user object model (OM).

generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/PeerBuilder.php';
1211

1312
/**
1413
* Generates the empty PHP5 stub node peer class for user object model (OM).

generator/lib/builder/om/PHP5ExtensionObjectBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once dirname(__FILE__) . '/ObjectBuilder.php';
1211

1312
/**
1413
* Generates the empty PHP5 stub object class for user object model (OM).

0 commit comments

Comments
 (0)