Skip to content

Commit ddfbf17

Browse files
committed
try and merge in propelorm#1086
2 parents 0f32375 + 5aa667c commit ddfbf17

File tree

177 files changed

+472
-363
lines changed

Some content is hidden

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

177 files changed

+472
-363
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ language: php
33
services:
44
- mysql
55

6+
#services: docker
7+
68
branches:
79
only:
810
- master
911

1012
php:
11-
- 5.6
1213
- 7.0
1314
- 7.1
1415
- 7.2
16+
- 7.4
1517

1618
env:
1719
- DB=mysql DB_USER=root
@@ -29,3 +31,5 @@ before_script:
2931

3032
script: vendor/bin/phpunit
3133

34+
#script:
35+
# bash docker/run.sh

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,25 @@
1414
},
1515
"include-path": ["runtime/lib", "generator/lib"],
1616
"require": {
17-
"php": ">=5.2.4",
17+
"php": "^7.1",
1818
"phing/phing": "~2.4"
19+
1920
},
2021
"require-dev": {
2122
"pear-pear.php.net/pear_packagefilemanager2" : "@stable",
22-
"phpunit/phpunit": "~4.0||~5.0"
23+
"phpunit/phpunit": "~8|~9",
24+
"phpcompatibility/php-compatibility": "^9.3",
25+
"squizlabs/php_codesniffer": "^3.5"
2326
},
2427
"repositories": [
2528
{
2629
"type": "pear",
2730
"url": "https://pear.php.net"
2831
}
2932
],
30-
"bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"]
33+
"bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"],
34+
"scripts": {
35+
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
36+
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
37+
}
3138
}

docker/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM thecodingmachine/php:7.4-v3-cli
2+
USER root
3+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
4+
5+
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
6+
dpkg-reconfigure --frontend=noninteractive locales && \
7+
update-locale LANG=en_US.UTF-8
8+
9+
USER docker
10+
ENV LANG en_US.UTF-8
11+

docker/docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3'
2+
services:
3+
php:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
working_dir: /usr/src/app
8+
command: phpunit
9+
volumes:
10+
- ../:/usr/src/app
11+
environment:
12+
- PHP_EXTENSIONS=intl pdo_sqlite sqlite3
13+
- STARTUP_COMMAND_1=composer install
14+
- STARTUP_COMMAND_2=bash test/reset_tests.sh
15+
16+
db:
17+
image: percona
18+
command: >
19+
mysqld
20+
--sql-mode="NO_ENGINE_SUBSTITUTION"
21+
--character-set-server="utf8"
22+
--collation-server="utf8_unicode_ci"
23+
--default-authentication-plugin=mysql_native_password
24+
restart: always
25+
environment:
26+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'

docker/reset.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
mysql -u root -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'
4+
mysql -u root -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'

docker/run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
cd docker
3+
docker-compose up -d db
4+
sleep 20
5+
docker-compose exec -T db bash < reset.sh
6+
docker-compose build
7+
docker-compose run php

generator/lib/builder/om/PHP5ObjectBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,9 @@ protected function addLazyLoaderBody(&$script, Column $col)
14111411
try {
14121412
\$stmt = " . $this->getPeerClassname() . "::doSelectStmt(\$c, \$con);
14131413
\$row = \$stmt->fetch(PDO::FETCH_NUM);
1414+
if (\$row === false) {
1415+
\$row = [null]; // for backward compatibility
1416+
}
14141417
\$stmt->closeCursor();";
14151418
}
14161419

generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ protected function addLazyLoaderBody(&$script, Column $col)
111111
try {
112112
\$stmt = " . $this->getPeerClassname() . "::doSelectStmt(\$c, \$con);
113113
\$row = \$stmt->fetch(PDO::FETCH_NUM);
114+
if (\$row === false) {
115+
\$row = [null]; // for backward compatibility
116+
}
114117
\$stmt->closeCursor();";
115118

116119
if ($col->getType() === PropelTypes::CLOB && $this->getPlatform() instanceof OraclePlatform) {

generator/lib/model/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function addColumn($data)
181181
}
182182
} else {
183183
$attrib = $data;
184-
$name = $attrib["name"];
184+
$name = $attrib["name"] ?? null;
185185
$this->indexColumns[] = $name;
186186
if (isset($attrib["size"])) {
187187
$this->indexColumnSizes[$name] = $attrib["size"];

generator/lib/platform/DefaultPlatform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ public function getPhpArrayString($stringValue)
11821182
$values[] = trim($v);
11831183
}
11841184

1185-
$value = implode($values, ' | ');
1185+
$value = implode(' | ', $values);
11861186
if (empty($value) || ' | ' === $value) {
11871187
return null;
11881188
}

0 commit comments

Comments
 (0)