From 874ae7111eb4e17c9cf2e6703d48f8e40e929a22 Mon Sep 17 00:00:00 2001 From: Christopher Wilkinson Date: Fri, 27 Dec 2019 11:15:28 +0000 Subject: [PATCH 1/6] Conditional check for config --- src/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.php b/src/settings.php index e91a8b9d..b5054534 100644 --- a/src/settings.php +++ b/src/settings.php @@ -6,7 +6,7 @@ return [ 'settings' => [ - 'displayErrorDetails' => $config['displayErrorDetails'], // set to false in production + 'displayErrorDetails' => $config['displayErrorDetails'] ?? false, // set to false in production 'addContentLengthHeader' => false, // Allow the web server to send the content-length header 'determineRouteBeforeAppMiddleware' => true, // Only set this if you need access to route within middleware From 280204394b4e983c3fa7d8d0c4dce7d8f03ba6d0 Mon Sep 17 00:00:00 2001 From: Christopher Wilkinson Date: Fri, 27 Dec 2019 11:24:34 +0000 Subject: [PATCH 2/6] getConfig should always return array --- src/config.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config.php b/src/config.php index f0daa6ef..5f6721e1 100644 --- a/src/config.php +++ b/src/config.php @@ -9,5 +9,9 @@ function getConfig() { global $config; + if (!is_array($config)) { + throw new Exception('Invalid config files'); + } + return $config; } From 4d0f7118dd91ba9807388291c5b911ce1657fd23 Mon Sep 17 00:00:00 2001 From: Christopher Wilkinson Date: Thu, 27 Feb 2025 20:54:00 +0000 Subject: [PATCH 3/6] Update dependencies & regenerate propel classes --- README.md | 2 +- composer.json | 14 +- composer.lock | 3612 +++++++++++------ .../TechWilk/Rota/Base/Availability.php | 493 +-- .../TechWilk/Rota/Base/AvailabilityQuery.php | 409 +- .../TechWilk/Rota/Base/CalendarToken.php | 587 +-- .../TechWilk/Rota/Base/CalendarTokenQuery.php | 418 +- .../TechWilk/Rota/Base/Comment.php | 563 +-- .../TechWilk/Rota/Base/CommentQuery.php | 483 ++- .../TechWilk/Rota/Base/Document.php | 461 +-- .../TechWilk/Rota/Base/DocumentQuery.php | 175 +- .../TechWilk/Rota/Base/Email.php | 483 +-- .../TechWilk/Rota/Base/EmailQuery.php | 211 +- .../TechWilk/Rota/Base/Event.php | 1022 ++--- .../TechWilk/Rota/Base/EventGroup.php | 567 +-- .../TechWilk/Rota/Base/EventGroupQuery.php | 279 +- .../TechWilk/Rota/Base/EventPerson.php | 613 +-- .../TechWilk/Rota/Base/EventPersonQuery.php | 528 ++- .../TechWilk/Rota/Base/EventQuery.php | 1356 +++++-- .../TechWilk/Rota/Base/EventSubType.php | 552 +-- .../TechWilk/Rota/Base/EventSubTypeQuery.php | 260 +- .../TechWilk/Rota/Base/EventType.php | 659 +-- .../TechWilk/Rota/Base/EventTypeQuery.php | 480 ++- .../TechWilk/Rota/Base/Group.php | 565 +-- .../TechWilk/Rota/Base/GroupQuery.php | 313 +- .../TechWilk/Rota/Base/Location.php | 621 +-- .../TechWilk/Rota/Base/LocationQuery.php | 382 +- .../TechWilk/Rota/Base/LoginFailure.php | 453 +-- .../TechWilk/Rota/Base/LoginFailureQuery.php | 122 +- .../TechWilk/Rota/Base/Notification.php | 624 +-- .../TechWilk/Rota/Base/NotificationClick.php | 474 +-- .../Rota/Base/NotificationClickQuery.php | 292 +- .../TechWilk/Rota/Base/NotificationQuery.php | 504 ++- .../TechWilk/Rota/Base/PendingUser.php | 492 +-- .../TechWilk/Rota/Base/PendingUserQuery.php | 230 +- .../TechWilk/Rota/Base/Permission.php | 616 +-- .../TechWilk/Rota/Base/PermissionGroup.php | 580 +-- .../Rota/Base/PermissionGroupPermission.php | 473 +-- .../Base/PermissionGroupPermissionQuery.php | 372 +- .../Rota/Base/PermissionGroupQuery.php | 334 +- .../TechWilk/Rota/Base/PermissionQuery.php | 400 +- generated-classes/TechWilk/Rota/Base/Role.php | 585 +-- .../TechWilk/Rota/Base/RoleQuery.php | 431 +- .../TechWilk/Rota/Base/Settings.php | 794 ++-- .../TechWilk/Rota/Base/SettingsQuery.php | 565 +-- .../TechWilk/Rota/Base/SocialAuth.php | 478 +-- .../TechWilk/Rota/Base/SocialAuthQuery.php | 286 +- .../TechWilk/Rota/Base/Statistic.php | 527 +-- .../TechWilk/Rota/Base/StatisticQuery.php | 344 +- generated-classes/TechWilk/Rota/Base/Swap.php | 624 +-- .../TechWilk/Rota/Base/SwapQuery.php | 770 +++- generated-classes/TechWilk/Rota/Base/User.php | 1512 ++++--- .../TechWilk/Rota/Base/UserPermission.php | 529 +-- .../Rota/Base/UserPermissionQuery.php | 446 +- .../TechWilk/Rota/Base/UserQuery.php | 1629 ++++++-- .../TechWilk/Rota/Base/UserRole.php | 758 ++-- .../TechWilk/Rota/Base/UserRoleQuery.php | 759 +++- .../Rota/Map/AvailabilityTableMap.php | 274 +- .../Rota/Map/CalendarTokenTableMap.php | 343 +- .../TechWilk/Rota/Map/CommentTableMap.php | 313 +- .../TechWilk/Rota/Map/DocumentTableMap.php | 271 +- .../TechWilk/Rota/Map/EmailTableMap.php | 293 +- .../TechWilk/Rota/Map/EventGroupTableMap.php | 264 +- .../TechWilk/Rota/Map/EventPersonTableMap.php | 283 +- .../Rota/Map/EventSubTypeTableMap.php | 253 +- .../TechWilk/Rota/Map/EventTableMap.php | 438 +- .../TechWilk/Rota/Map/EventTypeTableMap.php | 324 +- .../TechWilk/Rota/Map/GroupTableMap.php | 287 +- .../TechWilk/Rota/Map/LocationTableMap.php | 260 +- .../Rota/Map/LoginFailureTableMap.php | 244 +- .../Rota/Map/NotificationClickTableMap.php | 276 +- .../Rota/Map/NotificationTableMap.php | 334 +- .../TechWilk/Rota/Map/PendingUserTableMap.php | 304 +- .../Map/PermissionGroupPermissionTableMap.php | 259 +- .../Rota/Map/PermissionGroupTableMap.php | 287 +- .../TechWilk/Rota/Map/PermissionTableMap.php | 266 +- .../TechWilk/Rota/Map/RoleTableMap.php | 290 +- .../TechWilk/Rota/Map/SettingsTableMap.php | 540 ++- .../TechWilk/Rota/Map/SocialAuthTableMap.php | 299 +- .../TechWilk/Rota/Map/StatisticTableMap.php | 309 +- .../TechWilk/Rota/Map/SwapTableMap.php | 354 +- .../Rota/Map/UserPermissionTableMap.php | 291 +- .../TechWilk/Rota/Map/UserRoleTableMap.php | 280 +- .../TechWilk/Rota/Map/UserTableMap.php | 442 +- generated-conf/config.php | 12 +- generated-conf/loadDatabase.php | 67 + generated-sql/default.sql | 957 +++-- tests/Integration/BaseTestCase.php | 6 +- 88 files changed, 26911 insertions(+), 15620 deletions(-) create mode 100644 generated-conf/loadDatabase.php diff --git a/README.md b/README.md index 5f7c7d6d..a2111056 100755 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Rota can be installed on almost any PHP web host, possibly even on the one your ### What you'll need: -- Web host running PHP 7.1 or above (it may work with earlier versions, but this isn't supported) +- Web host running PHP 7.4 or above (it may work with earlier versions, but we don't test it) - MySQL database (or an alternate DB which works with [PDO](http://php.net/manual/en/pdo.drivers.php), we've only tested MySQL though) - [Mailgun](https://www.mailgun.com/) account for email sending (10,000 email/month free) - or sendmail if you're feeling brave... diff --git a/composer.json b/composer.json index ecfe95da..b2574b9b 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,10 @@ }, "config": { "platform": { - "php": "7.1.0" + "php": "7.4.0" + }, + "allow-plugins": { + "php-http/discovery": true } }, "require": { @@ -41,7 +44,8 @@ "slim/twig-view": "^2.2", "techwilk/twig-linewrap": "^1.0", "techwilk/twig-slim-csrf": "^1.0", - "twig/extensions": "^1.4" + "twig/extensions": "^1.4", + "http-interop/http-factory-guzzle": "^1.1" }, "autoload": { "psr-4": { @@ -52,12 +56,12 @@ } }, "require-dev": { - "phpunit/phpunit": "^7.5.9", + "phpunit/phpunit": "^8.5.41", "satooshi/php-coveralls": "^2.0" }, "scripts": { "start": "php -S 0.0.0.0:8080 -t public public/index.php", - "test": "phpunit --coverage-clover build/logs/clover.xml", + "test": "phpunit", "format": "php-cs-fixer fix ." }, "autoload-dev": { @@ -65,4 +69,4 @@ "Tests\\": "tests/" } } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index d1e3cdcc..7afd1188 100644 --- a/composer.lock +++ b/composer.lock @@ -4,33 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e0b211d308d7cf20e3bf529c4374c471", + "content-hash": "6ec1160547bc3dbf2321fab4eef60377", "packages": [ { "name": "aptoma/twig-markdown", - "version": "3.1.0", + "version": "3.4.1", "source": { "type": "git", "url": "https://github.com/aptoma/twig-markdown.git", - "reference": "dd287a4c60bd7ca44b6f74795a4c3b96d7497e83" + "reference": "849248b26f0079f380e6559017e69114c57ef52a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aptoma/twig-markdown/zipball/dd287a4c60bd7ca44b6f74795a4c3b96d7497e83", - "reference": "dd287a4c60bd7ca44b6f74795a4c3b96d7497e83", + "url": "https://api.github.com/repos/aptoma/twig-markdown/zipball/849248b26f0079f380e6559017e69114c57ef52a", + "reference": "849248b26f0079f380e6559017e69114c57ef52a", "shasum": "" }, "require": { - "php": "^7.0", - "twig/twig": "^2.7.0" + "php": "^7.0|^8.0", + "twig/twig": "^2.7.0|^3.0" }, "require-dev": { - "codeclimate/php-test-reporter": "dev-master", "erusev/parsedown": "^1.6", - "knplabs/github-api": "~1.4", + "guzzlehttp/guzzle": "^7.2", + "http-interop/http-factory-guzzle": "^1.0", + "knplabs/github-api": "~3.0", "league/commonmark": "~0.5", "michelf/php-markdown": "~1", - "phpunit/phpunit": "~6.0||~5.0" + "php": "^7.2.5|^8.0", + "phpunit/phpunit": "~6.0|~5.0|~8.0" }, "suggest": { "knplabs/github-api": "Needed for using GitHub's Markdown engine provided through their API.", @@ -47,13 +49,13 @@ "MIT" ], "authors": [ - { - "name": "Joris Berthelot", - "email": "joris@berthelot.tel" - }, { "name": "Gunnar Lium", "email": "gunnar@aptoma.com" + }, + { + "name": "Joris Berthelot", + "email": "joris@berthelot.tel" } ], "description": "Twig extension to work with Markdown content", @@ -61,36 +63,41 @@ "markdown", "twig" ], - "time": "2019-03-13T11:25:31+00:00" + "support": { + "issues": "https://github.com/aptoma/twig-markdown/issues", + "source": "https://github.com/aptoma/twig-markdown/tree/3.4.1" + }, + "abandoned": true, + "time": "2021-12-14T11:12:21+00:00" }, { "name": "clue/stream-filter", - "version": "v1.4.1", + "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/clue/php-stream-filter.git", - "reference": "5a58cc30a8bd6a4eb8f856adf61dd3e013f53f71" + "url": "https://github.com/clue/stream-filter.git", + "reference": "049509fef80032cb3f051595029ab75b49a3c2f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/5a58cc30a8bd6a4eb8f856adf61dd3e013f53f71", - "reference": "5a58cc30a8bd6a4eb8f856adf61dd3e013f53f71", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/049509fef80032cb3f051595029ab75b49a3c2f7", + "reference": "049509fef80032cb3f051595029ab75b49a3c2f7", "shasum": "" }, "require": { "php": ">=5.3" }, "require-dev": { - "phpunit/phpunit": "^5.0 || ^4.8" + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" }, "type": "library", "autoload": { - "psr-4": { - "Clue\\StreamFilter\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "Clue\\StreamFilter\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -99,11 +106,11 @@ "authors": [ { "name": "Christian Lück", - "email": "christian@lueck.tv" + "email": "christian@clue.engineering" } ], "description": "A simple and modern approach to stream filtering in PHP", - "homepage": "https://github.com/clue/php-stream-filter", + "homepage": "https://github.com/clue/stream-filter", "keywords": [ "bucket brigade", "callback", @@ -113,39 +120,21 @@ "stream_filter_append", "stream_filter_register" ], - "time": "2019-04-09T12:31:48+00:00" - }, - { - "name": "container-interop/container-interop", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" + "support": { + "issues": "https://github.com/clue/stream-filter/issues", + "source": "https://github.com/clue/stream-filter/tree/v1.7.0" }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "abandoned": "psr/container", - "time": "2017-02-14T19:40:03+00:00" + "time": "2023-12-20T15:40:13+00:00" }, { "name": "dpolac/dictionary", @@ -191,6 +180,10 @@ "dictionary", "hash" ], + "support": { + "issues": "https://github.com/dpolac/dictionary/issues", + "source": "https://github.com/dpolac/dictionary/tree/master" + }, "time": "2016-06-05T18:29:47+00:00" }, { @@ -245,20 +238,24 @@ "sort", "unique" ], + "support": { + "issues": "https://github.com/dpolac/twig-lambda/issues", + "source": "https://github.com/dpolac/twig-lambda/tree/master" + }, "time": "2018-06-06T16:44:04+00:00" }, { "name": "erusev/parsedown", - "version": "1.7.3", + "version": "1.7.4", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7" + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/6d893938171a817f4e9bc9e86f2da1e370b7bcd7", - "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3", "shasum": "" }, "require": { @@ -291,7 +288,11 @@ "markdown", "parser" ], - "time": "2019-03-17T18:48:37+00:00" + "support": { + "issues": "https://github.com/erusev/parsedown/issues", + "source": "https://github.com/erusev/parsedown/tree/1.7.x" + }, + "time": "2019-12-30T22:54:17+00:00" }, { "name": "facebook/graph-sdk", @@ -326,12 +327,12 @@ } }, "autoload": { - "psr-4": { - "Facebook\\": "src/Facebook/" - }, "files": [ "src/Facebook/polyfills.php" - ] + ], + "psr-4": { + "Facebook\\": "src/Facebook/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -349,27 +350,33 @@ "facebook", "sdk" ], + "support": { + "issues": "https://github.com/facebook/php-graph-sdk/issues", + "source": "https://github.com/facebook/php-graph-sdk/tree/5.7.0" + }, + "abandoned": true, "time": "2018-12-11T22:56:31+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "6.5.2", + "version": "6.5.8", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981", + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5" + "guzzlehttp/psr7": "^1.9", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.17" }, "require-dev": { "ext-curl": "*", @@ -377,7 +384,6 @@ "psr/log": "^1.1" }, "suggest": { - "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", @@ -387,22 +393,52 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", @@ -416,71 +452,117 @@ "rest", "web service" ], - "time": "2019-12-23T11:57:10+00:00" + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/6.5.8" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2022-06-20T22:16:07+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.5.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e", + "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2023-05-21T12:31:43+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", "shasum": "" }, "require": { @@ -493,37 +575,53 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], @@ -538,20 +636,96 @@ "uri", "url" ], - "time": "2019-07-01T23:21:34+00:00" + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.9.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2023-04-17T16:00:37+00:00" + }, + { + "name": "http-interop/http-factory-guzzle", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/http-interop/http-factory-guzzle.git", + "reference": "8f06e92b95405216b237521cc64c804dd44c4a81" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/http-interop/http-factory-guzzle/zipball/8f06e92b95405216b237521cc64c804dd44c4a81", + "reference": "8f06e92b95405216b237521cc64c804dd44c4a81", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.7||^2.0", + "php": ">=7.3", + "psr/http-factory": "^1.0" + }, + "provide": { + "psr/http-factory-implementation": "^1.0" + }, + "require-dev": { + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "guzzlehttp/psr7": "Includes an HTTP factory starting in version 2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Http\\Factory\\Guzzle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "An HTTP Factory using Guzzle PSR7", + "keywords": [ + "factory", + "http", + "psr-17", + "psr-7" + ], + "support": { + "issues": "https://github.com/http-interop/http-factory-guzzle/issues", + "source": "https://github.com/http-interop/http-factory-guzzle/tree/1.2.0" + }, + "time": "2021-07-21T13:50:14+00:00" }, { "name": "mailgun/mailgun-php", - "version": "3.0.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/mailgun/mailgun-php.git", - "reference": "4055fea33deb038df067e78a2116f9ccb0125e16" + "reference": "a084abdb8601c0380b668651c169e0560fb435d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mailgun/mailgun-php/zipball/4055fea33deb038df067e78a2116f9ccb0125e16", - "reference": "4055fea33deb038df067e78a2116f9ccb0125e16", + "url": "https://api.github.com/repos/mailgun/mailgun-php/zipball/a084abdb8601c0380b668651c169e0560fb435d0", + "reference": "a084abdb8601c0380b668651c169e0560fb435d0", "shasum": "" }, "require": { @@ -560,12 +734,12 @@ "php-http/discovery": "^1.6", "php-http/multipart-stream-builder": "^1.0", "psr/http-client": "^1.0", - "webmozart/assert": "^1.2" + "webmozart/assert": "^1.6" }, "require-dev": { "nyholm/nsa": "^1.1", "nyholm/psr7": "^1.0", - "php-http/guzzle6-adapter": "^1.0", + "php-http/guzzle6-adapter": "^1.0 || ^2.0", "phpunit/phpunit": "^7.5" }, "suggest": { @@ -594,20 +768,24 @@ } ], "description": "The Mailgun SDK provides methods for all API functions.", - "time": "2019-09-13T20:14:46+00:00" + "support": { + "issues": "https://github.com/mailgun/mailgun-php/issues", + "source": "https://github.com/mailgun/mailgun-php/tree/3.2.0" + }, + "time": "2020-11-25T07:33:50+00:00" }, { "name": "michelf/php-markdown", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/michelf/php-markdown.git", - "reference": "c83178d49e372ca967d1a8c77ae4e051b3a3c75c" + "reference": "5024d623c1a057dcd2d076d25b7d270a1d0d55f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/c83178d49e372ca967d1a8c77ae4e051b3a3c75c", - "reference": "c83178d49e372ca967d1a8c77ae4e051b3a3c75c", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/5024d623c1a057dcd2d076d25b7d270a1d0d55f3", + "reference": "5024d623c1a057dcd2d076d25b7d270a1d0d55f3", "shasum": "" }, "require": { @@ -643,20 +821,24 @@ "keywords": [ "markdown" ], - "time": "2019-12-02T02:32:27+00:00" + "support": { + "issues": "https://github.com/michelf/php-markdown/issues", + "source": "https://github.com/michelf/php-markdown/tree/1.9.1" + }, + "time": "2021-11-24T02:52:38+00:00" }, { "name": "monolog/monolog", - "version": "1.25.3", + "version": "1.27.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1" + "reference": "904713c5929655dc9b97288b69cfeedad610c9a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1", - "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1", + "reference": "904713c5929655dc9b97288b69cfeedad610c9a1", "shasum": "" }, "require": { @@ -670,11 +852,10 @@ "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", + "phpstan/phpstan": "^0.12.59", "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", "ruflin/elastica": ">=0.90 <3.0", "sentry/sentry": "^0.13", "swiftmailer/swiftmailer": "^5.3|^6.0" @@ -693,11 +874,6 @@ "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Monolog\\": "src/Monolog" @@ -721,7 +897,21 @@ "logging", "psr-3" ], - "time": "2019-12-20T14:15:16+00:00" + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/1.27.1" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2022-06-09T08:53:42+00:00" }, { "name": "nikic/fast-route", @@ -745,12 +935,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "FastRoute\\": "src/" - }, "files": [ "src/functions.php" - ] + ], + "psr-4": { + "FastRoute\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -767,6 +957,10 @@ "router", "routing" ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, "time": "2018-02-13T20:26:39+00:00" }, { @@ -864,38 +1058,39 @@ "psr-7", "psr-messages" ], + "support": { + "email": "oom@oscarotero.com", + "issues": "https://github.com/oscarotero/psr7-middlewares/issues", + "source": "https://github.com/oscarotero/psr7-middlewares/tree/master" + }, "abandoned": "middlewares/*", "time": "2017-09-28T21:21:24+00:00" }, { "name": "paragonie/random_compat", - "version": "v2.0.17", + "version": "v9.99.100", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", - "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": ">= 7" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -914,20 +1109,25 @@ "pseudorandom", "random" ], - "time": "2018-07-04T16:31:37+00:00" + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" }, { "name": "php-http/client-common", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "c0390ae3c8f2ae9d50901feef0127fb9e396f6b4" + "reference": "11d34cad40647848aa98536494f9da63571af9da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/c0390ae3c8f2ae9d50901feef0127fb9e396f6b4", - "reference": "c0390ae3c8f2ae9d50901feef0127fb9e396f6b4", + "url": "https://api.github.com/repos/php-http/client-common/zipball/11d34cad40647848aa98536494f9da63571af9da", + "reference": "11d34cad40647848aa98536494f9da63571af9da", "shasum": "" }, "require": { @@ -975,7 +1175,11 @@ "http", "httplug" ], - "time": "2019-11-18T08:54:36+00:00" + "support": { + "issues": "https://github.com/php-http/client-common/issues", + "source": "https://github.com/php-http/client-common/tree/1.11.0" + }, + "time": "2021-07-11T14:33:59+00:00" }, { "name": "php-http/curl-client", @@ -1031,49 +1235,62 @@ "curl", "http" ], + "support": { + "issues": "https://github.com/php-http/curl-client/issues", + "source": "https://github.com/php-http/curl-client/tree/v1.7.1" + }, "time": "2018-03-26T19:21:48+00:00" }, { "name": "php-http/discovery", - "version": "1.7.0", + "version": "1.20.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "e822f86a6983790aa17ab13aa7e69631e86806b6" + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/e822f86a6983790aa17ab13aa7e69631e86806b6", - "reference": "e822f86a6983790aa17ab13aa7e69631e86806b6", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", "shasum": "" }, "require": { - "php": "^7.1" + "composer-plugin-api": "^1.0|^2.0", + "php": "^7.1 || ^8.0" }, "conflict": { - "nyholm/psr7": "<1.0" + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" }, "require-dev": { - "akeneo/phpspec-skip-example-extension": "^4.0", + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1", - "puli/composer-plugin": "1.0.0-beta10" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories", - "puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details." + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "sebastian/comparator": "^3.0.5 || ^4.0.8", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" }, - "type": "library", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "1.7-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "autoload": { "psr-4": { "Http\\Discovery\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1085,7 +1302,7 @@ "email": "mark.sagikazar@gmail.com" } ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", "homepage": "http://php-http.org", "keywords": [ "adapter", @@ -1094,9 +1311,14 @@ "factory", "http", "message", + "psr17", "psr7" ], - "time": "2019-06-30T09:04:27+00:00" + "support": { + "issues": "https://github.com/php-http/discovery/issues", + "source": "https://github.com/php-http/discovery/tree/1.20.0" + }, + "time": "2024-10-02T11:20:13+00:00" }, { "name": "php-http/httplug", @@ -1152,60 +1374,57 @@ "client", "http" ], + "support": { + "issues": "https://github.com/php-http/httplug/issues", + "source": "https://github.com/php-http/httplug/tree/master" + }, "time": "2016-08-31T08:30:17+00:00" }, { "name": "php-http/message", - "version": "1.8.0", + "version": "1.16.2", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "ce8f43ac1e294b54aabf5808515c3554a19c1e1c" + "reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/ce8f43ac1e294b54aabf5808515c3554a19c1e1c", - "reference": "ce8f43ac1e294b54aabf5808515c3554a19c1e1c", + "url": "https://api.github.com/repos/php-http/message/zipball/06dd5e8562f84e641bf929bfe699ee0f5ce8080a", + "reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a", "shasum": "" }, "require": { - "clue/stream-filter": "^1.4", - "php": "^7.1", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" + "clue/stream-filter": "^1.5", + "php": "^7.2 || ^8.0", + "psr/http-message": "^1.1 || ^2.0" }, "provide": { "php-http/message-factory-implementation": "1.0" }, "require-dev": { - "akeneo/phpspec-skip-example-extension": "^1.0", - "coduo/phpspec-data-provider-extension": "^1.0", + "ergebnis/composer-normalize": "^2.6", "ext-zlib": "*", - "guzzlehttp/psr7": "^1.0", - "henrikbjorn/phpspec-code-coverage": "^1.0", - "phpspec/phpspec": "^2.4", - "slim/slim": "^3.0", - "zendframework/zend-diactoros": "^1.0" + "guzzlehttp/psr7": "^1.0 || ^2.0", + "laminas/laminas-diactoros": "^2.0 || ^3.0", + "php-http/message-factory": "^1.0.2", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", + "slim/slim": "^3.0" }, "suggest": { "ext-zlib": "Used with compressor/decompressor streams", "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", - "slim/slim": "Used with Slim Framework PSR-7 implementation", - "zendframework/zend-diactoros": "Used with Diactoros Factories" + "laminas/laminas-diactoros": "Used with Diactoros Factories", + "slim/slim": "Used with Slim Framework PSR-7 implementation" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - }, "files": [ "src/filters.php" - ] + ], + "psr-4": { + "Http\\Message\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1224,30 +1443,34 @@ "message", "psr-7" ], - "time": "2019-08-05T06:55:08+00:00" + "support": { + "issues": "https://github.com/php-http/message/issues", + "source": "https://github.com/php-http/message/tree/1.16.2" + }, + "time": "2024-10-02T11:34:13+00:00" }, { "name": "php-http/message-factory", - "version": "v1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-http/message-factory.git", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" + "reference": "4d8778e1c7d405cbb471574821c1ff5b68cc8f57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", + "url": "https://api.github.com/repos/php-http/message-factory/zipball/4d8778e1c7d405cbb471574821c1ff5b68cc8f57", + "reference": "4d8778e1c7d405cbb471574821c1ff5b68cc8f57", "shasum": "" }, "require": { "php": ">=5.4", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1274,40 +1497,39 @@ "stream", "uri" ], - "time": "2015-12-19T14:08:53+00:00" + "support": { + "issues": "https://github.com/php-http/message-factory/issues", + "source": "https://github.com/php-http/message-factory/tree/1.1.0" + }, + "abandoned": "psr/http-factory", + "time": "2023-04-14T14:16:17+00:00" }, { "name": "php-http/multipart-stream-builder", - "version": "1.1.0", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "5d73adad53cf1d674dcc6c5b288a3ff3f76c4849" + "reference": "10086e6de6f53489cca5ecc45b6f468604d3460e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/5d73adad53cf1d674dcc6c5b288a3ff3f76c4849", - "reference": "5d73adad53cf1d674dcc6c5b288a3ff3f76c4849", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/10086e6de6f53489cca5ecc45b6f468604d3460e", + "reference": "10086e6de6f53489cca5ecc45b6f468604d3460e", "shasum": "" }, "require": { - "php": "^7.1", - "php-http/discovery": "^1.7", - "php-http/message-factory": "^1.0.2", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" + "php": "^7.1 || ^8.0", + "php-http/discovery": "^1.15", + "psr/http-factory-implementation": "^1.0" }, "require-dev": { "nyholm/psr7": "^1.0", "php-http/message": "^1.5", - "phpunit/phpunit": "^7.5 || ^8.3" + "php-http/message-factory": "^1.0.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, "autoload": { "psr-4": { "Http\\Message\\MultipartStream\\": "src/" @@ -1332,32 +1554,34 @@ "multipart stream", "stream" ], - "time": "2019-08-22T14:13:19+00:00" + "support": { + "issues": "https://github.com/php-http/multipart-stream-builder/issues", + "source": "https://github.com/php-http/multipart-stream-builder/tree/1.4.2" + }, + "time": "2024-09-04T13:22:54+00:00" }, { "name": "php-http/promise", - "version": "v1.0.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/php-http/promise.git", - "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980" + "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980", - "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980", + "url": "https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83", + "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83", "shasum": "" }, + "require": { + "php": "^7.1 || ^8.0" + }, "require-dev": { - "henrikbjorn/phpspec-code-coverage": "^1.0", - "phpspec/phpspec": "^2.4" + "friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^6.3", + "phpspec/phpspec": "^5.1.2 || ^6.2 || ^7.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, "autoload": { "psr-4": { "Http\\Promise\\": "src/" @@ -1368,13 +1592,13 @@ "MIT" ], "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - }, { "name": "Joel Wurtz", "email": "joel.wurtz@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" } ], "description": "Promise used for asynchronous HTTP requests", @@ -1382,33 +1606,37 @@ "keywords": [ "promise" ], - "time": "2016-01-26T13:27:02+00:00" + "support": { + "issues": "https://github.com/php-http/promise/issues", + "source": "https://github.com/php-http/promise/tree/1.3.1" + }, + "time": "2024-03-15T13:55:21+00:00" }, { "name": "pimple/pimple", - "version": "v3.2.3", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", - "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed", "shasum": "" }, "require": { - "php": ">=5.3.0", - "psr/container": "^1.0" + "php": ">=7.2.5", + "psr/container": "^1.1 || ^2.0" }, "require-dev": { - "symfony/phpunit-bridge": "^3.2" + "symfony/phpunit-bridge": "^5.4@dev" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "3.4.x-dev" } }, "autoload": { @@ -1427,12 +1655,15 @@ } ], "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", + "homepage": "https://pimple.symfony.com", "keywords": [ "container", "dependency injection" ], - "time": "2018-01-21T07:42:36+00:00" + "support": { + "source": "https://github.com/silexphp/Pimple/tree/v3.5.0" + }, + "time": "2021-10-28T11:13:42+00:00" }, { "name": "propel/propel", @@ -1440,31 +1671,40 @@ "source": { "type": "git", "url": "https://github.com/propelorm/Propel2.git", - "reference": "297473a6ddf0dcbbd6f88cb852c2c549814f908e" + "reference": "bbb64a859790230bf2e8ea83e1f26f7253adf685" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/propelorm/Propel2/zipball/297473a6ddf0dcbbd6f88cb852c2c549814f908e", - "reference": "297473a6ddf0dcbbd6f88cb852c2c549814f908e", + "url": "https://api.github.com/repos/propelorm/Propel2/zipball/bbb64a859790230bf2e8ea83e1f26f7253adf685", + "reference": "bbb64a859790230bf2e8ea83e1f26f7253adf685", "shasum": "" }, "require": { - "php": ">=5.5", - "psr/log": "~1.0", - "symfony/config": "~2.3||~3.0||~4.0", - "symfony/console": "~2.3||~3.0||~4.0", - "symfony/filesystem": "~2.3||~3.0||~4.0", - "symfony/finder": "~2.3||~3.0||~4.0", - "symfony/validator": "~2.3||~3.0.0||~3.1.0||^3.2.4||~4.0", - "symfony/yaml": "~2.3||~3.0||~4.0" + "php": ">=7.4", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/config": "^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/console": "^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/filesystem": "^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/finder": "^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/translation": "^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/validator": "^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/yaml": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "require-dev": { - "monolog/monolog": "~1.3", - "phpunit/phpunit": "~4.0||~5.0" + "ext-json": "*", + "ext-pdo": "*", + "ext-xml": "*", + "mikey179/vfsstream": "^1.6", + "monolog/monolog": "^1.3 || ^2.3 || ^3.0", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^9.5.0", + "psalm/phar": "^4.23", + "spryker/code-sniffer": "^0.17.2" }, "suggest": { "monolog/monolog": "The recommended logging library to use with Propel." }, + "default-branch": true, "bin": [ "bin/propel" ], @@ -1475,8 +1715,8 @@ } }, "autoload": { - "psr-0": { - "Propel": "src/" + "psr-4": { + "Propel\\": "src/Propel/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1489,38 +1729,37 @@ "email": "william.durand1@gmail.com" } ], - "description": "Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.", + "description": "Propel2 is an open-source Object-Relational Mapping (ORM) for PHP.", "homepage": "http://www.propelorm.org/", "keywords": [ "Active Record", "orm", "persistence" ], - "time": "2019-11-08T13:12:55+00:00" + "support": { + "issues": "https://github.com/propelorm/Propel2/issues", + "source": "https://github.com/propelorm/Propel2/tree/master" + }, + "time": "2024-12-10T13:03:49+00:00" }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1533,7 +1772,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -1545,25 +1784,29 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/http-client", - "version": "1.0.0", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "496a823ef742b632934724bf769560c2a5c7c44e" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/496a823ef742b632934724bf769560c2a5c7c44e", - "reference": "496a823ef742b632934724bf769560c2a5c7c44e", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { - "php": "^7.0", - "psr/http-message": "^1.0" + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -1583,7 +1826,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -1594,25 +1837,28 @@ "psr", "psr-18" ], - "time": "2018-10-30T23:29:13+00:00" + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", - "psr/http-message": "^1.0" + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -1632,10 +1878,10 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -1646,29 +1892,32 @@ "request", "response" ], - "time": "2019-04-30T12:38:16+00:00" + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1696,20 +1945,23 @@ "request", "response" ], - "time": "2016-08-06T14:39:51+00:00" + "support": { + "source": "https://github.com/php-fig/http-message/tree/1.1" + }, + "time": "2023-04-04T09:50:52+00:00" }, { "name": "psr/log", - "version": "1.1.2", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -1733,7 +1985,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1743,7 +1995,10 @@ "psr", "psr-3" ], - "time": "2019-11-01T11:05:21+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" }, { "name": "ralouphie/getallheaders", @@ -1783,6 +2038,10 @@ } ], "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, "time": "2019-03-08T08:55:37+00:00" }, { @@ -1833,24 +2092,30 @@ "middleware", "slim" ], + "support": { + "issues": "https://github.com/slimphp/Slim-Csrf/issues", + "source": "https://github.com/slimphp/Slim-Csrf/tree/master" + }, "time": "2018-08-22T16:12:18+00:00" }, { "name": "slim/slim", - "version": "3.12.1", + "version": "3.12.5", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "eaee12ef8d0750db62b8c548016d82fb33addb6b" + "reference": "565632b2d9b64ecedf89546edbbf4f3648089f0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/eaee12ef8d0750db62b8c548016d82fb33addb6b", - "reference": "eaee12ef8d0750db62b8c548016d82fb33addb6b", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/565632b2d9b64ecedf89546edbbf4f3648089f0c", + "reference": "565632b2d9b64ecedf89546edbbf4f3648089f0c", "shasum": "" }, "require": { - "container-interop/container-interop": "^1.2", + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", "nikic/fast-route": "^1.0", "php": ">=5.5.0", "pimple/pimple": "^3.0", @@ -1862,7 +2127,7 @@ }, "require-dev": { "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.5" + "squizlabs/php_codesniffer": "^3.6.0" }, "type": "library", "autoload": { @@ -1875,25 +2140,25 @@ "MIT" ], "authors": [ - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, { "name": "Josh Lockhart", "email": "hello@joshlockhart.com", "homepage": "https://joshlockhart.com" }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - }, { "name": "Andrew Smith", "email": "a.smith@silentworks.co.uk", "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", @@ -1904,26 +2169,40 @@ "micro", "router" ], - "time": "2019-04-16T16:47:29+00:00" + "support": { + "issues": "https://github.com/slimphp/Slim/issues", + "source": "https://github.com/slimphp/Slim/tree/3.12.5" + }, + "funding": [ + { + "url": "https://opencollective.com/slimphp", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slim/slim", + "type": "tidelift" + } + ], + "time": "2023-07-23T04:32:51+00:00" }, { "name": "slim/twig-view", - "version": "2.5.0", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/slimphp/Twig-View.git", - "reference": "06ef39b58d60b11a9546893fd0b7fff2bd901798" + "reference": "47bd5cc1cbbdf5196d0873ece0ee97c6c7b352e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/06ef39b58d60b11a9546893fd0b7fff2bd901798", - "reference": "06ef39b58d60b11a9546893fd0b7fff2bd901798", + "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/47bd5cc1cbbdf5196d0873ece0ee97c6c7b352e9", + "reference": "47bd5cc1cbbdf5196d0873ece0ee97c6c7b352e9", "shasum": "" }, "require": { "php": ">=5.5.0", "psr/http-message": "^1.0", - "twig/twig": "^1.38|^2.7" + "twig/twig": "^1.38|^2.7|^3.0" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.7", @@ -1955,46 +2234,48 @@ "twig", "view" ], - "time": "2019-04-06T16:34:38+00:00" + "support": { + "issues": "https://github.com/slimphp/Twig-View/issues", + "source": "https://github.com/slimphp/Twig-View/tree/master" + }, + "time": "2019-11-28T18:03:50+00:00" }, { "name": "symfony/config", - "version": "v3.4.22", + "version": "v5.4.46", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "c9bc510c217075d42d4a927e285917d0c2001cf4" + "reference": "977c88a02d7d3f16904a81907531b19666a08e78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/c9bc510c217075d42d4a927e285917d0c2001cf4", - "reference": "c9bc510c217075d42d4a927e285917d0c2001cf4", + "url": "https://api.github.com/repos/symfony/config/zipball/977c88a02d7d3f16904a81907531b19666a08e78", + "reference": "977c88a02d7d3f16904a81907531b19666a08e78", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^4.4|^5.0|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22" }, "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" + "symfony/finder": "<4.4" }, "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" @@ -2017,43 +2298,69 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Config Component", + "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", - "time": "2019-01-30T11:33:42+00:00" + "support": { + "source": "https://github.com/symfony/config/tree/v5.4.46" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-30T07:58:02+00:00" }, { "name": "symfony/console", - "version": "v3.4.22", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be" + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/069bf3f0e8f871a2169a06e43d9f3f03f355e9be", - "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be", + "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2062,11 +2369,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -2089,46 +2391,63 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", - "time": "2019-01-25T10:42:12+00:00" + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T11:30:55+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.22", + "name": "symfony/deprecation-contracts", + "version": "v2.5.4", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8", - "reference": "667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "php": ">=7.1" }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { - "dev-master": "3.4-dev" + "dev-main": "2.5-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2137,42 +2456,59 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "time": "2019-01-25T10:19:25+00:00" + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.22", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b52454ec66fe5082b7a66a491339d1f1da9a5a0d" + "reference": "57c8294ed37d4a055b77057827c67f9558c95c54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b52454ec66fe5082b7a66a491339d1f1da9a5a0d", - "reference": "b52454ec66fe5082b7a66a491339d1f1da9a5a0d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/57c8294ed37d4a055b77057827c67f9558c95c54", + "reference": "57c8294ed37d4a055b77057827c67f9558c95c54", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } + "require-dev": { + "symfony/process": "^5.4|^6.4" }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -2195,33 +2531,47 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", - "time": "2019-01-16T13:27:11+00:00" + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-22T13:05:35+00:00" }, { "name": "symfony/finder", - "version": "v3.4.1", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a" + "reference": "63741784cd7b9967975eec610b256eed3ede022b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a", - "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a", + "url": "https://api.github.com/repos/symfony/finder/zipball/63741784cd7b9967975eec610b256eed3ede022b", + "reference": "63741784cd7b9967975eec610b256eed3ede022b", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -2244,33 +2594,48 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", - "time": "2017-11-05T16:10:10+00:00" + "support": { + "source": "https://github.com/symfony/finder/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-28T13:32:08+00:00" }, { "name": "symfony/options-resolver", - "version": "v3.4.36", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "b224d20be60e6f7b55cd66914379a13a0b28651a" + "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b224d20be60e6f7b55cd66914379a13a0b28651a", - "reference": "b224d20be60e6f7b55cd66914379a13a0b28651a", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6", + "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" @@ -2293,48 +2658,69 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony OptionsResolver Component", + "description": "Provides an improved replacement for the array_replace PHP function", "homepage": "https://symfony.com", "keywords": [ "config", "configuration", "options" ], - "time": "2019-10-26T11:02:01+00:00" + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.13-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2358,41 +2744,59 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.11.0", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.11-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2408,66 +2812,70 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "grapheme", + "intl", "polyfill", "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/translation", - "version": "v3.4.1", + "name": "symfony/polyfill-intl-idn", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "e05b0a5996ad7a35ba3a19ffad8b72c9daa64dfa" + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e05b0a5996ad7a35ba3a19ffad8b72c9daa64dfa", - "reference": "e05b0a5996ad7a35ba3a19ffad8b72c9daa64dfa", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773", + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/yaml": "~3.4|~4.0" + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" }, "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.4-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2475,82 +2883,925 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Translation Component", + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", "homepage": "https://symfony.com", - "time": "2017-11-27T14:23:00+00:00" + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/validator", - "version": "v3.4.1", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/validator.git", - "reference": "1a46cfa4f80ddbd82a01d0980fcf646940cea5bb" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/1a46cfa4f80ddbd82a01d0980fcf646940cea5bb", - "reference": "1a46cfa4f80ddbd82a01d0980fcf646940cea5bb", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation": "~2.8|~3.0|~4.0" + "php": ">=7.2" }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/dependency-injection": "<3.3", - "symfony/http-kernel": "<3.3.5", - "symfony/yaml": "<3.4" + "suggest": { + "ext-intl": "For best performance" }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "egulias/email-validator": "^1.2.8|~2.0", - "symfony/cache": "~3.1|~4.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "^3.3.5|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/property-access": "~2.8|~3.0|~4.0", - "symfony/var-dumper": "~3.3|~4.0", - "symfony/yaml": "~3.4|~4.0" + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "metapackage", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "psr/cache-implementation": "For using the metadata cache.", + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-10T20:33:58+00:00" + }, + { + "name": "symfony/translation", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "98f26acc99341ca4bab345fb14d7b1d7cb825bed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/98f26acc99341ca4bab345fb14d7b1d7cb825bed", + "reference": "98f26acc99341ca4bab345fb14d7b1d7cb825bed", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^2.3" + }, + "conflict": { + "symfony/config": "<4.4", + "symfony/console": "<5.3", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" + }, + "provide": { + "symfony/translation-implementation": "2.3" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-kernel": "^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", - "symfony/expression-language": "For using the Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For accessing properties within comparison constraints", "symfony/yaml": "" }, "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "450d4172653f38818657022252f9d81be89ee9a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/450d4172653f38818657022252f9d81be89ee9a8", + "reference": "450d4172653f38818657022252f9d81be89ee9a8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { - "dev-master": "3.4-dev" + "dev-main": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/validator", + "version": "v5.4.48", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "883667679d93d6c30f1b7490d669801712d3be2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/883667679d93d6c30f1b7490d669801712d3be2f", + "reference": "883667679d93d6c30f1b7490d669801712d3be2f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22", + "symfony/translation-contracts": "^1.1|^2|^3" + }, + "conflict": { + "doctrine/annotations": "<1.13", + "doctrine/cache": "<1.11", + "doctrine/lexer": "<1.1", + "symfony/dependency-injection": "<4.4", + "symfony/expression-language": "<5.1", + "symfony/http-kernel": "<4.4", + "symfony/intl": "<4.4", + "symfony/property-info": "<5.3", + "symfony/translation": "<5.4.35|>=6.0,<6.3.12|>=6.4,<6.4.3", + "symfony/yaml": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.13|^2", + "doctrine/cache": "^1.11|^2.0", + "egulias/email-validator": "^2.1.10|^3|^4", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^5.1|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/property-info": "^5.3|^6.0", + "symfony/translation": "^5.4.35|~6.3.12|^6.4.3", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "suggest": { + "egulias/email-validator": "Strict (RFC compliant) email validation", + "psr/cache-implementation": "For using the mapping cache.", + "symfony/config": "", + "symfony/expression-language": "For using the Expression validator and the ExpressionLanguageSyntax constraints", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/property-info": "To automatically add NotNull and Type constraints", + "symfony/translation": "For translating validation errors.", + "symfony/yaml": "" }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Validator\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "/Tests/", + "/Resources/bin/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2567,43 +3818,59 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Validator Component", + "description": "Provides tools to validate values", "homepage": "https://symfony.com", - "time": "2017-12-04T12:17:59+00:00" + "support": { + "source": "https://github.com/symfony/validator/tree/v5.4.48" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-27T08:58:20+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.27", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996" + "reference": "a454d47278cc16a5db371fe73ae66a78a633371e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/212a27b731e5bfb735679d1ffaac82bd6a1dc996", - "reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a454d47278cc16a5db371fe73ae66a78a633371e", + "reference": "a454d47278cc16a5db371fe73ae66a78a633371e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<3.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, + "bin": [ + "Resources/bin/yaml-lint" + ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -2626,9 +3893,26 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", - "time": "2019-03-25T07:48:46+00:00" + "support": { + "source": "https://github.com/symfony/yaml/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" }, { "name": "techwilk/twig-linewrap", @@ -2672,6 +3956,10 @@ "linewrap", "twig" ], + "support": { + "issues": "https://github.com/TechWilk/twig-linewrap/issues", + "source": "https://github.com/TechWilk/twig-linewrap/tree/master" + }, "time": "2017-07-06T18:40:14+00:00" }, { @@ -2717,6 +4005,10 @@ "twig", "value" ], + "support": { + "issues": "https://github.com/TechWilk/twig-slim-csrf/issues", + "source": "https://github.com/TechWilk/twig-slim-csrf/tree/master" + }, "time": "2017-12-10T17:36:31+00:00" }, { @@ -2772,36 +4064,41 @@ "i18n", "text" ], + "support": { + "issues": "https://github.com/twigphp/Twig-extensions/issues", + "source": "https://github.com/twigphp/Twig-extensions/tree/master" + }, + "abandoned": true, "time": "2018-12-05T18:34:18+00:00" }, { "name": "twig/twig", - "version": "v2.9.0", + "version": "v2.16.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "82a1c055c8ed4c4705023bfd0405f3c74db6e3ae" + "reference": "19185947ec75d433a3ac650af32fc05649b95ee1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/82a1c055c8ed4c4705023bfd0405f3c74db6e3ae", - "reference": "82a1c055c8ed4c4705023bfd0405f3c74db6e3ae", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/19185947ec75d433a3ac650af32fc05649b95ee1", + "reference": "19185947ec75d433a3ac650af32fc05649b95ee1", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.1.3", "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.8" }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + "symfony/phpunit-bridge": "^5.4.9|^6.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.9-dev" + "dev-master": "2.16-dev" } }, "autoload": { @@ -2823,15 +4120,14 @@ "homepage": "http://fabien.potencier.org", "role": "Lead Developer" }, + { + "name": "Twig Team", + "role": "Contributors" + }, { "name": "Armin Ronacher", "email": "armin.ronacher@active-4.com", "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", - "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -2839,33 +4135,53 @@ "keywords": [ "templating" ], - "time": "2019-04-28T06:57:38+00:00" + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v2.16.1" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2024-09-09T17:53:56+00:00" }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.11.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "url": "https://github.com/webmozarts/assert.git", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2887,42 +4203,42 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.11.0" + }, + "time": "2022-06-03T18:03:27+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.3.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -2936,7 +4252,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -2945,137 +4261,61 @@ "constructor", "instantiate" ], - "time": "2019-10-21T16:45:58+00:00" - }, - { - "name": "guzzle/guzzle", - "version": "v3.9.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle3.git", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, - "require-dev": { - "doctrine/cache": "~1.3", - "monolog/monolog": "~1.0", - "phpunit/phpunit": "3.7.*", - "psr/log": "~1.0", - "symfony/class-loader": "~2.1", - "zendframework/zend-cache": "2.*,<2.3", - "zendframework/zend-log": "2.*,<2.3" - }, - "suggest": { - "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.9-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle": "src/", - "Guzzle\\Tests": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" }, { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" } ], - "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "abandoned": "guzzlehttp/guzzle", - "time": "2015-03-18T18:23:50+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "024473a478be9df5fdaca2c793f2232fe788e414" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", + "reference": "024473a478be9df5fdaca2c793f2232fe788e414", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3089,359 +4329,172 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2018-08-07T13:53:10+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" + }, + "funding": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" } ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-09-12T14:27:41+00:00" + "time": "2025-02-12T12:17:51+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "1.0.1", + "name": "phar-io/manifest", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { - "php": "^7.1", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" } ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" + "time": "2024-03-03T12:33:53+00:00" }, { - "name": "phpspec/prophecy", - "version": "1.9.0", + "name": "phar-io/version", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2019-10-03T11:07:50+00:00" + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "40a4ed114a4aea5afd6df8d0f0c9cd3033097f66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/40a4ed114a4aea5afd6df8d0f0c9cd3033097f66", + "reference": "40a4ed114a4aea5afd6df8d0f0c9cd3033097f66", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -3467,27 +4520,37 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.17" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:09:37+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "69deeb8664f611f156a924154985fbd4911eb36b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/69deeb8664f611f156a924154985fbd4911eb36b", + "reference": "69deeb8664f611f156a924154985fbd4911eb36b", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -3517,7 +4580,17 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:39:50+00:00" }, { "name": "phpunit/php-text-template", @@ -3558,27 +4631,31 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "a691211e94ff39a34811abd521c31bd5b305b0bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/a691211e94ff39a34811abd521c31bd5b305b0bb", + "reference": "a691211e94ff39a34811abd521c31bd5b305b0bb", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -3607,33 +4684,43 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:42:41+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.1.1", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -3656,57 +4743,63 @@ "keywords": [ "tokenizer" ], - "time": "2019-09-17T06:23:10+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.18", + "version": "8.5.41", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" + "reference": "d843cb5bcf0bf9ae3484016444fe0c5b6ec7e4fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d843cb5bcf0bf9ae3484016444fe0c5b6ec7e4fa", + "reference": "d843cb5bcf0bf9ae3484016444fe0c5b6ec7e4fa", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.5.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.12.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=7.2", + "phpunit/php-code-coverage": "^7.0.17", + "phpunit/php-file-iterator": "^2.0.6", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "phpunit/php-timer": "^2.1.4", + "sebastian/comparator": "^3.0.5", + "sebastian/diff": "^3.0.6", + "sebastian/environment": "^4.2.5", + "sebastian/exporter": "^3.1.6", + "sebastian/global-state": "^3.0.5", + "sebastian/object-enumerator": "^3.0.5", + "sebastian/resource-operations": "^2.0.3", + "sebastian/type": "^1.1.5", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage", + "phpunit/php-invoker": "To allow enforcing time limits" }, "bin": [ "phpunit" @@ -3714,7 +4807,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -3740,20 +4833,39 @@ "testing", "xunit" ], - "time": "2019-12-06T05:14:37+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.41" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2024-12-05T13:44:26+00:00" }, { "name": "satooshi/php-coveralls", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/php-coveralls/php-coveralls.git", - "reference": "3b00c229726f892bfdadeaf01ea430ffd04a939d" + "reference": "3e6420fa666ef7bae5e750ddeac903153e193bae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/3b00c229726f892bfdadeaf01ea430ffd04a939d", - "reference": "3b00c229726f892bfdadeaf01ea430ffd04a939d", + "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/3e6420fa666ef7bae5e750ddeac903153e193bae", + "reference": "3e6420fa666ef7bae5e750ddeac903153e193bae", "shasum": "" }, "require": { @@ -3762,10 +4874,10 @@ "guzzlehttp/guzzle": "^6.0", "php": "^5.5 || ^7.0", "psr/log": "^1.0", - "symfony/config": "^2.1 || ^3.0 || ^4.0", - "symfony/console": "^2.1 || ^3.0 || ^4.0", - "symfony/stopwatch": "^2.0 || ^3.0 || ^4.0", - "symfony/yaml": "^2.0 || ^3.0 || ^4.0" + "symfony/config": "^2.1 || ^3.0 || ^4.0 || ^5.0", + "symfony/console": "^2.1 || ^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^2.0 || ^3.0 || ^4.0 || ^5.0", + "symfony/yaml": "^2.0.5 || ^3.0 || ^4.0 || ^5.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0" @@ -3779,7 +4891,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -3823,28 +4935,32 @@ "github", "test" ], + "support": { + "issues": "https://github.com/php-coveralls/php-coveralls/issues", + "source": "https://github.com/php-coveralls/php-coveralls/tree/v2.2.0" + }, "abandoned": "php-coveralls/php-coveralls", - "time": "2018-05-22T23:11:08+00:00" + "time": "2019-11-20T16:29:20+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -3869,29 +4985,39 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:45:45+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", "shasum": "" }, "require": { - "php": "^7.1", + "php": ">=7.1", "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -3909,6 +5035,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -3920,10 +5050,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -3933,24 +5059,34 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:31:48+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "98ff311ca519c3aa73ccd3de053bdb377171d7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/98ff311ca519c3aa73ccd3de053bdb377171d7b6", + "reference": "98ff311ca519c3aa73ccd3de053bdb377171d7b6", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.5 || ^8.0", @@ -3972,13 +5108,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -3989,24 +5125,34 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:16:36+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "4.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "56932f6049a0482853056ffd617c91ffcc754205" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/56932f6049a0482853056ffd617c91ffcc754205", + "reference": "56932f6049a0482853056ffd617c91ffcc754205", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.5" @@ -4042,29 +5188,39 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:49:59+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "3.1.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "1939bc8fd1d39adcfa88c5b35335910869214c56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1939bc8fd1d39adcfa88c5b35335910869214c56", + "reference": "1939bc8fd1d39adcfa88c5b35335910869214c56", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.2", "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -4109,27 +5265,40 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:21:38+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "91c7c47047a971f02de57ed6f040087ef110c5d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/91c7c47047a971f02de57ed6f040087ef110c5d9", + "reference": "91c7c47047a971f02de57ed6f040087ef110c5d9", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -4137,7 +5306,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -4160,24 +5329,34 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:13:16+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "ac5b293dba925751b808e02923399fb44ff0d541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ac5b293dba925751b808e02923399fb44ff0d541", + "reference": "ac5b293dba925751b808e02923399fb44ff0d541", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.0", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, @@ -4207,24 +5386,34 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:54:02+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1d439c229e61f244ff1f211e5c99737f90c67def", + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -4252,24 +5441,34 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:56:04+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/9bfd3c6f1f08c026f542032dfb42813544f7d64c", + "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -4290,14 +5489,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -4305,24 +5504,34 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T14:07:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + "reference": "72a7f7674d053d548003b16ff5a106e7e0e06eee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/72a7f7674d053d548003b16ff5a106e7e0e06eee", + "reference": "72a7f7674d053d548003b16ff5a106e7e0e06eee", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "type": "library", "extra": { @@ -4347,29 +5556,41 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "support": { + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T13:59:09+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/type", + "version": "1.1.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "18f071c3a29892b037d35e6b20ddf3ea39b42874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/18f071c3a29892b037d35e6b20ddf3ea39b42874", + "reference": "18f071c3a29892b037d35e6b20ddf3ea39b42874", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -4388,93 +5609,86 @@ "role": "lead" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T14:04:07+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v2.8.32", + "name": "sebastian/version", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b59aacf238fadda50d612c9de73b74751872a903" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b59aacf238fadda50d612c9de73b74751872a903", - "reference": "b59aacf238fadda50d612c9de73b74751872a903", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-11-05T15:25:56+00:00" + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.4.22", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58" + "reference": "fb2c199cf302eb207f8c23e7ee174c1c31a5c004" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2a651c2645c10bbedd21170771f122d935e0dd58", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fb2c199cf302eb207f8c23e7ee174c1c31a5c004", + "reference": "fb2c199cf302eb207f8c23e7ee174c1c31a5c004", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.2.5", + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" @@ -4497,29 +5711,46 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Provides a way to profile code", "homepage": "https://symfony.com", - "time": "2019-01-16T09:39:14+00:00" + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.3", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -4539,7 +5770,17 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], @@ -4552,6 +5793,7 @@ "platform": [], "platform-dev": [], "platform-overrides": { - "php": "7.1.0" - } + "php": "7.4.0" + }, + "plugin-api-version": "2.3.0" } diff --git a/generated-classes/TechWilk/Rota/Base/Availability.php b/generated-classes/TechWilk/Rota/Base/Availability.php index a790cec9..c837b0f5 100644 --- a/generated-classes/TechWilk/Rota/Base/Availability.php +++ b/generated-classes/TechWilk/Rota/Base/Availability.php @@ -33,19 +33,21 @@ abstract class Availability implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\AvailabilityTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\AvailabilityTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -54,14 +56,14 @@ abstract class Availability implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -95,7 +97,7 @@ abstract class Availability implements ActiveRecordInterface /** * The value for the comment field. * - * @var string + * @var string|null */ protected $comment; @@ -113,7 +115,7 @@ abstract class Availability implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -123,7 +125,7 @@ abstract class Availability implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->available = true; } @@ -140,9 +142,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -150,10 +152,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -162,7 +164,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -172,9 +174,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -183,45 +185,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -230,10 +230,10 @@ public function resetModified($col = null) * obj is an instance of Availability, delegates to * equals(Availability). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -255,7 +255,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -263,10 +263,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -274,15 +274,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -291,12 +291,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Availability The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -306,13 +306,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -323,24 +323,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -348,7 +351,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -408,7 +411,7 @@ public function isAvailable() /** * Get the [comment] column value. * - * @return string + * @return string|null */ public function getComment() { @@ -418,8 +421,8 @@ public function getComment() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -433,13 +436,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [eventid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setEventId($v) { @@ -457,13 +460,13 @@ public function setEventId($v) } return $this; - } // setEventId() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -481,7 +484,7 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Sets the value of the [available] column. @@ -490,8 +493,8 @@ public function setUserId($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setAvailable($v) { @@ -509,13 +512,13 @@ public function setAvailable($v) } return $this; - } // setAvailable() + } /** * Set the value of [comment] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setComment($v) { @@ -529,7 +532,7 @@ public function setComment($v) } return $this; - } // setComment() + } /** * Indicates whether the columns in this object are only set to default values. @@ -537,17 +540,17 @@ public function setComment($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->available !== true) { - return false; - } + if ($this->available !== true) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -557,19 +560,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AvailabilityTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -584,8 +588,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AvailabilityTableMap::translateFieldName('Comment', TableMap::TYPE_PHPNAME, $indexType)]; $this->comment = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -593,6 +597,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 5; // 5 = AvailabilityTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Availability'), 0, $e); } @@ -609,9 +614,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aEvent !== null && $this->eventid !== $this->aEvent->getId()) { $this->aEvent = null; @@ -619,19 +625,19 @@ public function ensureConsistency() if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -666,13 +672,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Availability::setDeleted() * @see Availability::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -702,12 +708,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -752,12 +758,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -794,22 +800,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[AvailabilityTableMap::COL_ID] = true; @@ -846,18 +853,23 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'eventId': $stmt->bindValue($identifier, $this->eventid, PDO::PARAM_INT); + break; case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'available': $stmt->bindValue($identifier, (int) $this->available, PDO::PARAM_INT); + break; case 'comment': $stmt->bindValue($identifier, $this->comment, PDO::PARAM_STR); + break; } } @@ -880,12 +892,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -896,14 +908,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = AvailabilityTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -915,30 +927,29 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getEventId(); - break; + case 2: return $this->getUserId(); - break; + case 3: return $this->getAvailable(); - break; + case 4: return $this->getComment(); - break; + default: return null; - break; } // switch() } @@ -948,29 +959,29 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Availability'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Availability'][$this->hashCode()] = true; $keys = AvailabilityTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getEventId(), $keys[2] => $this->getUserId(), $keys[3] => $this->getAvailable(), $keys[4] => $this->getComment(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -978,6 +989,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -989,9 +1001,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aEvent) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'event'; @@ -1003,7 +1016,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Event'; } - $result[$key] = $this->aEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1013,30 +1026,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Availability + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = AvailabilityTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Availability + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1072,11 +1087,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = AvailabilityTableMap::getFieldNames($keyType); @@ -1095,6 +1110,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[4], $arr)) { $this->setComment($arr[$keys[4]]); } + + return $this; } /** @@ -1114,9 +1131,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Availability The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1130,9 +1147,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(AvailabilityTableMap::DATABASE_NAME); @@ -1159,13 +1176,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildAvailabilityQuery::create(); $criteria->add(AvailabilityTableMap::COL_ID, $this->id); @@ -1177,7 +1194,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1207,19 +1224,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1230,12 +1248,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Availability (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Availability (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setEventId($this->getEventId()); $copyObj->setUserId($this->getUserId()); @@ -1243,7 +1262,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setComment($this->getComment()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1255,11 +1274,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Availability Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1272,14 +1291,14 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { if ($v === null) { - $this->setUserId(null); + $this->setUserId(NULL); } else { $this->setUserId($v->getId()); } @@ -1300,11 +1319,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1323,14 +1342,14 @@ public function getUser(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildEvent object. * - * @param ChildEvent $v - * @return $this|\TechWilk\Rota\Availability The current object (for fluent API support) - * @throws PropelException + * @param ChildEvent $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEvent(ChildEvent $v = null) { if ($v === null) { - $this->setEventId(null); + $this->setEventId(NULL); } else { $this->setEventId($v->getId()); } @@ -1351,11 +1370,11 @@ public function setEvent(ChildEvent $v = null) /** * Get the associated ChildEvent object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildEvent The associated ChildEvent object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvent(ConnectionInterface $con = null) + public function getEvent(?ConnectionInterface $con = null) { if ($this->aEvent === null && ($this->eventid != 0)) { $this->aEvent = ChildEventQuery::create()->findPk($this->eventid, $con); @@ -1375,6 +1394,8 @@ public function getEvent(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1395,6 +1416,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1403,15 +1426,17 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; $this->aEvent = null; + return $this; } /** @@ -1426,99 +1451,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1528,7 +1533,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1548,17 +1553,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/AvailabilityQuery.php b/generated-classes/TechWilk/Rota/Base/AvailabilityQuery.php index 02649ac2..df45a891 100644 --- a/generated-classes/TechWilk/Rota/Base/AvailabilityQuery.php +++ b/generated-classes/TechWilk/Rota/Base/AvailabilityQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\AvailabilityTableMap; /** - * Base class that represents a query for the 'availability' table. - * - * + * Base class that represents a query for the `availability` table. * * @method ChildAvailabilityQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildAvailabilityQuery orderByEventId($order = Criteria::ASC) Order by the eventId column @@ -62,17 +61,17 @@ * * @method \TechWilk\Rota\UserQuery|\TechWilk\Rota\EventQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildAvailability findOne(ConnectionInterface $con = null) Return the first ChildAvailability matching the query - * @method ChildAvailability findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAvailability matching the query, or a new ChildAvailability object populated from the query conditions when no match is found + * @method ChildAvailability|null findOne(?ConnectionInterface $con = null) Return the first ChildAvailability matching the query + * @method ChildAvailability findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildAvailability matching the query, or a new ChildAvailability object populated from the query conditions when no match is found * - * @method ChildAvailability findOneById(int $id) Return the first ChildAvailability filtered by the id column - * @method ChildAvailability findOneByEventId(int $eventId) Return the first ChildAvailability filtered by the eventId column - * @method ChildAvailability findOneByUserId(int $userId) Return the first ChildAvailability filtered by the userId column - * @method ChildAvailability findOneByAvailable(boolean $available) Return the first ChildAvailability filtered by the available column - * @method ChildAvailability findOneByComment(string $comment) Return the first ChildAvailability filtered by the comment column * - - * @method ChildAvailability requirePk($key, ConnectionInterface $con = null) Return the ChildAvailability by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildAvailability requireOne(ConnectionInterface $con = null) Return the first ChildAvailability matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildAvailability|null findOneById(int $id) Return the first ChildAvailability filtered by the id column + * @method ChildAvailability|null findOneByEventId(int $eventId) Return the first ChildAvailability filtered by the eventId column + * @method ChildAvailability|null findOneByUserId(int $userId) Return the first ChildAvailability filtered by the userId column + * @method ChildAvailability|null findOneByAvailable(boolean $available) Return the first ChildAvailability filtered by the available column + * @method ChildAvailability|null findOneByComment(string $comment) Return the first ChildAvailability filtered by the comment column + * + * @method ChildAvailability requirePk($key, ?ConnectionInterface $con = null) Return the ChildAvailability by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildAvailability requireOne(?ConnectionInterface $con = null) Return the first ChildAvailability matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildAvailability requireOneById(int $id) Return the first ChildAvailability filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildAvailability requireOneByEventId(int $eventId) Return the first ChildAvailability filtered by the eventId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -80,14 +79,22 @@ * @method ChildAvailability requireOneByAvailable(boolean $available) Return the first ChildAvailability filtered by the available column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildAvailability requireOneByComment(string $comment) Return the first ChildAvailability filtered by the comment column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildAvailability[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildAvailability objects based on current ModelCriteria - * @method ChildAvailability[]|ObjectCollection findById(int $id) Return ChildAvailability objects filtered by the id column - * @method ChildAvailability[]|ObjectCollection findByEventId(int $eventId) Return ChildAvailability objects filtered by the eventId column - * @method ChildAvailability[]|ObjectCollection findByUserId(int $userId) Return ChildAvailability objects filtered by the userId column - * @method ChildAvailability[]|ObjectCollection findByAvailable(boolean $available) Return ChildAvailability objects filtered by the available column - * @method ChildAvailability[]|ObjectCollection findByComment(string $comment) Return ChildAvailability objects filtered by the comment column - * @method ChildAvailability[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildAvailability[]|Collection find(?ConnectionInterface $con = null) Return ChildAvailability objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildAvailability objects based on current ModelCriteria + * + * @method ChildAvailability[]|Collection findById(int|array $id) Return ChildAvailability objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildAvailability objects filtered by the id column + * @method ChildAvailability[]|Collection findByEventId(int|array $eventId) Return ChildAvailability objects filtered by the eventId column + * @psalm-method Collection&\Traversable findByEventId(int|array $eventId) Return ChildAvailability objects filtered by the eventId column + * @method ChildAvailability[]|Collection findByUserId(int|array $userId) Return ChildAvailability objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserId(int|array $userId) Return ChildAvailability objects filtered by the userId column + * @method ChildAvailability[]|Collection findByAvailable(boolean|array $available) Return ChildAvailability objects filtered by the available column + * @psalm-method Collection&\Traversable findByAvailable(boolean|array $available) Return ChildAvailability objects filtered by the available column + * @method ChildAvailability[]|Collection findByComment(string|array $comment) Return ChildAvailability objects filtered by the comment column + * @psalm-method Collection&\Traversable findByComment(string|array $comment) Return ChildAvailability objects filtered by the comment column * + * @method ChildAvailability[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class AvailabilityQuery extends ModelCriteria { @@ -96,9 +103,9 @@ abstract class AvailabilityQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\AvailabilityQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Availability', $modelAlias = null) { @@ -108,12 +115,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildAvailabilityQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildAvailabilityQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildAvailabilityQuery) { return $criteria; @@ -143,7 +150,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildAvailability|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -175,8 +182,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -208,8 +215,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildAvailability|array|mixed the result, formatted by the current formatter */ @@ -229,12 +236,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -251,25 +258,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(AvailabilityTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(AvailabilityTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(AvailabilityTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(AvailabilityTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -282,15 +295,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -310,7 +323,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(AvailabilityTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(AvailabilityTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -325,15 +340,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByEvent() * - * @param mixed $eventId The value to use as filter. + * @param mixed $eventId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventId($eventId = null, $comparison = null) + public function filterByEventId($eventId = null, ?string $comparison = null) { if (is_array($eventId)) { $useMinMax = false; @@ -353,7 +368,9 @@ public function filterByEventId($eventId = null, $comparison = null) } } - return $this->addUsingAlias(AvailabilityTableMap::COL_EVENTID, $eventId, $comparison); + $this->addUsingAlias(AvailabilityTableMap::COL_EVENTID, $eventId, $comparison); + + return $this; } /** @@ -368,15 +385,15 @@ public function filterByEventId($eventId = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -396,7 +413,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(AvailabilityTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(AvailabilityTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -408,22 +427,24 @@ public function filterByUserId($userId = null, $comparison = null) * $query->filterByAvailable('yes'); // WHERE available = true * * - * @param boolean|string $available The value to use as filter. + * @param bool|string $available The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAvailable($available = null, $comparison = null) + public function filterByAvailable($available = null, ?string $comparison = null) { if (is_string($available)) { - $available = in_array(strtolower($available), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $available = in_array(strtolower($available), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(AvailabilityTableMap::COL_AVAILABLE, $available, $comparison); + $this->addUsingAlias(AvailabilityTableMap::COL_AVAILABLE, $available, $comparison); + + return $this; } /** @@ -433,14 +454,15 @@ public function filterByAvailable($available = null, $comparison = null) * * $query->filterByComment('fooValue'); // WHERE comment = 'fooValue' * $query->filterByComment('%fooValue%', Criteria::LIKE); // WHERE comment LIKE '%fooValue%' + * $query->filterByComment(['foo', 'bar']); // WHERE comment IN ('foo', 'bar') * * - * @param string $comment The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $comment The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByComment($comment = null, $comparison = null) + public function filterByComment($comment = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($comment)) { @@ -448,20 +470,22 @@ public function filterByComment($comment = null, $comparison = null) } } - return $this->addUsingAlias(AvailabilityTableMap::COL_COMMENT, $comment, $comparison); + $this->addUsingAlias(AvailabilityTableMap::COL_COMMENT, $comment, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -471,8 +495,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(AvailabilityTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -481,12 +507,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -515,9 +541,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -528,17 +554,113 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { return $this @@ -548,8 +670,10 @@ public function filterByEvent($event, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(AvailabilityTableMap::COL_EVENTID, $event->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -558,12 +682,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -592,9 +716,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -605,12 +729,108 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildAvailability $availability Object to remove from the list of results + * @param ChildAvailability $availability Object to remove from the list of results * - * @return $this|ChildAvailabilityQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($availability = null) { @@ -627,7 +847,7 @@ public function prune($availability = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(AvailabilityTableMap::DATABASE_NAME); @@ -652,12 +872,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(AvailabilityTableMap::DATABASE_NAME); @@ -681,4 +901,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // AvailabilityQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/CalendarToken.php b/generated-classes/TechWilk/Rota/Base/CalendarToken.php index 6b5968b3..ec7a3df0 100644 --- a/generated-classes/TechWilk/Rota/Base/CalendarToken.php +++ b/generated-classes/TechWilk/Rota/Base/CalendarToken.php @@ -17,7 +17,6 @@ use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use TechWilk\Rota\CalendarToken as ChildCalendarToken; use TechWilk\Rota\CalendarTokenQuery as ChildCalendarTokenQuery; use TechWilk\Rota\User as ChildUser; use TechWilk\Rota\UserQuery as ChildUserQuery; @@ -34,19 +33,21 @@ abstract class CalendarToken implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -55,14 +56,14 @@ abstract class CalendarToken implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -95,7 +96,7 @@ abstract class CalendarToken implements ActiveRecordInterface /** * The value for the description field. * - * @var string + * @var string|null */ protected $description; @@ -110,28 +111,28 @@ abstract class CalendarToken implements ActiveRecordInterface /** * The value for the revokeddate field. * - * @var DateTime + * @var DateTime|null */ protected $revokeddate; /** * The value for the lastfetched field. * - * @var DateTime + * @var DateTime|null */ protected $lastfetched; /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; @@ -144,7 +145,7 @@ abstract class CalendarToken implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -154,7 +155,7 @@ abstract class CalendarToken implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->revoked = false; } @@ -171,9 +172,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -181,10 +182,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -193,7 +194,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -203,9 +204,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -214,45 +215,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -261,10 +260,10 @@ public function resetModified($col = null) * obj is an instance of CalendarToken, delegates to * equals(CalendarToken). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -286,7 +285,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -294,10 +293,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -305,15 +304,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -322,12 +321,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|CalendarToken The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -337,13 +336,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -354,24 +353,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -379,7 +381,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -429,7 +431,7 @@ public function getFormat() /** * Get the [description] column value. * - * @return string + * @return string|null */ public function getDescription() { @@ -460,12 +462,14 @@ public function isRevoked() * Get the [optionally formatted] temporal [revokeddate] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getRevokedDate($format = null) { @@ -480,12 +484,14 @@ public function getRevokedDate($format = null) * Get the [optionally formatted] temporal [lastfetched] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getLastFetched($format = null) { @@ -500,12 +506,14 @@ public function getLastFetched($format = null) * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -520,12 +528,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -539,8 +549,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -554,13 +564,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [token] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setToken($v) { @@ -574,13 +584,13 @@ public function setToken($v) } return $this; - } // setToken() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserid($v) { @@ -598,13 +608,13 @@ public function setUserid($v) } return $this; - } // setUserid() + } /** * Set the value of [format] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setFormat($v) { @@ -618,13 +628,13 @@ public function setFormat($v) } return $this; - } // setFormat() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -638,7 +648,7 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Sets the value of the [revoked] column. @@ -647,8 +657,8 @@ public function setDescription($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setRevoked($v) { @@ -666,14 +676,14 @@ public function setRevoked($v) } return $this; - } // setRevoked() + } /** * Sets the value of [revokeddate] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setRevokedDate($v) { @@ -686,14 +696,14 @@ public function setRevokedDate($v) } // if either are not null return $this; - } // setRevokedDate() + } /** * Sets the value of [lastfetched] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setLastFetched($v) { @@ -706,14 +716,14 @@ public function setLastFetched($v) } // if either are not null return $this; - } // setLastFetched() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -726,14 +736,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -746,7 +756,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -754,17 +764,17 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->revoked !== false) { - return false; - } + if ($this->revoked !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -774,19 +784,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CalendarTokenTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -828,8 +839,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -837,6 +848,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 10; // 10 = CalendarTokenTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\CalendarToken'), 0, $e); } @@ -853,26 +865,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -906,13 +919,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see CalendarToken::setDeleted() * @see CalendarToken::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -942,12 +955,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -967,12 +980,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(CalendarTokenTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(CalendarTokenTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -1004,12 +1018,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -1039,22 +1053,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[CalendarTokenTableMap::COL_ID] = true; @@ -1106,33 +1121,43 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'token': $stmt->bindValue($identifier, $this->token, PDO::PARAM_STR); + break; case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'format': $stmt->bindValue($identifier, $this->format, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'revoked': $stmt->bindValue($identifier, (int) $this->revoked, PDO::PARAM_INT); + break; case 'revokedDate': $stmt->bindValue($identifier, $this->revokeddate ? $this->revokeddate->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'lastFetched': $stmt->bindValue($identifier, $this->lastfetched ? $this->lastfetched->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -1155,12 +1180,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1171,14 +1196,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = CalendarTokenTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1190,45 +1215,44 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getToken(); - break; + case 2: return $this->getUserid(); - break; + case 3: return $this->getFormat(); - break; + case 4: return $this->getDescription(); - break; + case 5: return $this->getRevoked(); - break; + case 6: return $this->getRevokedDate(); - break; + case 7: return $this->getLastFetched(); - break; + case 8: return $this->getCreated(); - break; + case 9: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -1238,23 +1262,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['CalendarToken'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['CalendarToken'][$this->hashCode()] = true; $keys = CalendarTokenTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getToken(), $keys[2] => $this->getUserid(), @@ -1265,21 +1289,21 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[7] => $this->getLastFetched(), $keys[8] => $this->getCreated(), $keys[9] => $this->getUpdated(), - ); + ]; if ($result[$keys[6]] instanceof \DateTimeInterface) { - $result[$keys[6]] = $result[$keys[6]]->format('c'); + $result[$keys[6]] = $result[$keys[6]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[7]] instanceof \DateTimeInterface) { - $result[$keys[7]] = $result[$keys[7]]->format('c'); + $result[$keys[7]] = $result[$keys[7]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[8]] instanceof \DateTimeInterface) { - $result[$keys[8]] = $result[$keys[8]]->format('c'); + $result[$keys[8]] = $result[$keys[8]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[9]] instanceof \DateTimeInterface) { - $result[$keys[9]] = $result[$keys[9]]->format('c'); + $result[$keys[9]] = $result[$keys[9]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1289,6 +1313,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1300,7 +1325,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1310,30 +1335,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\CalendarToken + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = CalendarTokenTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\CalendarToken + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1384,11 +1411,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = CalendarTokenTableMap::getFieldNames($keyType); @@ -1422,6 +1449,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[9], $arr)) { $this->setUpdated($arr[$keys[9]]); } + + return $this; } /** @@ -1441,9 +1470,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\CalendarToken The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1457,9 +1486,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(CalendarTokenTableMap::DATABASE_NAME); @@ -1501,13 +1530,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildCalendarTokenQuery::create(); $criteria->add(CalendarTokenTableMap::COL_ID, $this->id); @@ -1519,7 +1548,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1549,19 +1578,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1572,12 +1602,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\CalendarToken (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\CalendarToken (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setToken($this->getToken()); $copyObj->setUserid($this->getUserid()); @@ -1590,7 +1621,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setUpdated($this->getUpdated()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1602,11 +1633,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\CalendarToken Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1619,14 +1650,14 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\CalendarToken The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { if ($v === null) { - $this->setUserid(null); + $this->setUserid(NULL); } else { $this->setUserid($v->getId()); } @@ -1647,11 +1678,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1671,6 +1702,8 @@ public function getUser(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1693,6 +1726,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1701,14 +1736,16 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; + return $this; } /** @@ -1726,7 +1763,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildCalendarToken The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -1737,99 +1774,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1839,7 +1856,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1859,17 +1876,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/CalendarTokenQuery.php b/generated-classes/TechWilk/Rota/Base/CalendarTokenQuery.php index c3bad779..f13e42a8 100644 --- a/generated-classes/TechWilk/Rota/Base/CalendarTokenQuery.php +++ b/generated-classes/TechWilk/Rota/Base/CalendarTokenQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\CalendarTokenTableMap; /** - * Base class that represents a query for the 'calendarTokens' table. - * - * + * Base class that represents a query for the `calendarTokens` table. * * @method ChildCalendarTokenQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCalendarTokenQuery orderByToken($order = Criteria::ASC) Order by the token column @@ -62,22 +61,22 @@ * * @method \TechWilk\Rota\UserQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildCalendarToken findOne(ConnectionInterface $con = null) Return the first ChildCalendarToken matching the query - * @method ChildCalendarToken findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCalendarToken matching the query, or a new ChildCalendarToken object populated from the query conditions when no match is found + * @method ChildCalendarToken|null findOne(?ConnectionInterface $con = null) Return the first ChildCalendarToken matching the query + * @method ChildCalendarToken findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildCalendarToken matching the query, or a new ChildCalendarToken object populated from the query conditions when no match is found + * + * @method ChildCalendarToken|null findOneById(int $id) Return the first ChildCalendarToken filtered by the id column + * @method ChildCalendarToken|null findOneByToken(string $token) Return the first ChildCalendarToken filtered by the token column + * @method ChildCalendarToken|null findOneByUserid(int $userId) Return the first ChildCalendarToken filtered by the userId column + * @method ChildCalendarToken|null findOneByFormat(string $format) Return the first ChildCalendarToken filtered by the format column + * @method ChildCalendarToken|null findOneByDescription(string $description) Return the first ChildCalendarToken filtered by the description column + * @method ChildCalendarToken|null findOneByRevoked(boolean $revoked) Return the first ChildCalendarToken filtered by the revoked column + * @method ChildCalendarToken|null findOneByRevokedDate(string $revokedDate) Return the first ChildCalendarToken filtered by the revokedDate column + * @method ChildCalendarToken|null findOneByLastFetched(string $lastFetched) Return the first ChildCalendarToken filtered by the lastFetched column + * @method ChildCalendarToken|null findOneByCreated(string $created) Return the first ChildCalendarToken filtered by the created column + * @method ChildCalendarToken|null findOneByUpdated(string $updated) Return the first ChildCalendarToken filtered by the updated column * - * @method ChildCalendarToken findOneById(int $id) Return the first ChildCalendarToken filtered by the id column - * @method ChildCalendarToken findOneByToken(string $token) Return the first ChildCalendarToken filtered by the token column - * @method ChildCalendarToken findOneByUserid(int $userId) Return the first ChildCalendarToken filtered by the userId column - * @method ChildCalendarToken findOneByFormat(string $format) Return the first ChildCalendarToken filtered by the format column - * @method ChildCalendarToken findOneByDescription(string $description) Return the first ChildCalendarToken filtered by the description column - * @method ChildCalendarToken findOneByRevoked(boolean $revoked) Return the first ChildCalendarToken filtered by the revoked column - * @method ChildCalendarToken findOneByRevokedDate(string $revokedDate) Return the first ChildCalendarToken filtered by the revokedDate column - * @method ChildCalendarToken findOneByLastFetched(string $lastFetched) Return the first ChildCalendarToken filtered by the lastFetched column - * @method ChildCalendarToken findOneByCreated(string $created) Return the first ChildCalendarToken filtered by the created column - * @method ChildCalendarToken findOneByUpdated(string $updated) Return the first ChildCalendarToken filtered by the updated column * - - * @method ChildCalendarToken requirePk($key, ConnectionInterface $con = null) Return the ChildCalendarToken by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildCalendarToken requireOne(ConnectionInterface $con = null) Return the first ChildCalendarToken matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildCalendarToken requirePk($key, ?ConnectionInterface $con = null) Return the ChildCalendarToken by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildCalendarToken requireOne(?ConnectionInterface $con = null) Return the first ChildCalendarToken matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildCalendarToken requireOneById(int $id) Return the first ChildCalendarToken filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildCalendarToken requireOneByToken(string $token) Return the first ChildCalendarToken filtered by the token column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -90,19 +89,32 @@ * @method ChildCalendarToken requireOneByCreated(string $created) Return the first ChildCalendarToken filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildCalendarToken requireOneByUpdated(string $updated) Return the first ChildCalendarToken filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildCalendarToken[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildCalendarToken objects based on current ModelCriteria - * @method ChildCalendarToken[]|ObjectCollection findById(int $id) Return ChildCalendarToken objects filtered by the id column - * @method ChildCalendarToken[]|ObjectCollection findByToken(string $token) Return ChildCalendarToken objects filtered by the token column - * @method ChildCalendarToken[]|ObjectCollection findByUserid(int $userId) Return ChildCalendarToken objects filtered by the userId column - * @method ChildCalendarToken[]|ObjectCollection findByFormat(string $format) Return ChildCalendarToken objects filtered by the format column - * @method ChildCalendarToken[]|ObjectCollection findByDescription(string $description) Return ChildCalendarToken objects filtered by the description column - * @method ChildCalendarToken[]|ObjectCollection findByRevoked(boolean $revoked) Return ChildCalendarToken objects filtered by the revoked column - * @method ChildCalendarToken[]|ObjectCollection findByRevokedDate(string $revokedDate) Return ChildCalendarToken objects filtered by the revokedDate column - * @method ChildCalendarToken[]|ObjectCollection findByLastFetched(string $lastFetched) Return ChildCalendarToken objects filtered by the lastFetched column - * @method ChildCalendarToken[]|ObjectCollection findByCreated(string $created) Return ChildCalendarToken objects filtered by the created column - * @method ChildCalendarToken[]|ObjectCollection findByUpdated(string $updated) Return ChildCalendarToken objects filtered by the updated column - * @method ChildCalendarToken[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildCalendarToken[]|Collection find(?ConnectionInterface $con = null) Return ChildCalendarToken objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildCalendarToken objects based on current ModelCriteria * + * @method ChildCalendarToken[]|Collection findById(int|array $id) Return ChildCalendarToken objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildCalendarToken objects filtered by the id column + * @method ChildCalendarToken[]|Collection findByToken(string|array $token) Return ChildCalendarToken objects filtered by the token column + * @psalm-method Collection&\Traversable findByToken(string|array $token) Return ChildCalendarToken objects filtered by the token column + * @method ChildCalendarToken[]|Collection findByUserid(int|array $userId) Return ChildCalendarToken objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserid(int|array $userId) Return ChildCalendarToken objects filtered by the userId column + * @method ChildCalendarToken[]|Collection findByFormat(string|array $format) Return ChildCalendarToken objects filtered by the format column + * @psalm-method Collection&\Traversable findByFormat(string|array $format) Return ChildCalendarToken objects filtered by the format column + * @method ChildCalendarToken[]|Collection findByDescription(string|array $description) Return ChildCalendarToken objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildCalendarToken objects filtered by the description column + * @method ChildCalendarToken[]|Collection findByRevoked(boolean|array $revoked) Return ChildCalendarToken objects filtered by the revoked column + * @psalm-method Collection&\Traversable findByRevoked(boolean|array $revoked) Return ChildCalendarToken objects filtered by the revoked column + * @method ChildCalendarToken[]|Collection findByRevokedDate(string|array $revokedDate) Return ChildCalendarToken objects filtered by the revokedDate column + * @psalm-method Collection&\Traversable findByRevokedDate(string|array $revokedDate) Return ChildCalendarToken objects filtered by the revokedDate column + * @method ChildCalendarToken[]|Collection findByLastFetched(string|array $lastFetched) Return ChildCalendarToken objects filtered by the lastFetched column + * @psalm-method Collection&\Traversable findByLastFetched(string|array $lastFetched) Return ChildCalendarToken objects filtered by the lastFetched column + * @method ChildCalendarToken[]|Collection findByCreated(string|array $created) Return ChildCalendarToken objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildCalendarToken objects filtered by the created column + * @method ChildCalendarToken[]|Collection findByUpdated(string|array $updated) Return ChildCalendarToken objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildCalendarToken objects filtered by the updated column + * + * @method ChildCalendarToken[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class CalendarTokenQuery extends ModelCriteria { @@ -111,9 +123,9 @@ abstract class CalendarTokenQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\CalendarTokenQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\CalendarToken', $modelAlias = null) { @@ -123,12 +135,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildCalendarTokenQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildCalendarTokenQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildCalendarTokenQuery) { return $criteria; @@ -158,7 +170,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildCalendarToken|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -190,8 +202,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -223,8 +235,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildCalendarToken|array|mixed the result, formatted by the current formatter */ @@ -244,12 +256,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -266,25 +278,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(CalendarTokenTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(CalendarTokenTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(CalendarTokenTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(CalendarTokenTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -297,15 +315,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -325,7 +343,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -335,14 +355,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByToken('fooValue'); // WHERE token = 'fooValue' * $query->filterByToken('%fooValue%', Criteria::LIKE); // WHERE token LIKE '%fooValue%' + * $query->filterByToken(['foo', 'bar']); // WHERE token IN ('foo', 'bar') * * - * @param string $token The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $token The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByToken($token = null, $comparison = null) + public function filterByToken($token = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($token)) { @@ -350,7 +371,9 @@ public function filterByToken($token = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_TOKEN, $token, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_TOKEN, $token, $comparison); + + return $this; } /** @@ -365,15 +388,15 @@ public function filterByToken($token = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userid The value to use as filter. + * @param mixed $userid The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserid($userid = null, $comparison = null) + public function filterByUserid($userid = null, ?string $comparison = null) { if (is_array($userid)) { $useMinMax = false; @@ -393,7 +416,9 @@ public function filterByUserid($userid = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_USERID, $userid, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_USERID, $userid, $comparison); + + return $this; } /** @@ -403,14 +428,15 @@ public function filterByUserid($userid = null, $comparison = null) * * $query->filterByFormat('fooValue'); // WHERE format = 'fooValue' * $query->filterByFormat('%fooValue%', Criteria::LIKE); // WHERE format LIKE '%fooValue%' + * $query->filterByFormat(['foo', 'bar']); // WHERE format IN ('foo', 'bar') * * - * @param string $format The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $format The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByFormat($format = null, $comparison = null) + public function filterByFormat($format = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($format)) { @@ -418,7 +444,9 @@ public function filterByFormat($format = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_FORMAT, $format, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_FORMAT, $format, $comparison); + + return $this; } /** @@ -428,14 +456,15 @@ public function filterByFormat($format = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -443,7 +472,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -455,22 +486,24 @@ public function filterByDescription($description = null, $comparison = null) * $query->filterByRevoked('yes'); // WHERE revoked = true * * - * @param boolean|string $revoked The value to use as filter. + * @param bool|string $revoked The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRevoked($revoked = null, $comparison = null) + public function filterByRevoked($revoked = null, ?string $comparison = null) { if (is_string($revoked)) { - $revoked = in_array(strtolower($revoked), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $revoked = in_array(strtolower($revoked), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(CalendarTokenTableMap::COL_REVOKED, $revoked, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_REVOKED, $revoked, $comparison); + + return $this; } /** @@ -483,17 +516,17 @@ public function filterByRevoked($revoked = null, $comparison = null) * $query->filterByRevokedDate(array('max' => 'yesterday')); // WHERE revokedDate > '2011-03-13' * * - * @param mixed $revokedDate The value to use as filter. + * @param mixed $revokedDate The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRevokedDate($revokedDate = null, $comparison = null) + public function filterByRevokedDate($revokedDate = null, ?string $comparison = null) { if (is_array($revokedDate)) { $useMinMax = false; @@ -513,7 +546,9 @@ public function filterByRevokedDate($revokedDate = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_REVOKEDDATE, $revokedDate, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_REVOKEDDATE, $revokedDate, $comparison); + + return $this; } /** @@ -526,17 +561,17 @@ public function filterByRevokedDate($revokedDate = null, $comparison = null) * $query->filterByLastFetched(array('max' => 'yesterday')); // WHERE lastFetched > '2011-03-13' * * - * @param mixed $lastFetched The value to use as filter. + * @param mixed $lastFetched The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLastFetched($lastFetched = null, $comparison = null) + public function filterByLastFetched($lastFetched = null, ?string $comparison = null) { if (is_array($lastFetched)) { $useMinMax = false; @@ -556,7 +591,9 @@ public function filterByLastFetched($lastFetched = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_LASTFETCHED, $lastFetched, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_LASTFETCHED, $lastFetched, $comparison); + + return $this; } /** @@ -569,17 +606,17 @@ public function filterByLastFetched($lastFetched = null, $comparison = null) * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -599,7 +636,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -612,17 +651,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -642,20 +681,22 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(CalendarTokenTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(CalendarTokenTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -665,8 +706,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(CalendarTokenTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -675,12 +718,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -709,9 +752,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -722,12 +765,108 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildCalendarToken $calendarToken Object to remove from the list of results + * @param ChildCalendarToken $calendarToken Object to remove from the list of results * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($calendarToken = null) { @@ -744,7 +883,7 @@ public function prune($calendarToken = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CalendarTokenTableMap::DATABASE_NAME); @@ -769,12 +908,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CalendarTokenTableMap::DATABASE_NAME); @@ -804,64 +943,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(CalendarTokenTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(CalendarTokenTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(CalendarTokenTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(CalendarTokenTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(CalendarTokenTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(CalendarTokenTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(CalendarTokenTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(CalendarTokenTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(CalendarTokenTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(CalendarTokenTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildCalendarTokenQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(CalendarTokenTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(CalendarTokenTableMap::COL_CREATED); + + return $this; } -} // CalendarTokenQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Comment.php b/generated-classes/TechWilk/Rota/Base/Comment.php index cbec3a4b..332cef62 100644 --- a/generated-classes/TechWilk/Rota/Base/Comment.php +++ b/generated-classes/TechWilk/Rota/Base/Comment.php @@ -17,7 +17,6 @@ use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use TechWilk\Rota\Comment as ChildComment; use TechWilk\Rota\CommentQuery as ChildCommentQuery; use TechWilk\Rota\Event as ChildEvent; use TechWilk\Rota\EventQuery as ChildEventQuery; @@ -36,19 +35,21 @@ abstract class Comment implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\CommentTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\CommentTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -57,14 +58,14 @@ abstract class Comment implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -92,7 +93,7 @@ abstract class Comment implements ActiveRecordInterface /** * The value for the text field. * - * @var string + * @var string|null */ protected $text; @@ -100,21 +101,21 @@ abstract class Comment implements ActiveRecordInterface * The value for the removed field. * * Note: this column has a database default value of: false - * @var boolean + * @var boolean|null */ protected $removed; /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; @@ -132,7 +133,7 @@ abstract class Comment implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -142,7 +143,7 @@ abstract class Comment implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->eventid = 0; $this->userid = 0; @@ -161,9 +162,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -171,10 +172,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -183,7 +184,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -193,9 +194,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -204,45 +205,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -251,10 +250,10 @@ public function resetModified($col = null) * obj is an instance of Comment, delegates to * equals(Comment). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -276,7 +275,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -284,10 +283,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -295,15 +294,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -312,12 +311,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Comment The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -327,13 +326,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -344,24 +343,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -369,7 +371,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -409,7 +411,7 @@ public function getUserId() /** * Get the [text] column value. * - * @return string + * @return string|null */ public function getText() { @@ -419,7 +421,7 @@ public function getText() /** * Get the [removed] column value. * - * @return boolean + * @return boolean|null */ public function getRemoved() { @@ -429,7 +431,7 @@ public function getRemoved() /** * Get the [removed] column value. * - * @return boolean + * @return boolean|null */ public function isRemoved() { @@ -440,12 +442,14 @@ public function isRemoved() * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -460,12 +464,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -479,8 +485,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -494,13 +500,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [eventid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setEventId($v) { @@ -518,13 +524,13 @@ public function setEventId($v) } return $this; - } // setEventId() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -542,13 +548,13 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Set the value of [text] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setText($v) { @@ -562,7 +568,7 @@ public function setText($v) } return $this; - } // setText() + } /** * Sets the value of the [removed] column. @@ -571,8 +577,8 @@ public function setText($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @param bool|integer|string|null $v The new value + * @return $this The current object (for fluent API support) */ public function setRemoved($v) { @@ -590,14 +596,14 @@ public function setRemoved($v) } return $this; - } // setRemoved() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -610,14 +616,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -630,7 +636,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -638,25 +644,25 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->eventid !== 0) { - return false; - } + if ($this->eventid !== 0) { + return false; + } - if ($this->userid !== 0) { - return false; - } + if ($this->userid !== 0) { + return false; + } - if ($this->removed !== false) { - return false; - } + if ($this->removed !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -666,19 +672,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CommentTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -705,8 +712,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -714,6 +721,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 7; // 7 = CommentTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Comment'), 0, $e); } @@ -730,9 +738,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aEvent !== null && $this->eventid !== $this->aEvent->getId()) { $this->aEvent = null; @@ -740,19 +749,19 @@ public function ensureConsistency() if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -787,13 +796,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Comment::setDeleted() * @see Comment::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -823,12 +832,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -848,12 +857,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(CommentTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(CommentTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -885,12 +895,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -927,22 +937,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[CommentTableMap::COL_ID] = true; @@ -985,24 +996,31 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'eventId': $stmt->bindValue($identifier, $this->eventid, PDO::PARAM_INT); + break; case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'text': $stmt->bindValue($identifier, $this->text, PDO::PARAM_STR); + break; case 'removed': $stmt->bindValue($identifier, (int) $this->removed, PDO::PARAM_INT); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -1025,12 +1043,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1041,14 +1059,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = CommentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1060,36 +1078,35 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getEventId(); - break; + case 2: return $this->getUserId(); - break; + case 3: return $this->getText(); - break; + case 4: return $this->getRemoved(); - break; + case 5: return $this->getCreated(); - break; + case 6: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -1099,23 +1116,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Comment'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Comment'][$this->hashCode()] = true; $keys = CommentTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getEventId(), $keys[2] => $this->getUserId(), @@ -1123,13 +1140,13 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[4] => $this->getRemoved(), $keys[5] => $this->getCreated(), $keys[6] => $this->getUpdated(), - ); + ]; if ($result[$keys[5]] instanceof \DateTimeInterface) { - $result[$keys[5]] = $result[$keys[5]]->format('c'); + $result[$keys[5]] = $result[$keys[5]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[6]] instanceof \DateTimeInterface) { - $result[$keys[6]] = $result[$keys[6]]->format('c'); + $result[$keys[6]] = $result[$keys[6]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1139,6 +1156,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aEvent) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'event'; @@ -1150,9 +1168,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Event'; } - $result[$key] = $this->aEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1164,7 +1183,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1174,30 +1193,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Comment + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = CommentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Comment + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1239,11 +1260,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = CommentTableMap::getFieldNames($keyType); @@ -1268,6 +1289,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[6], $arr)) { $this->setUpdated($arr[$keys[6]]); } + + return $this; } /** @@ -1287,9 +1310,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Comment The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1303,9 +1326,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(CommentTableMap::DATABASE_NAME); @@ -1338,13 +1361,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildCommentQuery::create(); $criteria->add(CommentTableMap::COL_ID, $this->id); @@ -1356,7 +1379,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1386,19 +1409,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1409,12 +1433,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Comment (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Comment (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setEventId($this->getEventId()); $copyObj->setUserId($this->getUserId()); @@ -1424,7 +1449,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setUpdated($this->getUpdated()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1436,11 +1461,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Comment Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1453,9 +1478,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildEvent object. * - * @param ChildEvent $v - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) - * @throws PropelException + * @param ChildEvent $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEvent(ChildEvent $v = null) { @@ -1481,11 +1506,11 @@ public function setEvent(ChildEvent $v = null) /** * Get the associated ChildEvent object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildEvent The associated ChildEvent object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvent(ConnectionInterface $con = null) + public function getEvent(?ConnectionInterface $con = null) { if ($this->aEvent === null && ($this->eventid != 0)) { $this->aEvent = ChildEventQuery::create()->findPk($this->eventid, $con); @@ -1504,9 +1529,9 @@ public function getEvent(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\Comment The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { @@ -1532,11 +1557,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1556,6 +1581,8 @@ public function getUser(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1578,6 +1605,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1586,15 +1615,17 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aEvent = null; $this->aUser = null; + return $this; } /** @@ -1612,7 +1643,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildComment The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -1623,99 +1654,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1725,7 +1736,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1745,17 +1756,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/CommentQuery.php b/generated-classes/TechWilk/Rota/Base/CommentQuery.php index 56f45965..d329c284 100644 --- a/generated-classes/TechWilk/Rota/Base/CommentQuery.php +++ b/generated-classes/TechWilk/Rota/Base/CommentQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\CommentTableMap; /** - * Base class that represents a query for the 'comments' table. - * - * + * Base class that represents a query for the `comments` table. * * @method ChildCommentQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCommentQuery orderByEventId($order = Criteria::ASC) Order by the eventId column @@ -66,19 +65,19 @@ * * @method \TechWilk\Rota\EventQuery|\TechWilk\Rota\UserQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildComment findOne(ConnectionInterface $con = null) Return the first ChildComment matching the query - * @method ChildComment findOneOrCreate(ConnectionInterface $con = null) Return the first ChildComment matching the query, or a new ChildComment object populated from the query conditions when no match is found + * @method ChildComment|null findOne(?ConnectionInterface $con = null) Return the first ChildComment matching the query + * @method ChildComment findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildComment matching the query, or a new ChildComment object populated from the query conditions when no match is found + * + * @method ChildComment|null findOneById(int $id) Return the first ChildComment filtered by the id column + * @method ChildComment|null findOneByEventId(int $eventId) Return the first ChildComment filtered by the eventId column + * @method ChildComment|null findOneByUserId(int $userId) Return the first ChildComment filtered by the userId column + * @method ChildComment|null findOneByText(string $text) Return the first ChildComment filtered by the text column + * @method ChildComment|null findOneByRemoved(boolean $removed) Return the first ChildComment filtered by the removed column + * @method ChildComment|null findOneByCreated(string $created) Return the first ChildComment filtered by the created column + * @method ChildComment|null findOneByUpdated(string $updated) Return the first ChildComment filtered by the updated column * - * @method ChildComment findOneById(int $id) Return the first ChildComment filtered by the id column - * @method ChildComment findOneByEventId(int $eventId) Return the first ChildComment filtered by the eventId column - * @method ChildComment findOneByUserId(int $userId) Return the first ChildComment filtered by the userId column - * @method ChildComment findOneByText(string $text) Return the first ChildComment filtered by the text column - * @method ChildComment findOneByRemoved(boolean $removed) Return the first ChildComment filtered by the removed column - * @method ChildComment findOneByCreated(string $created) Return the first ChildComment filtered by the created column - * @method ChildComment findOneByUpdated(string $updated) Return the first ChildComment filtered by the updated column * - - * @method ChildComment requirePk($key, ConnectionInterface $con = null) Return the ChildComment by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildComment requireOne(ConnectionInterface $con = null) Return the first ChildComment matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildComment requirePk($key, ?ConnectionInterface $con = null) Return the ChildComment by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildComment requireOne(?ConnectionInterface $con = null) Return the first ChildComment matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildComment requireOneById(int $id) Return the first ChildComment filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildComment requireOneByEventId(int $eventId) Return the first ChildComment filtered by the eventId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -88,16 +87,26 @@ * @method ChildComment requireOneByCreated(string $created) Return the first ChildComment filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildComment requireOneByUpdated(string $updated) Return the first ChildComment filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildComment[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildComment objects based on current ModelCriteria - * @method ChildComment[]|ObjectCollection findById(int $id) Return ChildComment objects filtered by the id column - * @method ChildComment[]|ObjectCollection findByEventId(int $eventId) Return ChildComment objects filtered by the eventId column - * @method ChildComment[]|ObjectCollection findByUserId(int $userId) Return ChildComment objects filtered by the userId column - * @method ChildComment[]|ObjectCollection findByText(string $text) Return ChildComment objects filtered by the text column - * @method ChildComment[]|ObjectCollection findByRemoved(boolean $removed) Return ChildComment objects filtered by the removed column - * @method ChildComment[]|ObjectCollection findByCreated(string $created) Return ChildComment objects filtered by the created column - * @method ChildComment[]|ObjectCollection findByUpdated(string $updated) Return ChildComment objects filtered by the updated column - * @method ChildComment[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildComment[]|Collection find(?ConnectionInterface $con = null) Return ChildComment objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildComment objects based on current ModelCriteria * + * @method ChildComment[]|Collection findById(int|array $id) Return ChildComment objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildComment objects filtered by the id column + * @method ChildComment[]|Collection findByEventId(int|array $eventId) Return ChildComment objects filtered by the eventId column + * @psalm-method Collection&\Traversable findByEventId(int|array $eventId) Return ChildComment objects filtered by the eventId column + * @method ChildComment[]|Collection findByUserId(int|array $userId) Return ChildComment objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserId(int|array $userId) Return ChildComment objects filtered by the userId column + * @method ChildComment[]|Collection findByText(string|array $text) Return ChildComment objects filtered by the text column + * @psalm-method Collection&\Traversable findByText(string|array $text) Return ChildComment objects filtered by the text column + * @method ChildComment[]|Collection findByRemoved(boolean|array $removed) Return ChildComment objects filtered by the removed column + * @psalm-method Collection&\Traversable findByRemoved(boolean|array $removed) Return ChildComment objects filtered by the removed column + * @method ChildComment[]|Collection findByCreated(string|array $created) Return ChildComment objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildComment objects filtered by the created column + * @method ChildComment[]|Collection findByUpdated(string|array $updated) Return ChildComment objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildComment objects filtered by the updated column + * + * @method ChildComment[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class CommentQuery extends ModelCriteria { @@ -106,9 +115,9 @@ abstract class CommentQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\CommentQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Comment', $modelAlias = null) { @@ -118,12 +127,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildCommentQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildCommentQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildCommentQuery) { return $criteria; @@ -153,7 +162,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildComment|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -185,8 +194,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -218,8 +227,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildComment|array|mixed the result, formatted by the current formatter */ @@ -239,12 +248,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -261,25 +270,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(CommentTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(CommentTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(CommentTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(CommentTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -292,15 +307,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -320,7 +335,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(CommentTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(CommentTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -335,15 +352,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByEvent() * - * @param mixed $eventId The value to use as filter. + * @param mixed $eventId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventId($eventId = null, $comparison = null) + public function filterByEventId($eventId = null, ?string $comparison = null) { if (is_array($eventId)) { $useMinMax = false; @@ -363,7 +380,9 @@ public function filterByEventId($eventId = null, $comparison = null) } } - return $this->addUsingAlias(CommentTableMap::COL_EVENTID, $eventId, $comparison); + $this->addUsingAlias(CommentTableMap::COL_EVENTID, $eventId, $comparison); + + return $this; } /** @@ -378,15 +397,15 @@ public function filterByEventId($eventId = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -406,7 +425,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(CommentTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(CommentTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -416,14 +437,15 @@ public function filterByUserId($userId = null, $comparison = null) * * $query->filterByText('fooValue'); // WHERE text = 'fooValue' * $query->filterByText('%fooValue%', Criteria::LIKE); // WHERE text LIKE '%fooValue%' + * $query->filterByText(['foo', 'bar']); // WHERE text IN ('foo', 'bar') * * - * @param string $text The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $text The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByText($text = null, $comparison = null) + public function filterByText($text = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($text)) { @@ -431,7 +453,9 @@ public function filterByText($text = null, $comparison = null) } } - return $this->addUsingAlias(CommentTableMap::COL_TEXT, $text, $comparison); + $this->addUsingAlias(CommentTableMap::COL_TEXT, $text, $comparison); + + return $this; } /** @@ -443,22 +467,24 @@ public function filterByText($text = null, $comparison = null) * $query->filterByRemoved('yes'); // WHERE removed = true * * - * @param boolean|string $removed The value to use as filter. + * @param bool|string $removed The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRemoved($removed = null, $comparison = null) + public function filterByRemoved($removed = null, ?string $comparison = null) { if (is_string($removed)) { - $removed = in_array(strtolower($removed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $removed = in_array(strtolower($removed), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(CommentTableMap::COL_REMOVED, $removed, $comparison); + $this->addUsingAlias(CommentTableMap::COL_REMOVED, $removed, $comparison); + + return $this; } /** @@ -471,17 +497,17 @@ public function filterByRemoved($removed = null, $comparison = null) * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -501,7 +527,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(CommentTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(CommentTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -514,17 +542,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -544,20 +572,22 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(CommentTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(CommentTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { return $this @@ -567,8 +597,10 @@ public function filterByEvent($event, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(CommentTableMap::COL_EVENTID, $event->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -577,12 +609,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -611,9 +643,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -624,17 +656,113 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -644,8 +772,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(CommentTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -654,12 +784,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -688,9 +818,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -701,12 +831,108 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildComment $comment Object to remove from the list of results + * @param ChildComment $comment Object to remove from the list of results * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($comment = null) { @@ -723,7 +949,7 @@ public function prune($comment = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CommentTableMap::DATABASE_NAME); @@ -748,12 +974,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CommentTableMap::DATABASE_NAME); @@ -783,64 +1009,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(CommentTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(CommentTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(CommentTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(CommentTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(CommentTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(CommentTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(CommentTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(CommentTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(CommentTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(CommentTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildCommentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(CommentTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(CommentTableMap::COL_CREATED); + + return $this; } -} // CommentQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Document.php b/generated-classes/TechWilk/Rota/Base/Document.php index d8773379..d963c172 100644 --- a/generated-classes/TechWilk/Rota/Base/Document.php +++ b/generated-classes/TechWilk/Rota/Base/Document.php @@ -29,19 +29,21 @@ abstract class Document implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\DocumentTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\DocumentTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -50,14 +52,14 @@ abstract class Document implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -100,7 +102,7 @@ abstract class Document implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -110,7 +112,7 @@ abstract class Document implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->title = ''; $this->url = ''; @@ -128,9 +130,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -138,10 +140,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -150,7 +152,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -160,9 +162,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -171,45 +173,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -218,10 +218,10 @@ public function resetModified($col = null) * obj is an instance of Document, delegates to * equals(Document). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -243,7 +243,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -251,10 +251,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -262,15 +262,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -279,12 +279,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Document The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -294,13 +294,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -311,24 +311,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -336,7 +339,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -396,8 +399,8 @@ public function getLink() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Document The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -411,13 +414,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [title] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Document The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setTitle($v) { @@ -431,13 +434,13 @@ public function setTitle($v) } return $this; - } // setTitle() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Document The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -451,13 +454,13 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Set the value of [url] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Document The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setUrl($v) { @@ -471,13 +474,13 @@ public function setUrl($v) } return $this; - } // setUrl() + } /** * Set the value of [link] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Document The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setLink($v) { @@ -491,7 +494,7 @@ public function setLink($v) } return $this; - } // setLink() + } /** * Indicates whether the columns in this object are only set to default values. @@ -499,21 +502,21 @@ public function setLink($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->title !== '') { - return false; - } + if ($this->title !== '') { + return false; + } - if ($this->url !== '') { - return false; - } + if ($this->url !== '') { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -523,19 +526,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : DocumentTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -550,8 +554,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : DocumentTableMap::translateFieldName('Link', TableMap::TYPE_PHPNAME, $indexType)]; $this->link = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -559,6 +563,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 5; // 5 = DocumentTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Document'), 0, $e); } @@ -575,23 +580,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -617,19 +623,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Document::setDeleted() * @see Document::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -659,12 +666,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -709,12 +716,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -732,22 +739,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[DocumentTableMap::COL_ID] = true; @@ -784,18 +792,23 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'title': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'url': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); + break; case 'link': $stmt->bindValue($identifier, $this->link, PDO::PARAM_STR); + break; } } @@ -818,12 +831,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -834,14 +847,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = DocumentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -853,30 +866,29 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getTitle(); - break; + case 2: return $this->getDescription(); - break; + case 3: return $this->getUrl(); - break; + case 4: return $this->getLink(); - break; + default: return null; - break; } // switch() } @@ -886,28 +898,28 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array()) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = []): array { if (isset($alreadyDumpedObjects['Document'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Document'][$this->hashCode()] = true; $keys = DocumentTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getTitle(), $keys[2] => $this->getDescription(), $keys[3] => $this->getUrl(), $keys[4] => $this->getLink(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -920,30 +932,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Document + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = DocumentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Document + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -979,11 +993,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = DocumentTableMap::getFieldNames($keyType); @@ -1002,6 +1016,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[4], $arr)) { $this->setLink($arr[$keys[4]]); } + + return $this; } /** @@ -1021,9 +1037,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Document The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1037,9 +1053,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(DocumentTableMap::DATABASE_NAME); @@ -1066,13 +1082,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildDocumentQuery::create(); $criteria->add(DocumentTableMap::COL_ID, $this->id); @@ -1084,7 +1100,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1114,19 +1130,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1137,12 +1154,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Document (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Document (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setTitle($this->getTitle()); $copyObj->setDescription($this->getDescription()); @@ -1150,7 +1168,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setLink($this->getLink()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1162,11 +1180,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Document Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1180,6 +1198,8 @@ public function copy($deepCopy = false) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1194,6 +1214,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1202,12 +1224,15 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) + + return $this; } /** @@ -1222,99 +1247,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1324,7 +1329,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1344,17 +1349,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/DocumentQuery.php b/generated-classes/TechWilk/Rota/Base/DocumentQuery.php index 66eca781..57073644 100644 --- a/generated-classes/TechWilk/Rota/Base/DocumentQuery.php +++ b/generated-classes/TechWilk/Rota/Base/DocumentQuery.php @@ -7,7 +7,7 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\Collection\ObjectCollection; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; use TechWilk\Rota\Document as ChildDocument; @@ -15,9 +15,7 @@ use TechWilk\Rota\Map\DocumentTableMap; /** - * Base class that represents a query for the 'documents' table. - * - * + * Base class that represents a query for the `documents` table. * * @method ChildDocumentQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildDocumentQuery orderByTitle($order = Criteria::ASC) Order by the title column @@ -39,17 +37,17 @@ * @method ChildDocumentQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query * @method ChildDocumentQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query * - * @method ChildDocument findOne(ConnectionInterface $con = null) Return the first ChildDocument matching the query - * @method ChildDocument findOneOrCreate(ConnectionInterface $con = null) Return the first ChildDocument matching the query, or a new ChildDocument object populated from the query conditions when no match is found + * @method ChildDocument|null findOne(?ConnectionInterface $con = null) Return the first ChildDocument matching the query + * @method ChildDocument findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildDocument matching the query, or a new ChildDocument object populated from the query conditions when no match is found * - * @method ChildDocument findOneById(int $id) Return the first ChildDocument filtered by the id column - * @method ChildDocument findOneByTitle(string $title) Return the first ChildDocument filtered by the title column - * @method ChildDocument findOneByDescription(string $description) Return the first ChildDocument filtered by the description column - * @method ChildDocument findOneByUrl(string $url) Return the first ChildDocument filtered by the url column - * @method ChildDocument findOneByLink(string $link) Return the first ChildDocument filtered by the link column * - - * @method ChildDocument requirePk($key, ConnectionInterface $con = null) Return the ChildDocument by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildDocument requireOne(ConnectionInterface $con = null) Return the first ChildDocument matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildDocument|null findOneById(int $id) Return the first ChildDocument filtered by the id column + * @method ChildDocument|null findOneByTitle(string $title) Return the first ChildDocument filtered by the title column + * @method ChildDocument|null findOneByDescription(string $description) Return the first ChildDocument filtered by the description column + * @method ChildDocument|null findOneByUrl(string $url) Return the first ChildDocument filtered by the url column + * @method ChildDocument|null findOneByLink(string $link) Return the first ChildDocument filtered by the link column + * + * @method ChildDocument requirePk($key, ?ConnectionInterface $con = null) Return the ChildDocument by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildDocument requireOne(?ConnectionInterface $con = null) Return the first ChildDocument matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildDocument requireOneById(int $id) Return the first ChildDocument filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildDocument requireOneByTitle(string $title) Return the first ChildDocument filtered by the title column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -57,14 +55,22 @@ * @method ChildDocument requireOneByUrl(string $url) Return the first ChildDocument filtered by the url column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildDocument requireOneByLink(string $link) Return the first ChildDocument filtered by the link column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildDocument[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildDocument objects based on current ModelCriteria - * @method ChildDocument[]|ObjectCollection findById(int $id) Return ChildDocument objects filtered by the id column - * @method ChildDocument[]|ObjectCollection findByTitle(string $title) Return ChildDocument objects filtered by the title column - * @method ChildDocument[]|ObjectCollection findByDescription(string $description) Return ChildDocument objects filtered by the description column - * @method ChildDocument[]|ObjectCollection findByUrl(string $url) Return ChildDocument objects filtered by the url column - * @method ChildDocument[]|ObjectCollection findByLink(string $link) Return ChildDocument objects filtered by the link column - * @method ChildDocument[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildDocument[]|Collection find(?ConnectionInterface $con = null) Return ChildDocument objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildDocument objects based on current ModelCriteria + * + * @method ChildDocument[]|Collection findById(int|array $id) Return ChildDocument objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildDocument objects filtered by the id column + * @method ChildDocument[]|Collection findByTitle(string|array $title) Return ChildDocument objects filtered by the title column + * @psalm-method Collection&\Traversable findByTitle(string|array $title) Return ChildDocument objects filtered by the title column + * @method ChildDocument[]|Collection findByDescription(string|array $description) Return ChildDocument objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildDocument objects filtered by the description column + * @method ChildDocument[]|Collection findByUrl(string|array $url) Return ChildDocument objects filtered by the url column + * @psalm-method Collection&\Traversable findByUrl(string|array $url) Return ChildDocument objects filtered by the url column + * @method ChildDocument[]|Collection findByLink(string|array $link) Return ChildDocument objects filtered by the link column + * @psalm-method Collection&\Traversable findByLink(string|array $link) Return ChildDocument objects filtered by the link column * + * @method ChildDocument[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class DocumentQuery extends ModelCriteria { @@ -73,9 +79,9 @@ abstract class DocumentQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\DocumentQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Document', $modelAlias = null) { @@ -85,12 +91,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildDocumentQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildDocumentQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildDocumentQuery) { return $criteria; @@ -120,7 +126,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildDocument|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -152,8 +158,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -185,8 +191,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildDocument|array|mixed the result, formatted by the current formatter */ @@ -206,12 +212,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -228,25 +234,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(DocumentTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(DocumentTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(DocumentTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(DocumentTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -259,15 +271,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -287,7 +299,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(DocumentTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(DocumentTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -297,14 +311,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' * $query->filterByTitle('%fooValue%', Criteria::LIKE); // WHERE title LIKE '%fooValue%' + * $query->filterByTitle(['foo', 'bar']); // WHERE title IN ('foo', 'bar') * * - * @param string $title The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $title The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTitle($title = null, $comparison = null) + public function filterByTitle($title = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($title)) { @@ -312,7 +327,9 @@ public function filterByTitle($title = null, $comparison = null) } } - return $this->addUsingAlias(DocumentTableMap::COL_TITLE, $title, $comparison); + $this->addUsingAlias(DocumentTableMap::COL_TITLE, $title, $comparison); + + return $this; } /** @@ -322,14 +339,15 @@ public function filterByTitle($title = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -337,7 +355,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(DocumentTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(DocumentTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -347,14 +367,15 @@ public function filterByDescription($description = null, $comparison = null) * * $query->filterByUrl('fooValue'); // WHERE url = 'fooValue' * $query->filterByUrl('%fooValue%', Criteria::LIKE); // WHERE url LIKE '%fooValue%' + * $query->filterByUrl(['foo', 'bar']); // WHERE url IN ('foo', 'bar') * * - * @param string $url The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $url The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUrl($url = null, $comparison = null) + public function filterByUrl($url = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($url)) { @@ -362,7 +383,9 @@ public function filterByUrl($url = null, $comparison = null) } } - return $this->addUsingAlias(DocumentTableMap::COL_URL, $url, $comparison); + $this->addUsingAlias(DocumentTableMap::COL_URL, $url, $comparison); + + return $this; } /** @@ -372,14 +395,15 @@ public function filterByUrl($url = null, $comparison = null) * * $query->filterByLink('fooValue'); // WHERE link = 'fooValue' * $query->filterByLink('%fooValue%', Criteria::LIKE); // WHERE link LIKE '%fooValue%' + * $query->filterByLink(['foo', 'bar']); // WHERE link IN ('foo', 'bar') * * - * @param string $link The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $link The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLink($link = null, $comparison = null) + public function filterByLink($link = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($link)) { @@ -387,15 +411,17 @@ public function filterByLink($link = null, $comparison = null) } } - return $this->addUsingAlias(DocumentTableMap::COL_LINK, $link, $comparison); + $this->addUsingAlias(DocumentTableMap::COL_LINK, $link, $comparison); + + return $this; } /** * Exclude object from result * - * @param ChildDocument $document Object to remove from the list of results + * @param ChildDocument $document Object to remove from the list of results * - * @return $this|ChildDocumentQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($document = null) { @@ -412,7 +438,7 @@ public function prune($document = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(DocumentTableMap::DATABASE_NAME); @@ -437,12 +463,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(DocumentTableMap::DATABASE_NAME); @@ -466,4 +492,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // DocumentQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Email.php b/generated-classes/TechWilk/Rota/Base/Email.php index bdace60c..b6935041 100644 --- a/generated-classes/TechWilk/Rota/Base/Email.php +++ b/generated-classes/TechWilk/Rota/Base/Email.php @@ -29,19 +29,21 @@ abstract class Email implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EmailTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EmailTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -50,14 +52,14 @@ abstract class Email implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -106,7 +108,7 @@ abstract class Email implements ActiveRecordInterface /** * The value for the error field. * - * @var string + * @var string|null */ protected $error; @@ -114,7 +116,7 @@ abstract class Email implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -124,7 +126,7 @@ abstract class Email implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->emailto = ''; $this->emailbcc = ''; @@ -142,9 +144,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -152,10 +154,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -164,7 +166,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -174,9 +176,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -185,45 +187,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -232,10 +232,10 @@ public function resetModified($col = null) * obj is an instance of Email, delegates to * equals(Email). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -257,7 +257,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -265,10 +265,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -276,15 +276,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -293,12 +293,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Email The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -308,13 +308,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -325,24 +325,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -350,7 +353,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -420,7 +423,7 @@ public function getMessage() /** * Get the [error] column value. * - * @return string + * @return string|null */ public function getError() { @@ -430,8 +433,8 @@ public function getError() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -445,13 +448,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [emailto] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setEmailTo($v) { @@ -465,13 +468,13 @@ public function setEmailTo($v) } return $this; - } // setEmailTo() + } /** * Set the value of [emailbcc] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setEmailBcc($v) { @@ -485,13 +488,13 @@ public function setEmailBcc($v) } return $this; - } // setEmailBcc() + } /** * Set the value of [emailfrom] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setEmailFrom($v) { @@ -505,13 +508,13 @@ public function setEmailFrom($v) } return $this; - } // setEmailFrom() + } /** * Set the value of [subject] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setSubject($v) { @@ -525,13 +528,13 @@ public function setSubject($v) } return $this; - } // setSubject() + } /** * Set the value of [message] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setMessage($v) { @@ -545,13 +548,13 @@ public function setMessage($v) } return $this; - } // setMessage() + } /** * Set the value of [error] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Email The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setError($v) { @@ -565,7 +568,7 @@ public function setError($v) } return $this; - } // setError() + } /** * Indicates whether the columns in this object are only set to default values. @@ -573,21 +576,21 @@ public function setError($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->emailto !== '') { - return false; - } + if ($this->emailto !== '') { + return false; + } - if ($this->emailbcc !== '') { - return false; - } + if ($this->emailbcc !== '') { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -597,19 +600,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : EmailTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -630,8 +634,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : EmailTableMap::translateFieldName('Error', TableMap::TYPE_PHPNAME, $indexType)]; $this->error = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -639,6 +643,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 7; // 7 = EmailTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Email'), 0, $e); } @@ -655,23 +660,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -697,19 +703,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Email::setDeleted() * @see Email::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -739,12 +746,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -789,12 +796,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -812,22 +819,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[EmailTableMap::COL_ID] = true; @@ -870,24 +878,31 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'emailTo': $stmt->bindValue($identifier, $this->emailto, PDO::PARAM_STR); + break; case 'emailBcc': $stmt->bindValue($identifier, $this->emailbcc, PDO::PARAM_STR); + break; case 'emailFrom': $stmt->bindValue($identifier, $this->emailfrom, PDO::PARAM_STR); + break; case 'subject': $stmt->bindValue($identifier, $this->subject, PDO::PARAM_STR); + break; case 'message': $stmt->bindValue($identifier, $this->message, PDO::PARAM_STR); + break; case 'error': $stmt->bindValue($identifier, $this->error, PDO::PARAM_STR); + break; } } @@ -910,12 +925,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -926,14 +941,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = EmailTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -945,36 +960,35 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getEmailTo(); - break; + case 2: return $this->getEmailBcc(); - break; + case 3: return $this->getEmailFrom(); - break; + case 4: return $this->getSubject(); - break; + case 5: return $this->getMessage(); - break; + case 6: return $this->getError(); - break; + default: return null; - break; } // switch() } @@ -984,22 +998,22 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array()) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = []): array { if (isset($alreadyDumpedObjects['Email'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Email'][$this->hashCode()] = true; $keys = EmailTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getEmailTo(), $keys[2] => $this->getEmailBcc(), @@ -1007,7 +1021,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[4] => $this->getSubject(), $keys[5] => $this->getMessage(), $keys[6] => $this->getError(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -1020,30 +1034,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Email + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = EmailTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Email + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1085,11 +1101,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = EmailTableMap::getFieldNames($keyType); @@ -1114,6 +1130,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[6], $arr)) { $this->setError($arr[$keys[6]]); } + + return $this; } /** @@ -1133,9 +1151,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Email The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1149,9 +1167,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(EmailTableMap::DATABASE_NAME); @@ -1184,13 +1202,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildEmailQuery::create(); $criteria->add(EmailTableMap::COL_ID, $this->id); @@ -1202,7 +1220,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1232,19 +1250,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1255,12 +1274,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Email (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Email (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setEmailTo($this->getEmailTo()); $copyObj->setEmailBcc($this->getEmailBcc()); @@ -1270,7 +1290,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setError($this->getError()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1282,11 +1302,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Email Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1300,6 +1320,8 @@ public function copy($deepCopy = false) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1316,6 +1338,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1324,12 +1348,15 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) + + return $this; } /** @@ -1344,99 +1371,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1446,7 +1453,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1466,17 +1473,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/EmailQuery.php b/generated-classes/TechWilk/Rota/Base/EmailQuery.php index a7d0eba1..148ae3e6 100644 --- a/generated-classes/TechWilk/Rota/Base/EmailQuery.php +++ b/generated-classes/TechWilk/Rota/Base/EmailQuery.php @@ -7,7 +7,7 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\Collection\ObjectCollection; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; use TechWilk\Rota\Email as ChildEmail; @@ -15,9 +15,7 @@ use TechWilk\Rota\Map\EmailTableMap; /** - * Base class that represents a query for the 'emails' table. - * - * + * Base class that represents a query for the `emails` table. * * @method ChildEmailQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildEmailQuery orderByEmailTo($order = Criteria::ASC) Order by the emailTo column @@ -43,19 +41,19 @@ * @method ChildEmailQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query * @method ChildEmailQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query * - * @method ChildEmail findOne(ConnectionInterface $con = null) Return the first ChildEmail matching the query - * @method ChildEmail findOneOrCreate(ConnectionInterface $con = null) Return the first ChildEmail matching the query, or a new ChildEmail object populated from the query conditions when no match is found + * @method ChildEmail|null findOne(?ConnectionInterface $con = null) Return the first ChildEmail matching the query + * @method ChildEmail findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildEmail matching the query, or a new ChildEmail object populated from the query conditions when no match is found * - * @method ChildEmail findOneById(int $id) Return the first ChildEmail filtered by the id column - * @method ChildEmail findOneByEmailTo(string $emailTo) Return the first ChildEmail filtered by the emailTo column - * @method ChildEmail findOneByEmailBcc(string $emailBcc) Return the first ChildEmail filtered by the emailBcc column - * @method ChildEmail findOneByEmailFrom(string $emailFrom) Return the first ChildEmail filtered by the emailFrom column - * @method ChildEmail findOneBySubject(string $subject) Return the first ChildEmail filtered by the subject column - * @method ChildEmail findOneByMessage(string $message) Return the first ChildEmail filtered by the message column - * @method ChildEmail findOneByError(string $error) Return the first ChildEmail filtered by the error column * - - * @method ChildEmail requirePk($key, ConnectionInterface $con = null) Return the ChildEmail by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildEmail requireOne(ConnectionInterface $con = null) Return the first ChildEmail matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEmail|null findOneById(int $id) Return the first ChildEmail filtered by the id column + * @method ChildEmail|null findOneByEmailTo(string $emailTo) Return the first ChildEmail filtered by the emailTo column + * @method ChildEmail|null findOneByEmailBcc(string $emailBcc) Return the first ChildEmail filtered by the emailBcc column + * @method ChildEmail|null findOneByEmailFrom(string $emailFrom) Return the first ChildEmail filtered by the emailFrom column + * @method ChildEmail|null findOneBySubject(string $subject) Return the first ChildEmail filtered by the subject column + * @method ChildEmail|null findOneByMessage(string $message) Return the first ChildEmail filtered by the message column + * @method ChildEmail|null findOneByError(string $error) Return the first ChildEmail filtered by the error column + * + * @method ChildEmail requirePk($key, ?ConnectionInterface $con = null) Return the ChildEmail by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEmail requireOne(?ConnectionInterface $con = null) Return the first ChildEmail matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildEmail requireOneById(int $id) Return the first ChildEmail filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEmail requireOneByEmailTo(string $emailTo) Return the first ChildEmail filtered by the emailTo column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -65,16 +63,26 @@ * @method ChildEmail requireOneByMessage(string $message) Return the first ChildEmail filtered by the message column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEmail requireOneByError(string $error) Return the first ChildEmail filtered by the error column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildEmail[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildEmail objects based on current ModelCriteria - * @method ChildEmail[]|ObjectCollection findById(int $id) Return ChildEmail objects filtered by the id column - * @method ChildEmail[]|ObjectCollection findByEmailTo(string $emailTo) Return ChildEmail objects filtered by the emailTo column - * @method ChildEmail[]|ObjectCollection findByEmailBcc(string $emailBcc) Return ChildEmail objects filtered by the emailBcc column - * @method ChildEmail[]|ObjectCollection findByEmailFrom(string $emailFrom) Return ChildEmail objects filtered by the emailFrom column - * @method ChildEmail[]|ObjectCollection findBySubject(string $subject) Return ChildEmail objects filtered by the subject column - * @method ChildEmail[]|ObjectCollection findByMessage(string $message) Return ChildEmail objects filtered by the message column - * @method ChildEmail[]|ObjectCollection findByError(string $error) Return ChildEmail objects filtered by the error column - * @method ChildEmail[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildEmail[]|Collection find(?ConnectionInterface $con = null) Return ChildEmail objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildEmail objects based on current ModelCriteria + * + * @method ChildEmail[]|Collection findById(int|array $id) Return ChildEmail objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildEmail objects filtered by the id column + * @method ChildEmail[]|Collection findByEmailTo(string|array $emailTo) Return ChildEmail objects filtered by the emailTo column + * @psalm-method Collection&\Traversable findByEmailTo(string|array $emailTo) Return ChildEmail objects filtered by the emailTo column + * @method ChildEmail[]|Collection findByEmailBcc(string|array $emailBcc) Return ChildEmail objects filtered by the emailBcc column + * @psalm-method Collection&\Traversable findByEmailBcc(string|array $emailBcc) Return ChildEmail objects filtered by the emailBcc column + * @method ChildEmail[]|Collection findByEmailFrom(string|array $emailFrom) Return ChildEmail objects filtered by the emailFrom column + * @psalm-method Collection&\Traversable findByEmailFrom(string|array $emailFrom) Return ChildEmail objects filtered by the emailFrom column + * @method ChildEmail[]|Collection findBySubject(string|array $subject) Return ChildEmail objects filtered by the subject column + * @psalm-method Collection&\Traversable findBySubject(string|array $subject) Return ChildEmail objects filtered by the subject column + * @method ChildEmail[]|Collection findByMessage(string|array $message) Return ChildEmail objects filtered by the message column + * @psalm-method Collection&\Traversable findByMessage(string|array $message) Return ChildEmail objects filtered by the message column + * @method ChildEmail[]|Collection findByError(string|array $error) Return ChildEmail objects filtered by the error column + * @psalm-method Collection&\Traversable findByError(string|array $error) Return ChildEmail objects filtered by the error column * + * @method ChildEmail[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class EmailQuery extends ModelCriteria { @@ -83,9 +91,9 @@ abstract class EmailQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\EmailQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Email', $modelAlias = null) { @@ -95,12 +103,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildEmailQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildEmailQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildEmailQuery) { return $criteria; @@ -130,7 +138,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildEmail|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -162,8 +170,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -195,8 +203,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildEmail|array|mixed the result, formatted by the current formatter */ @@ -216,12 +224,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -238,25 +246,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(EmailTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(EmailTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(EmailTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(EmailTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -269,15 +283,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -297,7 +311,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(EmailTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -307,14 +323,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByEmailTo('fooValue'); // WHERE emailTo = 'fooValue' * $query->filterByEmailTo('%fooValue%', Criteria::LIKE); // WHERE emailTo LIKE '%fooValue%' + * $query->filterByEmailTo(['foo', 'bar']); // WHERE emailTo IN ('foo', 'bar') * * - * @param string $emailTo The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $emailTo The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEmailTo($emailTo = null, $comparison = null) + public function filterByEmailTo($emailTo = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($emailTo)) { @@ -322,7 +339,9 @@ public function filterByEmailTo($emailTo = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_EMAILTO, $emailTo, $comparison); + $this->addUsingAlias(EmailTableMap::COL_EMAILTO, $emailTo, $comparison); + + return $this; } /** @@ -332,14 +351,15 @@ public function filterByEmailTo($emailTo = null, $comparison = null) * * $query->filterByEmailBcc('fooValue'); // WHERE emailBcc = 'fooValue' * $query->filterByEmailBcc('%fooValue%', Criteria::LIKE); // WHERE emailBcc LIKE '%fooValue%' + * $query->filterByEmailBcc(['foo', 'bar']); // WHERE emailBcc IN ('foo', 'bar') * * - * @param string $emailBcc The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $emailBcc The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEmailBcc($emailBcc = null, $comparison = null) + public function filterByEmailBcc($emailBcc = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($emailBcc)) { @@ -347,7 +367,9 @@ public function filterByEmailBcc($emailBcc = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_EMAILBCC, $emailBcc, $comparison); + $this->addUsingAlias(EmailTableMap::COL_EMAILBCC, $emailBcc, $comparison); + + return $this; } /** @@ -357,14 +379,15 @@ public function filterByEmailBcc($emailBcc = null, $comparison = null) * * $query->filterByEmailFrom('fooValue'); // WHERE emailFrom = 'fooValue' * $query->filterByEmailFrom('%fooValue%', Criteria::LIKE); // WHERE emailFrom LIKE '%fooValue%' + * $query->filterByEmailFrom(['foo', 'bar']); // WHERE emailFrom IN ('foo', 'bar') * * - * @param string $emailFrom The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $emailFrom The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEmailFrom($emailFrom = null, $comparison = null) + public function filterByEmailFrom($emailFrom = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($emailFrom)) { @@ -372,7 +395,9 @@ public function filterByEmailFrom($emailFrom = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_EMAILFROM, $emailFrom, $comparison); + $this->addUsingAlias(EmailTableMap::COL_EMAILFROM, $emailFrom, $comparison); + + return $this; } /** @@ -382,14 +407,15 @@ public function filterByEmailFrom($emailFrom = null, $comparison = null) * * $query->filterBySubject('fooValue'); // WHERE subject = 'fooValue' * $query->filterBySubject('%fooValue%', Criteria::LIKE); // WHERE subject LIKE '%fooValue%' + * $query->filterBySubject(['foo', 'bar']); // WHERE subject IN ('foo', 'bar') * * - * @param string $subject The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $subject The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySubject($subject = null, $comparison = null) + public function filterBySubject($subject = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($subject)) { @@ -397,7 +423,9 @@ public function filterBySubject($subject = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_SUBJECT, $subject, $comparison); + $this->addUsingAlias(EmailTableMap::COL_SUBJECT, $subject, $comparison); + + return $this; } /** @@ -407,14 +435,15 @@ public function filterBySubject($subject = null, $comparison = null) * * $query->filterByMessage('fooValue'); // WHERE message = 'fooValue' * $query->filterByMessage('%fooValue%', Criteria::LIKE); // WHERE message LIKE '%fooValue%' + * $query->filterByMessage(['foo', 'bar']); // WHERE message IN ('foo', 'bar') * * - * @param string $message The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $message The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByMessage($message = null, $comparison = null) + public function filterByMessage($message = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($message)) { @@ -422,7 +451,9 @@ public function filterByMessage($message = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_MESSAGE, $message, $comparison); + $this->addUsingAlias(EmailTableMap::COL_MESSAGE, $message, $comparison); + + return $this; } /** @@ -432,14 +463,15 @@ public function filterByMessage($message = null, $comparison = null) * * $query->filterByError('fooValue'); // WHERE error = 'fooValue' * $query->filterByError('%fooValue%', Criteria::LIKE); // WHERE error LIKE '%fooValue%' + * $query->filterByError(['foo', 'bar']); // WHERE error IN ('foo', 'bar') * * - * @param string $error The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $error The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByError($error = null, $comparison = null) + public function filterByError($error = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($error)) { @@ -447,15 +479,17 @@ public function filterByError($error = null, $comparison = null) } } - return $this->addUsingAlias(EmailTableMap::COL_ERROR, $error, $comparison); + $this->addUsingAlias(EmailTableMap::COL_ERROR, $error, $comparison); + + return $this; } /** * Exclude object from result * - * @param ChildEmail $email Object to remove from the list of results + * @param ChildEmail $email Object to remove from the list of results * - * @return $this|ChildEmailQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($email = null) { @@ -472,7 +506,7 @@ public function prune($email = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EmailTableMap::DATABASE_NAME); @@ -497,12 +531,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EmailTableMap::DATABASE_NAME); @@ -526,4 +560,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // EmailQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Event.php b/generated-classes/TechWilk/Rota/Base/Event.php index a8e60113..918b7f1d 100644 --- a/generated-classes/TechWilk/Rota/Base/Event.php +++ b/generated-classes/TechWilk/Rota/Base/Event.php @@ -52,19 +52,21 @@ abstract class Event implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -73,14 +75,14 @@ abstract class Event implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -164,42 +166,42 @@ abstract class Event implements ActiveRecordInterface * The value for the removed field. * * Note: this column has a database default value of: 0 - * @var int + * @var int|null */ protected $removed; /** * The value for the eventgroup field. * - * @var int + * @var int|null */ protected $eventgroup; /** * The value for the sermontitle field. * - * @var string + * @var string|null */ protected $sermontitle; /** * The value for the bibleverse field. * - * @var string + * @var string|null */ protected $bibleverse; /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; @@ -230,18 +232,21 @@ abstract class Event implements ActiveRecordInterface /** * @var ObjectCollection|ChildComment[] Collection to store aggregation of ChildComment objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildComment objects. */ protected $collComments; protected $collCommentsPartial; /** * @var ObjectCollection|ChildEventPerson[] Collection to store aggregation of ChildEventPerson objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEventPerson objects. */ protected $collEventpeople; protected $collEventpeoplePartial; /** * @var ObjectCollection|ChildAvailability[] Collection to store aggregation of ChildAvailability objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildAvailability objects. */ protected $collAvailabilities; protected $collAvailabilitiesPartial; @@ -250,25 +255,28 @@ abstract class Event implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildComment[] + * @phpstan-var ObjectCollection&\Traversable */ protected $commentsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEventPerson[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventpeopleScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildAvailability[] + * @phpstan-var ObjectCollection&\Traversable */ protected $availabilitiesScheduledForDeletion = null; @@ -278,11 +286,11 @@ abstract class Event implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { - $this->date = PropelDateTime::newInstance(null, null, 'DateTime'); + $this->date = PropelDateTime::newInstance(NULL, null, 'DateTime'); $this->createdby = 0; - $this->rehearsaldate = PropelDateTime::newInstance(null, null, 'DateTime'); + $this->rehearsaldate = PropelDateTime::newInstance(NULL, null, 'DateTime'); $this->type = 0; $this->subtype = 0; $this->location = 0; @@ -303,9 +311,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -313,10 +321,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -325,7 +333,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -335,9 +343,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -346,45 +354,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -393,10 +399,10 @@ public function resetModified($col = null) * obj is an instance of Event, delegates to * equals(Event). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -418,7 +424,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -426,10 +432,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -437,15 +443,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -454,12 +460,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Event The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -469,13 +475,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -486,24 +492,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -511,7 +520,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -532,12 +541,14 @@ public function getId() * Get the [optionally formatted] temporal [date] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime : string) */ public function getDate($format = null) { @@ -572,12 +583,14 @@ public function getCreatedBy() * Get the [optionally formatted] temporal [rehearsaldate] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime : string) */ public function getRehearsalDate($format = null) { @@ -641,7 +654,7 @@ public function getRehearsal() /** * Get the [removed] column value. * - * @return int + * @return int|null */ public function getRemoved() { @@ -651,7 +664,7 @@ public function getRemoved() /** * Get the [eventgroup] column value. * - * @return int + * @return int|null */ public function getEventGroupId() { @@ -661,7 +674,7 @@ public function getEventGroupId() /** * Get the [sermontitle] column value. * - * @return string + * @return string|null */ public function getSermonTitle() { @@ -671,7 +684,7 @@ public function getSermonTitle() /** * Get the [bibleverse] column value. * - * @return string + * @return string|null */ public function getBibleVerse() { @@ -682,12 +695,14 @@ public function getBibleVerse() * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -702,12 +717,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -721,8 +738,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -736,21 +753,21 @@ public function setId($v) } return $this; - } // setId() + } /** * Sets the value of [date] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setDate($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->date !== null || $dt !== null) { - if (($dt != $this->date) // normalized values don't match - || ($dt->format('Y-m-d H:i:s.u') === null) // or the entered value matches the default + if ( ($dt != $this->date) // normalized values don't match + || ($dt->format('Y-m-d H:i:s.u') === NULL) // or the entered value matches the default ) { $this->date = $dt === null ? null : clone $dt; $this->modifiedColumns[EventTableMap::COL_DATE] = true; @@ -758,13 +775,13 @@ public function setDate($v) } // if either are not null return $this; - } // setDate() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -778,13 +795,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [createdby] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setCreatedBy($v) { @@ -802,21 +819,21 @@ public function setCreatedBy($v) } return $this; - } // setCreatedBy() + } /** * Sets the value of [rehearsaldate] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setRehearsalDate($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->rehearsaldate !== null || $dt !== null) { - if (($dt != $this->rehearsaldate) // normalized values don't match - || ($dt->format('Y-m-d H:i:s.u') === null) // or the entered value matches the default + if ( ($dt != $this->rehearsaldate) // normalized values don't match + || ($dt->format('Y-m-d H:i:s.u') === NULL) // or the entered value matches the default ) { $this->rehearsaldate = $dt === null ? null : clone $dt; $this->modifiedColumns[EventTableMap::COL_REHEARSALDATE] = true; @@ -824,13 +841,13 @@ public function setRehearsalDate($v) } // if either are not null return $this; - } // setRehearsalDate() + } /** * Set the value of [type] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setEventTypeId($v) { @@ -848,13 +865,13 @@ public function setEventTypeId($v) } return $this; - } // setEventTypeId() + } /** * Set the value of [subtype] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setEventSubTypeId($v) { @@ -872,13 +889,13 @@ public function setEventSubTypeId($v) } return $this; - } // setEventSubTypeId() + } /** * Set the value of [location] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setLocationId($v) { @@ -896,13 +913,13 @@ public function setLocationId($v) } return $this; - } // setLocationId() + } /** * Set the value of [notified] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setNotified($v) { @@ -916,13 +933,13 @@ public function setNotified($v) } return $this; - } // setNotified() + } /** * Set the value of [rehearsal] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setRehearsal($v) { @@ -936,13 +953,13 @@ public function setRehearsal($v) } return $this; - } // setRehearsal() + } /** * Set the value of [removed] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setRemoved($v) { @@ -956,13 +973,13 @@ public function setRemoved($v) } return $this; - } // setRemoved() + } /** * Set the value of [eventgroup] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setEventGroupId($v) { @@ -980,13 +997,13 @@ public function setEventGroupId($v) } return $this; - } // setEventGroupId() + } /** * Set the value of [sermontitle] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setSermonTitle($v) { @@ -1000,13 +1017,13 @@ public function setSermonTitle($v) } return $this; - } // setSermonTitle() + } /** * Set the value of [bibleverse] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setBibleVerse($v) { @@ -1020,14 +1037,14 @@ public function setBibleVerse($v) } return $this; - } // setBibleVerse() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -1040,14 +1057,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -1060,7 +1077,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -1068,49 +1085,49 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->date && $this->date->format('Y-m-d H:i:s.u') !== null) { - return false; - } + if ($this->date && $this->date->format('Y-m-d H:i:s.u') !== NULL) { + return false; + } - if ($this->createdby !== 0) { - return false; - } + if ($this->createdby !== 0) { + return false; + } - if ($this->rehearsaldate && $this->rehearsaldate->format('Y-m-d H:i:s.u') !== null) { - return false; - } + if ($this->rehearsaldate && $this->rehearsaldate->format('Y-m-d H:i:s.u') !== NULL) { + return false; + } - if ($this->type !== 0) { - return false; - } + if ($this->type !== 0) { + return false; + } - if ($this->subtype !== 0) { - return false; - } + if ($this->subtype !== 0) { + return false; + } - if ($this->location !== 0) { - return false; - } + if ($this->location !== 0) { + return false; + } - if ($this->notified !== 0) { - return false; - } + if ($this->notified !== 0) { + return false; + } - if ($this->rehearsal !== 0) { - return false; - } + if ($this->rehearsal !== 0) { + return false; + } - if ($this->removed !== 0) { - return false; - } + if ($this->removed !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -1120,19 +1137,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : EventTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -1192,8 +1210,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -1201,6 +1219,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 16; // 16 = EventTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Event'), 0, $e); } @@ -1217,9 +1236,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->createdby !== $this->aUser->getId()) { $this->aUser = null; @@ -1236,19 +1256,19 @@ public function ensureConsistency() if ($this->aEventGroup !== null && $this->eventgroup !== $this->aEventGroup->getId()) { $this->aEventGroup = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -1285,19 +1305,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->collEventpeople = null; $this->collAvailabilities = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Event::setDeleted() * @see Event::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -1327,12 +1348,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -1352,12 +1373,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(EventTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(EventTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -1389,12 +1411,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -1503,22 +1525,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[EventTableMap::COL_ID] = true; @@ -1585,51 +1608,67 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'date': $stmt->bindValue($identifier, $this->date ? $this->date->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'createdBy': $stmt->bindValue($identifier, $this->createdby, PDO::PARAM_INT); + break; case 'rehearsalDate': $stmt->bindValue($identifier, $this->rehearsaldate ? $this->rehearsaldate->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'type': $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT); + break; case 'subType': $stmt->bindValue($identifier, $this->subtype, PDO::PARAM_INT); + break; case 'location': $stmt->bindValue($identifier, $this->location, PDO::PARAM_INT); + break; case 'notified': $stmt->bindValue($identifier, $this->notified, PDO::PARAM_INT); + break; case 'rehearsal': $stmt->bindValue($identifier, $this->rehearsal, PDO::PARAM_INT); + break; case 'removed': $stmt->bindValue($identifier, $this->removed, PDO::PARAM_INT); + break; case 'eventGroup': $stmt->bindValue($identifier, $this->eventgroup, PDO::PARAM_INT); + break; case 'sermonTitle': $stmt->bindValue($identifier, $this->sermontitle, PDO::PARAM_STR); + break; case 'bibleVerse': $stmt->bindValue($identifier, $this->bibleverse, PDO::PARAM_STR); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -1654,12 +1693,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1670,14 +1709,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = EventTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1689,63 +1728,62 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getDate(); - break; + case 2: return $this->getName(); - break; + case 3: return $this->getCreatedBy(); - break; + case 4: return $this->getRehearsalDate(); - break; + case 5: return $this->getEventTypeId(); - break; + case 6: return $this->getEventSubTypeId(); - break; + case 7: return $this->getLocationId(); - break; + case 8: return $this->getNotified(); - break; + case 9: return $this->getRehearsal(); - break; + case 10: return $this->getRemoved(); - break; + case 11: return $this->getEventGroupId(); - break; + case 12: return $this->getSermonTitle(); - break; + case 13: return $this->getBibleVerse(); - break; + case 14: return $this->getCreated(); - break; + case 15: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -1755,23 +1793,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Event'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Event'][$this->hashCode()] = true; $keys = EventTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getDate(), $keys[2] => $this->getName(), @@ -1788,21 +1826,21 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[13] => $this->getBibleVerse(), $keys[14] => $this->getCreated(), $keys[15] => $this->getUpdated(), - ); + ]; if ($result[$keys[1]] instanceof \DateTimeInterface) { - $result[$keys[1]] = $result[$keys[1]]->format('c'); + $result[$keys[1]] = $result[$keys[1]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[4]] instanceof \DateTimeInterface) { - $result[$keys[4]] = $result[$keys[4]]->format('c'); + $result[$keys[4]] = $result[$keys[4]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[14]] instanceof \DateTimeInterface) { - $result[$keys[14]] = $result[$keys[14]]->format('c'); + $result[$keys[14]] = $result[$keys[14]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[15]] instanceof \DateTimeInterface) { - $result[$keys[15]] = $result[$keys[15]]->format('c'); + $result[$keys[15]] = $result[$keys[15]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1812,6 +1850,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1823,9 +1862,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aEventType) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventType'; @@ -1837,9 +1877,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'EventType'; } - $result[$key] = $this->aEventType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEventType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aEventSubType) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventSubType'; @@ -1851,9 +1892,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'EventSubType'; } - $result[$key] = $this->aEventSubType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEventSubType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aLocation) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'location'; @@ -1865,9 +1907,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Location'; } - $result[$key] = $this->aLocation->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aLocation->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aEventGroup) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventGroup'; @@ -1879,9 +1922,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'EventGroup'; } - $result[$key] = $this->aEventGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEventGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collComments) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'comments'; @@ -1896,6 +1940,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collComments->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collEventpeople) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventpeople'; @@ -1910,6 +1955,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collEventpeople->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collAvailabilities) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'availabilities'; @@ -1931,30 +1977,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Event + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = EventTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Event + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -2023,11 +2071,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = EventTableMap::getFieldNames($keyType); @@ -2079,6 +2127,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[15], $arr)) { $this->setUpdated($arr[$keys[15]]); } + + return $this; } /** @@ -2098,9 +2148,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Event The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -2114,9 +2164,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(EventTableMap::DATABASE_NAME); @@ -2176,13 +2226,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildEventQuery::create(); $criteria->add(EventTableMap::COL_ID, $this->id); @@ -2194,7 +2244,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -2224,19 +2274,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -2247,12 +2298,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Event (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Event (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setDate($this->getDate()); $copyObj->setName($this->getName()); @@ -2292,11 +2344,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addAvailability($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -2308,11 +2361,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Event Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -2325,9 +2378,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { @@ -2353,11 +2406,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->createdby != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->createdby, $con); @@ -2376,9 +2429,9 @@ public function getUser(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildEventType object. * - * @param ChildEventType $v - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) - * @throws PropelException + * @param ChildEventType $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEventType(ChildEventType $v = null) { @@ -2404,11 +2457,11 @@ public function setEventType(ChildEventType $v = null) /** * Get the associated ChildEventType object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildEventType The associated ChildEventType object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventType(ConnectionInterface $con = null) + public function getEventType(?ConnectionInterface $con = null) { if ($this->aEventType === null && ($this->type != 0)) { $this->aEventType = ChildEventTypeQuery::create()->findPk($this->type, $con); @@ -2427,9 +2480,9 @@ public function getEventType(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildEventSubType object. * - * @param ChildEventSubType $v - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) - * @throws PropelException + * @param ChildEventSubType $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEventSubType(ChildEventSubType $v = null) { @@ -2455,11 +2508,11 @@ public function setEventSubType(ChildEventSubType $v = null) /** * Get the associated ChildEventSubType object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildEventSubType The associated ChildEventSubType object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventSubType(ConnectionInterface $con = null) + public function getEventSubType(?ConnectionInterface $con = null) { if ($this->aEventSubType === null && ($this->subtype != 0)) { $this->aEventSubType = ChildEventSubTypeQuery::create()->findPk($this->subtype, $con); @@ -2478,9 +2531,9 @@ public function getEventSubType(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildLocation object. * - * @param ChildLocation $v - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) - * @throws PropelException + * @param ChildLocation $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setLocation(ChildLocation $v = null) { @@ -2506,11 +2559,11 @@ public function setLocation(ChildLocation $v = null) /** * Get the associated ChildLocation object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildLocation The associated ChildLocation object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getLocation(ConnectionInterface $con = null) + public function getLocation(?ConnectionInterface $con = null) { if ($this->aLocation === null && ($this->location != 0)) { $this->aLocation = ChildLocationQuery::create()->findPk($this->location, $con); @@ -2529,14 +2582,14 @@ public function getLocation(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildEventGroup object. * - * @param ChildEventGroup $v - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) - * @throws PropelException + * @param ChildEventGroup|null $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEventGroup(ChildEventGroup $v = null) { if ($v === null) { - $this->setEventGroupId(null); + $this->setEventGroupId(NULL); } else { $this->setEventGroupId($v->getId()); } @@ -2557,11 +2610,11 @@ public function setEventGroup(ChildEventGroup $v = null) /** * Get the associated ChildEventGroup object * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildEventGroup The associated ChildEventGroup object. - * @throws PropelException + * @param ConnectionInterface $con Optional Connection object. + * @return ChildEventGroup|null The associated ChildEventGroup object. + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventGroup(ConnectionInterface $con = null) + public function getEventGroup(?ConnectionInterface $con = null) { if ($this->aEventGroup === null && ($this->eventgroup != 0)) { $this->aEventGroup = ChildEventGroupQuery::create()->findPk($this->eventgroup, $con); @@ -2583,20 +2636,20 @@ public function getEventGroup(ConnectionInterface $con = null) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('Comment' == $relationName) { + if ('Comment' === $relationName) { $this->initComments(); return; } - if ('EventPerson' == $relationName) { + if ('EventPerson' === $relationName) { $this->initEventpeople(); return; } - if ('Availability' == $relationName) { + if ('Availability' === $relationName) { $this->initAvailabilities(); return; } @@ -2608,18 +2661,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addComments() + * @return $this + * @see addComments() */ public function clearComments() { $this->collComments = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collComments collection loaded partially. + * + * @return void */ - public function resetPartialComments($v = true) + public function resetPartialComments($v = true): void { $this->collCommentsPartial = $v; } @@ -2631,12 +2688,12 @@ public function resetPartialComments($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initComments($overrideExisting = true) + public function initComments(bool $overrideExisting = true): void { if (null !== $this->collComments && !$overrideExisting) { return; @@ -2657,18 +2714,28 @@ public function initComments($overrideExisting = true) * If this ChildEvent is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildComment[] List of ChildComment objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildComment objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getComments(Criteria $criteria = null, ConnectionInterface $con = null) + public function getComments(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collCommentsPartial && !$this->isNew(); - if (null === $this->collComments || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collComments) { + if (null === $this->collComments || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initComments(); + if (null === $this->collComments) { + $this->initComments(); + } else { + $collectionClassName = CommentTableMap::getTableMap()->getCollectionClassName(); + + $collComments = new $collectionClassName; + $collComments->setModel('\TechWilk\Rota\Comment'); + + return $collComments; + } } else { $collComments = ChildCommentQuery::create(null, $criteria) ->filterByEvent($this) @@ -2712,11 +2779,11 @@ public function getComments(Criteria $criteria = null, ConnectionInterface $con * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $comments A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEvent The current object (for fluent API support) + * @param Collection $comments A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setComments(Collection $comments, ConnectionInterface $con = null) + public function setComments(Collection $comments, ?ConnectionInterface $con = null) { /** @var ChildComment[] $commentsToDelete */ $commentsToDelete = $this->getComments(new Criteria(), $con)->diff($comments); @@ -2742,13 +2809,13 @@ public function setComments(Collection $comments, ConnectionInterface $con = nul /** * Returns the number of related Comment objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Comment objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Comment objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countComments(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countComments(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collCommentsPartial && !$this->isNew(); if (null === $this->collComments || null !== $criteria || $partial) { @@ -2777,8 +2844,8 @@ public function countComments(Criteria $criteria = null, $distinct = false, Conn * Method called to associate a ChildComment object to this object * through the ChildComment foreign key attribute. * - * @param ChildComment $l ChildComment - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param ChildComment $l ChildComment + * @return $this The current object (for fluent API support) */ public function addComment(ChildComment $l) { @@ -2801,15 +2868,15 @@ public function addComment(ChildComment $l) /** * @param ChildComment $comment The ChildComment object to add. */ - protected function doAddComment(ChildComment $comment) + protected function doAddComment(ChildComment $comment): void { $this->collComments[]= $comment; $comment->setEvent($this); } /** - * @param ChildComment $comment The ChildComment object to remove. - * @return $this|ChildEvent The current object (for fluent API support) + * @param ChildComment $comment The ChildComment object to remove. + * @return $this The current object (for fluent API support) */ public function removeComment(ChildComment $comment) { @@ -2839,12 +2906,13 @@ public function removeComment(ChildComment $comment) * api reasonable. You can provide public methods for those you * actually need in Event. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildComment[] List of ChildComment objects + * @phpstan-return ObjectCollection&\Traversable List of ChildComment objects */ - public function getCommentsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getCommentsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildCommentQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -2858,18 +2926,22 @@ public function getCommentsJoinUser(Criteria $criteria = null, ConnectionInterfa * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEventpeople() + * @return $this + * @see addEventpeople() */ public function clearEventpeople() { $this->collEventpeople = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEventpeople collection loaded partially. + * + * @return void */ - public function resetPartialEventpeople($v = true) + public function resetPartialEventpeople($v = true): void { $this->collEventpeoplePartial = $v; } @@ -2881,12 +2953,12 @@ public function resetPartialEventpeople($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEventpeople($overrideExisting = true) + public function initEventpeople(bool $overrideExisting = true): void { if (null !== $this->collEventpeople && !$overrideExisting) { return; @@ -2907,18 +2979,28 @@ public function initEventpeople($overrideExisting = true) * If this ChildEvent is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEventPerson[] List of ChildEventPerson objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEventPerson objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventpeople(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEventpeople(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventpeoplePartial && !$this->isNew(); - if (null === $this->collEventpeople || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEventpeople) { + if (null === $this->collEventpeople || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEventpeople(); + if (null === $this->collEventpeople) { + $this->initEventpeople(); + } else { + $collectionClassName = EventPersonTableMap::getTableMap()->getCollectionClassName(); + + $collEventpeople = new $collectionClassName; + $collEventpeople->setModel('\TechWilk\Rota\EventPerson'); + + return $collEventpeople; + } } else { $collEventpeople = ChildEventPersonQuery::create(null, $criteria) ->filterByEvent($this) @@ -2962,11 +3044,11 @@ public function getEventpeople(Criteria $criteria = null, ConnectionInterface $c * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $eventpeople A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEvent The current object (for fluent API support) + * @param Collection $eventpeople A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEventpeople(Collection $eventpeople, ConnectionInterface $con = null) + public function setEventpeople(Collection $eventpeople, ?ConnectionInterface $con = null) { /** @var ChildEventPerson[] $eventpeopleToDelete */ $eventpeopleToDelete = $this->getEventpeople(new Criteria(), $con)->diff($eventpeople); @@ -2992,13 +3074,13 @@ public function setEventpeople(Collection $eventpeople, ConnectionInterface $con /** * Returns the number of related EventPerson objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related EventPerson objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related EventPerson objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEventpeople(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEventpeople(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventpeoplePartial && !$this->isNew(); if (null === $this->collEventpeople || null !== $criteria || $partial) { @@ -3027,8 +3109,8 @@ public function countEventpeople(Criteria $criteria = null, $distinct = false, C * Method called to associate a ChildEventPerson object to this object * through the ChildEventPerson foreign key attribute. * - * @param ChildEventPerson $l ChildEventPerson - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param ChildEventPerson $l ChildEventPerson + * @return $this The current object (for fluent API support) */ public function addEventPerson(ChildEventPerson $l) { @@ -3051,15 +3133,15 @@ public function addEventPerson(ChildEventPerson $l) /** * @param ChildEventPerson $eventPerson The ChildEventPerson object to add. */ - protected function doAddEventPerson(ChildEventPerson $eventPerson) + protected function doAddEventPerson(ChildEventPerson $eventPerson): void { $this->collEventpeople[]= $eventPerson; $eventPerson->setEvent($this); } /** - * @param ChildEventPerson $eventPerson The ChildEventPerson object to remove. - * @return $this|ChildEvent The current object (for fluent API support) + * @param ChildEventPerson $eventPerson The ChildEventPerson object to remove. + * @return $this The current object (for fluent API support) */ public function removeEventPerson(ChildEventPerson $eventPerson) { @@ -3089,12 +3171,13 @@ public function removeEventPerson(ChildEventPerson $eventPerson) * api reasonable. You can provide public methods for those you * actually need in Event. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEventPerson[] List of ChildEventPerson objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEventPerson objects */ - public function getEventpeopleJoinUserRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventpeopleJoinUserRole(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventPersonQuery::create(null, $criteria); $query->joinWith('UserRole', $joinBehavior); @@ -3108,18 +3191,22 @@ public function getEventpeopleJoinUserRole(Criteria $criteria = null, Connection * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addAvailabilities() + * @return $this + * @see addAvailabilities() */ public function clearAvailabilities() { $this->collAvailabilities = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collAvailabilities collection loaded partially. + * + * @return void */ - public function resetPartialAvailabilities($v = true) + public function resetPartialAvailabilities($v = true): void { $this->collAvailabilitiesPartial = $v; } @@ -3131,12 +3218,12 @@ public function resetPartialAvailabilities($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initAvailabilities($overrideExisting = true) + public function initAvailabilities(bool $overrideExisting = true): void { if (null !== $this->collAvailabilities && !$overrideExisting) { return; @@ -3157,18 +3244,28 @@ public function initAvailabilities($overrideExisting = true) * If this ChildEvent is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildAvailability[] List of ChildAvailability objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildAvailability objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getAvailabilities(Criteria $criteria = null, ConnectionInterface $con = null) + public function getAvailabilities(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collAvailabilitiesPartial && !$this->isNew(); - if (null === $this->collAvailabilities || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collAvailabilities) { + if (null === $this->collAvailabilities || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initAvailabilities(); + if (null === $this->collAvailabilities) { + $this->initAvailabilities(); + } else { + $collectionClassName = AvailabilityTableMap::getTableMap()->getCollectionClassName(); + + $collAvailabilities = new $collectionClassName; + $collAvailabilities->setModel('\TechWilk\Rota\Availability'); + + return $collAvailabilities; + } } else { $collAvailabilities = ChildAvailabilityQuery::create(null, $criteria) ->filterByEvent($this) @@ -3212,11 +3309,11 @@ public function getAvailabilities(Criteria $criteria = null, ConnectionInterface * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $availabilities A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEvent The current object (for fluent API support) + * @param Collection $availabilities A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setAvailabilities(Collection $availabilities, ConnectionInterface $con = null) + public function setAvailabilities(Collection $availabilities, ?ConnectionInterface $con = null) { /** @var ChildAvailability[] $availabilitiesToDelete */ $availabilitiesToDelete = $this->getAvailabilities(new Criteria(), $con)->diff($availabilities); @@ -3242,13 +3339,13 @@ public function setAvailabilities(Collection $availabilities, ConnectionInterfac /** * Returns the number of related Availability objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Availability objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Availability objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countAvailabilities(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countAvailabilities(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collAvailabilitiesPartial && !$this->isNew(); if (null === $this->collAvailabilities || null !== $criteria || $partial) { @@ -3277,8 +3374,8 @@ public function countAvailabilities(Criteria $criteria = null, $distinct = false * Method called to associate a ChildAvailability object to this object * through the ChildAvailability foreign key attribute. * - * @param ChildAvailability $l ChildAvailability - * @return $this|\TechWilk\Rota\Event The current object (for fluent API support) + * @param ChildAvailability $l ChildAvailability + * @return $this The current object (for fluent API support) */ public function addAvailability(ChildAvailability $l) { @@ -3301,15 +3398,15 @@ public function addAvailability(ChildAvailability $l) /** * @param ChildAvailability $availability The ChildAvailability object to add. */ - protected function doAddAvailability(ChildAvailability $availability) + protected function doAddAvailability(ChildAvailability $availability): void { $this->collAvailabilities[]= $availability; $availability->setEvent($this); } /** - * @param ChildAvailability $availability The ChildAvailability object to remove. - * @return $this|ChildEvent The current object (for fluent API support) + * @param ChildAvailability $availability The ChildAvailability object to remove. + * @return $this The current object (for fluent API support) */ public function removeAvailability(ChildAvailability $availability) { @@ -3339,12 +3436,13 @@ public function removeAvailability(ChildAvailability $availability) * api reasonable. You can provide public methods for those you * actually need in Event. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildAvailability[] List of ChildAvailability objects + * @phpstan-return ObjectCollection&\Traversable List of ChildAvailability objects */ - public function getAvailabilitiesJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getAvailabilitiesJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildAvailabilityQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -3356,6 +3454,8 @@ public function getAvailabilitiesJoinUser(Criteria $criteria = null, ConnectionI * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -3396,6 +3496,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -3404,9 +3506,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collComments) { @@ -3434,6 +3537,7 @@ public function clearAllReferences($deep = false) $this->aEventSubType = null; $this->aLocation = null; $this->aEventGroup = null; + return $this; } /** @@ -3451,7 +3555,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildEvent The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -3462,99 +3566,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -3564,7 +3648,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -3584,17 +3668,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/EventGroup.php b/generated-classes/TechWilk/Rota/Base/EventGroup.php index 0166d17e..f356f7e7 100644 --- a/generated-classes/TechWilk/Rota/Base/EventGroup.php +++ b/generated-classes/TechWilk/Rota/Base/EventGroup.php @@ -34,19 +34,21 @@ abstract class EventGroup implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventGroupTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventGroupTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -55,14 +57,14 @@ abstract class EventGroup implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -96,6 +98,7 @@ abstract class EventGroup implements ActiveRecordInterface /** * @var ObjectCollection|ChildEvent[] Collection to store aggregation of ChildEvent objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEvent objects. */ protected $collEvents; protected $collEventsPartial; @@ -104,13 +107,14 @@ abstract class EventGroup implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEvent[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventsScheduledForDeletion = null; @@ -120,7 +124,7 @@ abstract class EventGroup implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->name = ''; $this->archived = false; @@ -138,9 +142,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -148,10 +152,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -160,7 +164,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -170,9 +174,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -181,45 +185,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -228,10 +230,10 @@ public function resetModified($col = null) * obj is an instance of EventGroup, delegates to * equals(EventGroup). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -253,7 +255,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -261,10 +263,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -272,15 +274,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -289,12 +291,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|EventGroup The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -304,13 +306,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -321,24 +323,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -346,7 +351,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -406,8 +411,8 @@ public function isArchived() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventGroup The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -421,13 +426,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\EventGroup The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -441,13 +446,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\EventGroup The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -461,7 +466,7 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Sets the value of the [archived] column. @@ -470,8 +475,8 @@ public function setDescription($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\EventGroup The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setArchived($v) { @@ -489,7 +494,7 @@ public function setArchived($v) } return $this; - } // setArchived() + } /** * Indicates whether the columns in this object are only set to default values. @@ -497,21 +502,21 @@ public function setArchived($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->name !== '') { - return false; - } + if ($this->name !== '') { + return false; + } - if ($this->archived !== false) { - return false; - } + if ($this->archived !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -521,19 +526,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : EventGroupTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -545,8 +551,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : EventGroupTableMap::translateFieldName('Archived', TableMap::TYPE_PHPNAME, $indexType)]; $this->archived = (null !== $col) ? (boolean) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -554,6 +560,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 4; // 4 = EventGroupTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\EventGroup'), 0, $e); } @@ -570,23 +577,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -614,19 +622,20 @@ public function reload($deep = false, ConnectionInterface $con = null) if ($deep) { // also de-associate any related objects? $this->collEvents = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see EventGroup::setDeleted() * @see EventGroup::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -656,12 +665,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -706,12 +715,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -747,22 +756,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[EventGroupTableMap::COL_ID] = true; @@ -796,15 +806,19 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'archived': $stmt->bindValue($identifier, (int) $this->archived, PDO::PARAM_INT); + break; } } @@ -827,12 +841,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -843,14 +857,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = EventGroupTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -862,27 +876,26 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getDescription(); - break; + case 3: return $this->getArchived(); - break; + default: return null; - break; } // switch() } @@ -892,28 +905,28 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['EventGroup'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['EventGroup'][$this->hashCode()] = true; $keys = EventGroupTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getDescription(), $keys[3] => $this->getArchived(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -921,6 +934,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collEvents) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'events'; @@ -942,30 +956,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\EventGroup + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = EventGroupTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\EventGroup + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -998,11 +1014,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = EventGroupTableMap::getFieldNames($keyType); @@ -1018,6 +1034,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[3], $arr)) { $this->setArchived($arr[$keys[3]]); } + + return $this; } /** @@ -1037,9 +1055,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\EventGroup The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1053,9 +1071,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(EventGroupTableMap::DATABASE_NAME); @@ -1079,13 +1097,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildEventGroupQuery::create(); $criteria->add(EventGroupTableMap::COL_ID, $this->id); @@ -1097,7 +1115,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1127,19 +1145,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1150,12 +1169,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\EventGroup (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\EventGroup (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setDescription($this->getDescription()); @@ -1171,11 +1191,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addEvent($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1187,11 +1208,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\EventGroup Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1207,12 +1228,12 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('Event' == $relationName) { + if ('Event' === $relationName) { $this->initEvents(); return; } @@ -1224,18 +1245,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEvents() + * @return $this + * @see addEvents() */ public function clearEvents() { $this->collEvents = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEvents collection loaded partially. + * + * @return void */ - public function resetPartialEvents($v = true) + public function resetPartialEvents($v = true): void { $this->collEventsPartial = $v; } @@ -1247,12 +1272,12 @@ public function resetPartialEvents($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEvents($overrideExisting = true) + public function initEvents(bool $overrideExisting = true): void { if (null !== $this->collEvents && !$overrideExisting) { return; @@ -1273,18 +1298,28 @@ public function initEvents($overrideExisting = true) * If this ChildEventGroup is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEvent[] List of ChildEvent objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvents(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEvents(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventsPartial && !$this->isNew(); - if (null === $this->collEvents || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEvents) { + if (null === $this->collEvents || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEvents(); + if (null === $this->collEvents) { + $this->initEvents(); + } else { + $collectionClassName = EventTableMap::getTableMap()->getCollectionClassName(); + + $collEvents = new $collectionClassName; + $collEvents->setModel('\TechWilk\Rota\Event'); + + return $collEvents; + } } else { $collEvents = ChildEventQuery::create(null, $criteria) ->filterByEventGroup($this) @@ -1328,11 +1363,11 @@ public function getEvents(Criteria $criteria = null, ConnectionInterface $con = * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $events A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEventGroup The current object (for fluent API support) + * @param Collection $events A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEvents(Collection $events, ConnectionInterface $con = null) + public function setEvents(Collection $events, ?ConnectionInterface $con = null) { /** @var ChildEvent[] $eventsToDelete */ $eventsToDelete = $this->getEvents(new Criteria(), $con)->diff($events); @@ -1358,13 +1393,13 @@ public function setEvents(Collection $events, ConnectionInterface $con = null) /** * Returns the number of related Event objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Event objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Event objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEvents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEvents(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventsPartial && !$this->isNew(); if (null === $this->collEvents || null !== $criteria || $partial) { @@ -1393,8 +1428,8 @@ public function countEvents(Criteria $criteria = null, $distinct = false, Connec * Method called to associate a ChildEvent object to this object * through the ChildEvent foreign key attribute. * - * @param ChildEvent $l ChildEvent - * @return $this|\TechWilk\Rota\EventGroup The current object (for fluent API support) + * @param ChildEvent $l ChildEvent + * @return $this The current object (for fluent API support) */ public function addEvent(ChildEvent $l) { @@ -1417,15 +1452,15 @@ public function addEvent(ChildEvent $l) /** * @param ChildEvent $event The ChildEvent object to add. */ - protected function doAddEvent(ChildEvent $event) + protected function doAddEvent(ChildEvent $event): void { $this->collEvents[]= $event; $event->setEventGroup($this); } /** - * @param ChildEvent $event The ChildEvent object to remove. - * @return $this|ChildEventGroup The current object (for fluent API support) + * @param ChildEvent $event The ChildEvent object to remove. + * @return $this The current object (for fluent API support) */ public function removeEvent(ChildEvent $event) { @@ -1455,12 +1490,13 @@ public function removeEvent(ChildEvent $event) * api reasonable. You can provide public methods for those you * actually need in EventGroup. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1480,12 +1516,13 @@ public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface * api reasonable. You can provide public methods for those you * actually need in EventGroup. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventType', $joinBehavior); @@ -1505,12 +1542,13 @@ public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInte * api reasonable. You can provide public methods for those you * actually need in EventGroup. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventSubType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventSubType', $joinBehavior); @@ -1530,12 +1568,13 @@ public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionI * api reasonable. You can provide public methods for those you * actually need in EventGroup. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinLocation(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('Location', $joinBehavior); @@ -1547,6 +1586,8 @@ public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInter * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1560,6 +1601,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1568,9 +1611,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collEvents) { @@ -1581,6 +1625,7 @@ public function clearAllReferences($deep = false) } // if ($deep) $this->collEvents = null; + return $this; } /** @@ -1595,99 +1640,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1697,7 +1722,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1717,17 +1742,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/EventGroupQuery.php b/generated-classes/TechWilk/Rota/Base/EventGroupQuery.php index aa1baa36..9a9bb91a 100644 --- a/generated-classes/TechWilk/Rota/Base/EventGroupQuery.php +++ b/generated-classes/TechWilk/Rota/Base/EventGroupQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\EventGroupTableMap; /** - * Base class that represents a query for the 'eventGroups' table. - * - * + * Base class that represents a query for the `eventGroups` table. * * @method ChildEventGroupQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildEventGroupQuery orderByName($order = Criteria::ASC) Order by the name column @@ -50,29 +49,36 @@ * * @method \TechWilk\Rota\EventQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildEventGroup findOne(ConnectionInterface $con = null) Return the first ChildEventGroup matching the query - * @method ChildEventGroup findOneOrCreate(ConnectionInterface $con = null) Return the first ChildEventGroup matching the query, or a new ChildEventGroup object populated from the query conditions when no match is found + * @method ChildEventGroup|null findOne(?ConnectionInterface $con = null) Return the first ChildEventGroup matching the query + * @method ChildEventGroup findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildEventGroup matching the query, or a new ChildEventGroup object populated from the query conditions when no match is found * - * @method ChildEventGroup findOneById(int $id) Return the first ChildEventGroup filtered by the id column - * @method ChildEventGroup findOneByName(string $name) Return the first ChildEventGroup filtered by the name column - * @method ChildEventGroup findOneByDescription(string $description) Return the first ChildEventGroup filtered by the description column - * @method ChildEventGroup findOneByArchived(boolean $archived) Return the first ChildEventGroup filtered by the archived column * - - * @method ChildEventGroup requirePk($key, ConnectionInterface $con = null) Return the ChildEventGroup by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildEventGroup requireOne(ConnectionInterface $con = null) Return the first ChildEventGroup matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventGroup|null findOneById(int $id) Return the first ChildEventGroup filtered by the id column + * @method ChildEventGroup|null findOneByName(string $name) Return the first ChildEventGroup filtered by the name column + * @method ChildEventGroup|null findOneByDescription(string $description) Return the first ChildEventGroup filtered by the description column + * @method ChildEventGroup|null findOneByArchived(boolean $archived) Return the first ChildEventGroup filtered by the archived column + * + * @method ChildEventGroup requirePk($key, ?ConnectionInterface $con = null) Return the ChildEventGroup by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventGroup requireOne(?ConnectionInterface $con = null) Return the first ChildEventGroup matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildEventGroup requireOneById(int $id) Return the first ChildEventGroup filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventGroup requireOneByName(string $name) Return the first ChildEventGroup filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventGroup requireOneByDescription(string $description) Return the first ChildEventGroup filtered by the description column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventGroup requireOneByArchived(boolean $archived) Return the first ChildEventGroup filtered by the archived column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildEventGroup[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildEventGroup objects based on current ModelCriteria - * @method ChildEventGroup[]|ObjectCollection findById(int $id) Return ChildEventGroup objects filtered by the id column - * @method ChildEventGroup[]|ObjectCollection findByName(string $name) Return ChildEventGroup objects filtered by the name column - * @method ChildEventGroup[]|ObjectCollection findByDescription(string $description) Return ChildEventGroup objects filtered by the description column - * @method ChildEventGroup[]|ObjectCollection findByArchived(boolean $archived) Return ChildEventGroup objects filtered by the archived column - * @method ChildEventGroup[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildEventGroup[]|Collection find(?ConnectionInterface $con = null) Return ChildEventGroup objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildEventGroup objects based on current ModelCriteria + * + * @method ChildEventGroup[]|Collection findById(int|array $id) Return ChildEventGroup objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildEventGroup objects filtered by the id column + * @method ChildEventGroup[]|Collection findByName(string|array $name) Return ChildEventGroup objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildEventGroup objects filtered by the name column + * @method ChildEventGroup[]|Collection findByDescription(string|array $description) Return ChildEventGroup objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildEventGroup objects filtered by the description column + * @method ChildEventGroup[]|Collection findByArchived(boolean|array $archived) Return ChildEventGroup objects filtered by the archived column + * @psalm-method Collection&\Traversable findByArchived(boolean|array $archived) Return ChildEventGroup objects filtered by the archived column * + * @method ChildEventGroup[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class EventGroupQuery extends ModelCriteria { @@ -81,9 +87,9 @@ abstract class EventGroupQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\EventGroupQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\EventGroup', $modelAlias = null) { @@ -93,12 +99,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildEventGroupQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildEventGroupQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildEventGroupQuery) { return $criteria; @@ -128,7 +134,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildEventGroup|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -160,8 +166,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -193,8 +199,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildEventGroup|array|mixed the result, formatted by the current formatter */ @@ -214,12 +220,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -236,25 +242,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(EventGroupTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(EventGroupTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(EventGroupTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(EventGroupTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -267,15 +279,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -295,7 +307,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(EventGroupTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(EventGroupTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -305,14 +319,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -320,7 +335,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(EventGroupTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(EventGroupTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -330,14 +347,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -345,7 +363,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(EventGroupTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(EventGroupTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -357,42 +377,48 @@ public function filterByDescription($description = null, $comparison = null) * $query->filterByArchived('yes'); // WHERE archived = true * * - * @param boolean|string $archived The value to use as filter. + * @param bool|string $archived The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByArchived($archived = null, $comparison = null) + public function filterByArchived($archived = null, ?string $comparison = null) { if (is_string($archived)) { - $archived = in_array(strtolower($archived), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $archived = in_array(strtolower($archived), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(EventGroupTableMap::COL_ARCHIVED, $archived, $comparison); + $this->addUsingAlias(EventGroupTableMap::COL_ARCHIVED, $archived, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { - return $this + $this ->addUsingAlias(EventGroupTableMap::COL_ID, $event->getEventGroupId(), $comparison); + + return $this; } elseif ($event instanceof ObjectCollection) { - return $this + $this ->useEventQuery() ->filterByPrimaryKeys($event->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -401,12 +427,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -435,9 +461,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::LEFT_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -448,12 +474,108 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::LEFT_ ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::LEFT_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildEventGroup $eventGroup Object to remove from the list of results + * @param ChildEventGroup $eventGroup Object to remove from the list of results * - * @return $this|ChildEventGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($eventGroup = null) { @@ -470,7 +592,7 @@ public function prune($eventGroup = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventGroupTableMap::DATABASE_NAME); @@ -495,12 +617,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventGroupTableMap::DATABASE_NAME); @@ -524,4 +646,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // EventGroupQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/EventPerson.php b/generated-classes/TechWilk/Rota/Base/EventPerson.php index 2eaafb99..aea14e7d 100644 --- a/generated-classes/TechWilk/Rota/Base/EventPerson.php +++ b/generated-classes/TechWilk/Rota/Base/EventPerson.php @@ -38,19 +38,21 @@ abstract class EventPerson implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventPersonTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventPersonTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -59,14 +61,14 @@ abstract class EventPerson implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -103,7 +105,7 @@ abstract class EventPerson implements ActiveRecordInterface * The value for the removed field. * * Note: this column has a database default value of: 0 - * @var int + * @var int|null */ protected $removed; @@ -119,6 +121,7 @@ abstract class EventPerson implements ActiveRecordInterface /** * @var ObjectCollection|ChildSwap[] Collection to store aggregation of ChildSwap objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildSwap objects. */ protected $collSwaps; protected $collSwapsPartial; @@ -127,13 +130,14 @@ abstract class EventPerson implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildSwap[] + * @phpstan-var ObjectCollection&\Traversable */ protected $swapsScheduledForDeletion = null; @@ -143,7 +147,7 @@ abstract class EventPerson implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->eventid = 0; $this->userroleid = 0; @@ -163,9 +167,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -173,10 +177,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -185,7 +189,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -195,9 +199,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -206,45 +210,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -253,10 +255,10 @@ public function resetModified($col = null) * obj is an instance of EventPerson, delegates to * equals(EventPerson). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -278,7 +280,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -286,10 +288,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -297,15 +299,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -314,12 +316,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|EventPerson The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -329,13 +331,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -346,24 +348,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -371,7 +376,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -421,7 +426,7 @@ public function getNotified() /** * Get the [removed] column value. * - * @return int + * @return int|null */ public function getRemoved() { @@ -431,8 +436,8 @@ public function getRemoved() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -446,13 +451,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [eventid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setEventId($v) { @@ -470,13 +475,13 @@ public function setEventId($v) } return $this; - } // setEventId() + } /** * Set the value of [userroleid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserRoleId($v) { @@ -494,13 +499,13 @@ public function setUserRoleId($v) } return $this; - } // setUserRoleId() + } /** * Set the value of [notified] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setNotified($v) { @@ -514,13 +519,13 @@ public function setNotified($v) } return $this; - } // setNotified() + } /** * Set the value of [removed] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setRemoved($v) { @@ -534,7 +539,7 @@ public function setRemoved($v) } return $this; - } // setRemoved() + } /** * Indicates whether the columns in this object are only set to default values. @@ -542,29 +547,29 @@ public function setRemoved($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->eventid !== 0) { - return false; - } + if ($this->eventid !== 0) { + return false; + } - if ($this->userroleid !== 0) { - return false; - } + if ($this->userroleid !== 0) { + return false; + } - if ($this->notified !== 0) { - return false; - } + if ($this->notified !== 0) { + return false; + } - if ($this->removed !== 0) { - return false; - } + if ($this->removed !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -574,19 +579,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : EventPersonTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -601,8 +607,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : EventPersonTableMap::translateFieldName('Removed', TableMap::TYPE_PHPNAME, $indexType)]; $this->removed = (null !== $col) ? (int) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -610,6 +616,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 5; // 5 = EventPersonTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\EventPerson'), 0, $e); } @@ -626,9 +633,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aEvent !== null && $this->eventid !== $this->aEvent->getId()) { $this->aEvent = null; @@ -636,19 +644,19 @@ public function ensureConsistency() if ($this->aUserRole !== null && $this->userroleid !== $this->aUserRole->getId()) { $this->aUserRole = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -678,19 +686,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->aEvent = null; $this->aUserRole = null; $this->collSwaps = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see EventPerson::setDeleted() * @see EventPerson::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -720,12 +729,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -770,12 +779,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -829,22 +838,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[EventPersonTableMap::COL_ID] = true; @@ -881,18 +891,23 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'eventId': $stmt->bindValue($identifier, $this->eventid, PDO::PARAM_INT); + break; case 'userRoleId': $stmt->bindValue($identifier, $this->userroleid, PDO::PARAM_INT); + break; case 'notified': $stmt->bindValue($identifier, $this->notified, PDO::PARAM_INT); + break; case 'removed': $stmt->bindValue($identifier, $this->removed, PDO::PARAM_INT); + break; } } @@ -915,12 +930,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -931,14 +946,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = EventPersonTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -950,30 +965,29 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getEventId(); - break; + case 2: return $this->getUserRoleId(); - break; + case 3: return $this->getNotified(); - break; + case 4: return $this->getRemoved(); - break; + default: return null; - break; } // switch() } @@ -983,29 +997,29 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['EventPerson'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['EventPerson'][$this->hashCode()] = true; $keys = EventPersonTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getEventId(), $keys[2] => $this->getUserRoleId(), $keys[3] => $this->getNotified(), $keys[4] => $this->getRemoved(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -1013,6 +1027,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aEvent) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'event'; @@ -1024,9 +1039,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Event'; } - $result[$key] = $this->aEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aUserRole) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userRole'; @@ -1038,9 +1054,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'UserRole'; } - $result[$key] = $this->aUserRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUserRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collSwaps) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'swaps'; @@ -1062,30 +1079,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\EventPerson + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = EventPersonTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\EventPerson + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1121,11 +1140,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = EventPersonTableMap::getFieldNames($keyType); @@ -1144,6 +1163,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[4], $arr)) { $this->setRemoved($arr[$keys[4]]); } + + return $this; } /** @@ -1163,9 +1184,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\EventPerson The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1179,9 +1200,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(EventPersonTableMap::DATABASE_NAME); @@ -1208,13 +1229,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildEventPersonQuery::create(); $criteria->add(EventPersonTableMap::COL_ID, $this->id); @@ -1226,7 +1247,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1256,19 +1277,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1279,12 +1301,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\EventPerson (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\EventPerson (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setEventId($this->getEventId()); $copyObj->setUserRoleId($this->getUserRoleId()); @@ -1301,11 +1324,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addSwap($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1317,11 +1341,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\EventPerson Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1334,9 +1358,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildEvent object. * - * @param ChildEvent $v - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) - * @throws PropelException + * @param ChildEvent $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEvent(ChildEvent $v = null) { @@ -1362,11 +1386,11 @@ public function setEvent(ChildEvent $v = null) /** * Get the associated ChildEvent object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildEvent The associated ChildEvent object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvent(ConnectionInterface $con = null) + public function getEvent(?ConnectionInterface $con = null) { if ($this->aEvent === null && ($this->eventid != 0)) { $this->aEvent = ChildEventQuery::create()->findPk($this->eventid, $con); @@ -1385,9 +1409,9 @@ public function getEvent(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildUserRole object. * - * @param ChildUserRole $v - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) - * @throws PropelException + * @param ChildUserRole $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUserRole(ChildUserRole $v = null) { @@ -1413,11 +1437,11 @@ public function setUserRole(ChildUserRole $v = null) /** * Get the associated ChildUserRole object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUserRole The associated ChildUserRole object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUserRole(ConnectionInterface $con = null) + public function getUserRole(?ConnectionInterface $con = null) { if ($this->aUserRole === null && ($this->userroleid != 0)) { $this->aUserRole = ChildUserRoleQuery::create()->findPk($this->userroleid, $con); @@ -1439,12 +1463,12 @@ public function getUserRole(ConnectionInterface $con = null) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('Swap' == $relationName) { + if ('Swap' === $relationName) { $this->initSwaps(); return; } @@ -1456,18 +1480,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addSwaps() + * @return $this + * @see addSwaps() */ public function clearSwaps() { $this->collSwaps = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collSwaps collection loaded partially. + * + * @return void */ - public function resetPartialSwaps($v = true) + public function resetPartialSwaps($v = true): void { $this->collSwapsPartial = $v; } @@ -1479,12 +1507,12 @@ public function resetPartialSwaps($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initSwaps($overrideExisting = true) + public function initSwaps(bool $overrideExisting = true): void { if (null !== $this->collSwaps && !$overrideExisting) { return; @@ -1505,18 +1533,28 @@ public function initSwaps($overrideExisting = true) * If this ChildEventPerson is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildSwap[] List of ChildSwap objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getSwaps(Criteria $criteria = null, ConnectionInterface $con = null) + public function getSwaps(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collSwapsPartial && !$this->isNew(); - if (null === $this->collSwaps || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collSwaps) { + if (null === $this->collSwaps || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initSwaps(); + if (null === $this->collSwaps) { + $this->initSwaps(); + } else { + $collectionClassName = SwapTableMap::getTableMap()->getCollectionClassName(); + + $collSwaps = new $collectionClassName; + $collSwaps->setModel('\TechWilk\Rota\Swap'); + + return $collSwaps; + } } else { $collSwaps = ChildSwapQuery::create(null, $criteria) ->filterByEventPerson($this) @@ -1560,11 +1598,11 @@ public function getSwaps(Criteria $criteria = null, ConnectionInterface $con = n * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $swaps A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEventPerson The current object (for fluent API support) + * @param Collection $swaps A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setSwaps(Collection $swaps, ConnectionInterface $con = null) + public function setSwaps(Collection $swaps, ?ConnectionInterface $con = null) { /** @var ChildSwap[] $swapsToDelete */ $swapsToDelete = $this->getSwaps(new Criteria(), $con)->diff($swaps); @@ -1590,13 +1628,13 @@ public function setSwaps(Collection $swaps, ConnectionInterface $con = null) /** * Returns the number of related Swap objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Swap objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Swap objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countSwaps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countSwaps(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collSwapsPartial && !$this->isNew(); if (null === $this->collSwaps || null !== $criteria || $partial) { @@ -1625,8 +1663,8 @@ public function countSwaps(Criteria $criteria = null, $distinct = false, Connect * Method called to associate a ChildSwap object to this object * through the ChildSwap foreign key attribute. * - * @param ChildSwap $l ChildSwap - * @return $this|\TechWilk\Rota\EventPerson The current object (for fluent API support) + * @param ChildSwap $l ChildSwap + * @return $this The current object (for fluent API support) */ public function addSwap(ChildSwap $l) { @@ -1649,15 +1687,15 @@ public function addSwap(ChildSwap $l) /** * @param ChildSwap $swap The ChildSwap object to add. */ - protected function doAddSwap(ChildSwap $swap) + protected function doAddSwap(ChildSwap $swap): void { $this->collSwaps[]= $swap; $swap->setEventPerson($this); } /** - * @param ChildSwap $swap The ChildSwap object to remove. - * @return $this|ChildEventPerson The current object (for fluent API support) + * @param ChildSwap $swap The ChildSwap object to remove. + * @return $this The current object (for fluent API support) */ public function removeSwap(ChildSwap $swap) { @@ -1687,12 +1725,13 @@ public function removeSwap(ChildSwap $swap) * api reasonable. You can provide public methods for those you * actually need in EventPerson. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsJoinOldUserRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsJoinOldUserRole(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('OldUserRole', $joinBehavior); @@ -1712,12 +1751,13 @@ public function getSwapsJoinOldUserRole(Criteria $criteria = null, ConnectionInt * api reasonable. You can provide public methods for those you * actually need in EventPerson. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsJoinNewUserRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsJoinNewUserRole(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('NewUserRole', $joinBehavior); @@ -1737,12 +1777,13 @@ public function getSwapsJoinNewUserRole(Criteria $criteria = null, ConnectionInt * api reasonable. You can provide public methods for those you * actually need in EventPerson. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1754,6 +1795,8 @@ public function getSwapsJoinUser(Criteria $criteria = null, ConnectionInterface * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1774,6 +1817,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1782,9 +1827,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collSwaps) { @@ -1797,6 +1843,7 @@ public function clearAllReferences($deep = false) $this->collSwaps = null; $this->aEvent = null; $this->aUserRole = null; + return $this; } /** @@ -1811,99 +1858,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1913,7 +1940,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1933,17 +1960,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/EventPersonQuery.php b/generated-classes/TechWilk/Rota/Base/EventPersonQuery.php index 8ccea472..507758a9 100644 --- a/generated-classes/TechWilk/Rota/Base/EventPersonQuery.php +++ b/generated-classes/TechWilk/Rota/Base/EventPersonQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\EventPersonTableMap; /** - * Base class that represents a query for the 'eventPeople' table. - * - * + * Base class that represents a query for the `eventPeople` table. * * @method ChildEventPersonQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildEventPersonQuery orderByEventId($order = Criteria::ASC) Order by the eventId column @@ -72,17 +71,17 @@ * * @method \TechWilk\Rota\EventQuery|\TechWilk\Rota\UserRoleQuery|\TechWilk\Rota\SwapQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildEventPerson findOne(ConnectionInterface $con = null) Return the first ChildEventPerson matching the query - * @method ChildEventPerson findOneOrCreate(ConnectionInterface $con = null) Return the first ChildEventPerson matching the query, or a new ChildEventPerson object populated from the query conditions when no match is found + * @method ChildEventPerson|null findOne(?ConnectionInterface $con = null) Return the first ChildEventPerson matching the query + * @method ChildEventPerson findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildEventPerson matching the query, or a new ChildEventPerson object populated from the query conditions when no match is found + * + * @method ChildEventPerson|null findOneById(int $id) Return the first ChildEventPerson filtered by the id column + * @method ChildEventPerson|null findOneByEventId(int $eventId) Return the first ChildEventPerson filtered by the eventId column + * @method ChildEventPerson|null findOneByUserRoleId(int $userRoleId) Return the first ChildEventPerson filtered by the userRoleId column + * @method ChildEventPerson|null findOneByNotified(int $notified) Return the first ChildEventPerson filtered by the notified column + * @method ChildEventPerson|null findOneByRemoved(int $removed) Return the first ChildEventPerson filtered by the removed column * - * @method ChildEventPerson findOneById(int $id) Return the first ChildEventPerson filtered by the id column - * @method ChildEventPerson findOneByEventId(int $eventId) Return the first ChildEventPerson filtered by the eventId column - * @method ChildEventPerson findOneByUserRoleId(int $userRoleId) Return the first ChildEventPerson filtered by the userRoleId column - * @method ChildEventPerson findOneByNotified(int $notified) Return the first ChildEventPerson filtered by the notified column - * @method ChildEventPerson findOneByRemoved(int $removed) Return the first ChildEventPerson filtered by the removed column * - - * @method ChildEventPerson requirePk($key, ConnectionInterface $con = null) Return the ChildEventPerson by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildEventPerson requireOne(ConnectionInterface $con = null) Return the first ChildEventPerson matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventPerson requirePk($key, ?ConnectionInterface $con = null) Return the ChildEventPerson by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventPerson requireOne(?ConnectionInterface $con = null) Return the first ChildEventPerson matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildEventPerson requireOneById(int $id) Return the first ChildEventPerson filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventPerson requireOneByEventId(int $eventId) Return the first ChildEventPerson filtered by the eventId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -90,14 +89,22 @@ * @method ChildEventPerson requireOneByNotified(int $notified) Return the first ChildEventPerson filtered by the notified column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventPerson requireOneByRemoved(int $removed) Return the first ChildEventPerson filtered by the removed column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildEventPerson[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildEventPerson objects based on current ModelCriteria - * @method ChildEventPerson[]|ObjectCollection findById(int $id) Return ChildEventPerson objects filtered by the id column - * @method ChildEventPerson[]|ObjectCollection findByEventId(int $eventId) Return ChildEventPerson objects filtered by the eventId column - * @method ChildEventPerson[]|ObjectCollection findByUserRoleId(int $userRoleId) Return ChildEventPerson objects filtered by the userRoleId column - * @method ChildEventPerson[]|ObjectCollection findByNotified(int $notified) Return ChildEventPerson objects filtered by the notified column - * @method ChildEventPerson[]|ObjectCollection findByRemoved(int $removed) Return ChildEventPerson objects filtered by the removed column - * @method ChildEventPerson[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildEventPerson[]|Collection find(?ConnectionInterface $con = null) Return ChildEventPerson objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildEventPerson objects based on current ModelCriteria * + * @method ChildEventPerson[]|Collection findById(int|array $id) Return ChildEventPerson objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildEventPerson objects filtered by the id column + * @method ChildEventPerson[]|Collection findByEventId(int|array $eventId) Return ChildEventPerson objects filtered by the eventId column + * @psalm-method Collection&\Traversable findByEventId(int|array $eventId) Return ChildEventPerson objects filtered by the eventId column + * @method ChildEventPerson[]|Collection findByUserRoleId(int|array $userRoleId) Return ChildEventPerson objects filtered by the userRoleId column + * @psalm-method Collection&\Traversable findByUserRoleId(int|array $userRoleId) Return ChildEventPerson objects filtered by the userRoleId column + * @method ChildEventPerson[]|Collection findByNotified(int|array $notified) Return ChildEventPerson objects filtered by the notified column + * @psalm-method Collection&\Traversable findByNotified(int|array $notified) Return ChildEventPerson objects filtered by the notified column + * @method ChildEventPerson[]|Collection findByRemoved(int|array $removed) Return ChildEventPerson objects filtered by the removed column + * @psalm-method Collection&\Traversable findByRemoved(int|array $removed) Return ChildEventPerson objects filtered by the removed column + * + * @method ChildEventPerson[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class EventPersonQuery extends ModelCriteria { @@ -106,9 +113,9 @@ abstract class EventPersonQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\EventPersonQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\EventPerson', $modelAlias = null) { @@ -118,12 +125,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildEventPersonQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildEventPersonQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildEventPersonQuery) { return $criteria; @@ -153,7 +160,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildEventPerson|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -185,8 +192,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -218,8 +225,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildEventPerson|array|mixed the result, formatted by the current formatter */ @@ -239,12 +246,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -261,25 +268,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(EventPersonTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(EventPersonTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(EventPersonTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(EventPersonTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -292,15 +305,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -320,7 +333,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(EventPersonTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(EventPersonTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -335,15 +350,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByEvent() * - * @param mixed $eventId The value to use as filter. + * @param mixed $eventId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventId($eventId = null, $comparison = null) + public function filterByEventId($eventId = null, ?string $comparison = null) { if (is_array($eventId)) { $useMinMax = false; @@ -363,7 +378,9 @@ public function filterByEventId($eventId = null, $comparison = null) } } - return $this->addUsingAlias(EventPersonTableMap::COL_EVENTID, $eventId, $comparison); + $this->addUsingAlias(EventPersonTableMap::COL_EVENTID, $eventId, $comparison); + + return $this; } /** @@ -378,15 +395,15 @@ public function filterByEventId($eventId = null, $comparison = null) * * @see filterByUserRole() * - * @param mixed $userRoleId The value to use as filter. + * @param mixed $userRoleId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserRoleId($userRoleId = null, $comparison = null) + public function filterByUserRoleId($userRoleId = null, ?string $comparison = null) { if (is_array($userRoleId)) { $useMinMax = false; @@ -406,7 +423,9 @@ public function filterByUserRoleId($userRoleId = null, $comparison = null) } } - return $this->addUsingAlias(EventPersonTableMap::COL_USERROLEID, $userRoleId, $comparison); + $this->addUsingAlias(EventPersonTableMap::COL_USERROLEID, $userRoleId, $comparison); + + return $this; } /** @@ -419,15 +438,15 @@ public function filterByUserRoleId($userRoleId = null, $comparison = null) * $query->filterByNotified(array('min' => 12)); // WHERE notified > 12 * * - * @param mixed $notified The value to use as filter. + * @param mixed $notified The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotified($notified = null, $comparison = null) + public function filterByNotified($notified = null, ?string $comparison = null) { if (is_array($notified)) { $useMinMax = false; @@ -447,7 +466,9 @@ public function filterByNotified($notified = null, $comparison = null) } } - return $this->addUsingAlias(EventPersonTableMap::COL_NOTIFIED, $notified, $comparison); + $this->addUsingAlias(EventPersonTableMap::COL_NOTIFIED, $notified, $comparison); + + return $this; } /** @@ -460,15 +481,15 @@ public function filterByNotified($notified = null, $comparison = null) * $query->filterByRemoved(array('min' => 12)); // WHERE removed > 12 * * - * @param mixed $removed The value to use as filter. + * @param mixed $removed The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRemoved($removed = null, $comparison = null) + public function filterByRemoved($removed = null, ?string $comparison = null) { if (is_array($removed)) { $useMinMax = false; @@ -488,20 +509,22 @@ public function filterByRemoved($removed = null, $comparison = null) } } - return $this->addUsingAlias(EventPersonTableMap::COL_REMOVED, $removed, $comparison); + $this->addUsingAlias(EventPersonTableMap::COL_REMOVED, $removed, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { return $this @@ -511,8 +534,10 @@ public function filterByEvent($event, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventPersonTableMap::COL_EVENTID, $event->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -521,12 +546,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -555,9 +580,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -568,17 +593,113 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\UserRole object * * @param \TechWilk\Rota\UserRole|ObjectCollection $userRole The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserRole($userRole, $comparison = null) + public function filterByUserRole($userRole, ?string $comparison = null) { if ($userRole instanceof \TechWilk\Rota\UserRole) { return $this @@ -588,8 +709,10 @@ public function filterByUserRole($userRole, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventPersonTableMap::COL_USERROLEID, $userRole->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUserRole() only accepts arguments of type \TechWilk\Rota\UserRole or Collection'); } @@ -598,12 +721,12 @@ public function filterByUserRole($userRole, $comparison = null) /** * Adds a JOIN clause to the query using the UserRole relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUserRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUserRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('UserRole'); @@ -632,9 +755,9 @@ public function joinUserRole($relationAlias = null, $joinType = Criteria::INNER_ * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserRoleQuery A secondary query class using the current class as primary query */ @@ -645,24 +768,124 @@ public function useUserRoleQuery($relationAlias = null, $joinType = Criteria::IN ->useQuery($relationAlias ? $relationAlias : 'UserRole', '\TechWilk\Rota\UserRoleQuery'); } + /** + * Use the UserRole relation UserRole object + * + * @param callable(\TechWilk\Rota\UserRoleQuery):\TechWilk\Rota\UserRoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to UserRole table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the EXISTS statement + */ + public function useUserRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('UserRole', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to UserRole table for a NOT EXISTS query. + * + * @see useUserRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT EXISTS statement + */ + public function useUserRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('UserRole', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to UserRole table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the IN statement + */ + public function useInUserRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('UserRole', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to UserRole table for a NOT IN query. + * + * @see useUserRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT IN statement + */ + public function useNotInUserRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('UserRole', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Swap object * * @param \TechWilk\Rota\Swap|ObjectCollection $swap the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySwap($swap, $comparison = null) + public function filterBySwap($swap, ?string $comparison = null) { if ($swap instanceof \TechWilk\Rota\Swap) { - return $this + $this ->addUsingAlias(EventPersonTableMap::COL_ID, $swap->getEventPersonId(), $comparison); + + return $this; } elseif ($swap instanceof ObjectCollection) { - return $this + $this ->useSwapQuery() ->filterByPrimaryKeys($swap->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterBySwap() only accepts arguments of type \TechWilk\Rota\Swap or Collection'); } @@ -671,12 +894,12 @@ public function filterBySwap($swap, $comparison = null) /** * Adds a JOIN clause to the query using the Swap relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinSwap($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinSwap(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Swap'); @@ -705,9 +928,9 @@ public function joinSwap($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\SwapQuery A secondary query class using the current class as primary query */ @@ -718,12 +941,108 @@ public function useSwapQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'Swap', '\TechWilk\Rota\SwapQuery'); } + /** + * Use the Swap relation Swap object + * + * @param callable(\TechWilk\Rota\SwapQuery):\TechWilk\Rota\SwapQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withSwapQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useSwapQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Swap table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the EXISTS statement + */ + public function useSwapExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('Swap', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Swap table for a NOT EXISTS query. + * + * @see useSwapExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT EXISTS statement + */ + public function useSwapNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('Swap', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Swap table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the IN statement + */ + public function useInSwapQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('Swap', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Swap table for a NOT IN query. + * + * @see useSwapInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT IN statement + */ + public function useNotInSwapQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('Swap', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildEventPerson $eventPerson Object to remove from the list of results + * @param ChildEventPerson $eventPerson Object to remove from the list of results * - * @return $this|ChildEventPersonQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($eventPerson = null) { @@ -740,7 +1059,7 @@ public function prune($eventPerson = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventPersonTableMap::DATABASE_NAME); @@ -765,12 +1084,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventPersonTableMap::DATABASE_NAME); @@ -794,4 +1113,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // EventPersonQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/EventQuery.php b/generated-classes/TechWilk/Rota/Base/EventQuery.php index ebf6804a..2011c6e0 100644 --- a/generated-classes/TechWilk/Rota/Base/EventQuery.php +++ b/generated-classes/TechWilk/Rota/Base/EventQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\EventTableMap; /** - * Base class that represents a query for the 'events' table. - * - * + * Base class that represents a query for the `events` table. * * @method ChildEventQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildEventQuery orderByDate($order = Criteria::ASC) Order by the date column @@ -144,28 +143,28 @@ * * @method \TechWilk\Rota\UserQuery|\TechWilk\Rota\EventTypeQuery|\TechWilk\Rota\EventSubTypeQuery|\TechWilk\Rota\LocationQuery|\TechWilk\Rota\EventGroupQuery|\TechWilk\Rota\CommentQuery|\TechWilk\Rota\EventPersonQuery|\TechWilk\Rota\AvailabilityQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildEvent findOne(ConnectionInterface $con = null) Return the first ChildEvent matching the query - * @method ChildEvent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildEvent matching the query, or a new ChildEvent object populated from the query conditions when no match is found + * @method ChildEvent|null findOne(?ConnectionInterface $con = null) Return the first ChildEvent matching the query + * @method ChildEvent findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildEvent matching the query, or a new ChildEvent object populated from the query conditions when no match is found * - * @method ChildEvent findOneById(int $id) Return the first ChildEvent filtered by the id column - * @method ChildEvent findOneByDate(string $date) Return the first ChildEvent filtered by the date column - * @method ChildEvent findOneByName(string $name) Return the first ChildEvent filtered by the name column - * @method ChildEvent findOneByCreatedBy(int $createdBy) Return the first ChildEvent filtered by the createdBy column - * @method ChildEvent findOneByRehearsalDate(string $rehearsalDate) Return the first ChildEvent filtered by the rehearsalDate column - * @method ChildEvent findOneByEventTypeId(int $type) Return the first ChildEvent filtered by the type column - * @method ChildEvent findOneByEventSubTypeId(int $subType) Return the first ChildEvent filtered by the subType column - * @method ChildEvent findOneByLocationId(int $location) Return the first ChildEvent filtered by the location column - * @method ChildEvent findOneByNotified(int $notified) Return the first ChildEvent filtered by the notified column - * @method ChildEvent findOneByRehearsal(int $rehearsal) Return the first ChildEvent filtered by the rehearsal column - * @method ChildEvent findOneByRemoved(int $removed) Return the first ChildEvent filtered by the removed column - * @method ChildEvent findOneByEventGroupId(int $eventGroup) Return the first ChildEvent filtered by the eventGroup column - * @method ChildEvent findOneBySermonTitle(string $sermonTitle) Return the first ChildEvent filtered by the sermonTitle column - * @method ChildEvent findOneByBibleVerse(string $bibleVerse) Return the first ChildEvent filtered by the bibleVerse column - * @method ChildEvent findOneByCreated(string $created) Return the first ChildEvent filtered by the created column - * @method ChildEvent findOneByUpdated(string $updated) Return the first ChildEvent filtered by the updated column * - - * @method ChildEvent requirePk($key, ConnectionInterface $con = null) Return the ChildEvent by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildEvent requireOne(ConnectionInterface $con = null) Return the first ChildEvent matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEvent|null findOneById(int $id) Return the first ChildEvent filtered by the id column + * @method ChildEvent|null findOneByDate(string $date) Return the first ChildEvent filtered by the date column + * @method ChildEvent|null findOneByName(string $name) Return the first ChildEvent filtered by the name column + * @method ChildEvent|null findOneByCreatedBy(int $createdBy) Return the first ChildEvent filtered by the createdBy column + * @method ChildEvent|null findOneByRehearsalDate(string $rehearsalDate) Return the first ChildEvent filtered by the rehearsalDate column + * @method ChildEvent|null findOneByEventTypeId(int $type) Return the first ChildEvent filtered by the type column + * @method ChildEvent|null findOneByEventSubTypeId(int $subType) Return the first ChildEvent filtered by the subType column + * @method ChildEvent|null findOneByLocationId(int $location) Return the first ChildEvent filtered by the location column + * @method ChildEvent|null findOneByNotified(int $notified) Return the first ChildEvent filtered by the notified column + * @method ChildEvent|null findOneByRehearsal(int $rehearsal) Return the first ChildEvent filtered by the rehearsal column + * @method ChildEvent|null findOneByRemoved(int $removed) Return the first ChildEvent filtered by the removed column + * @method ChildEvent|null findOneByEventGroupId(int $eventGroup) Return the first ChildEvent filtered by the eventGroup column + * @method ChildEvent|null findOneBySermonTitle(string $sermonTitle) Return the first ChildEvent filtered by the sermonTitle column + * @method ChildEvent|null findOneByBibleVerse(string $bibleVerse) Return the first ChildEvent filtered by the bibleVerse column + * @method ChildEvent|null findOneByCreated(string $created) Return the first ChildEvent filtered by the created column + * @method ChildEvent|null findOneByUpdated(string $updated) Return the first ChildEvent filtered by the updated column + * + * @method ChildEvent requirePk($key, ?ConnectionInterface $con = null) Return the ChildEvent by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEvent requireOne(?ConnectionInterface $con = null) Return the first ChildEvent matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildEvent requireOneById(int $id) Return the first ChildEvent filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEvent requireOneByDate(string $date) Return the first ChildEvent filtered by the date column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -184,25 +183,44 @@ * @method ChildEvent requireOneByCreated(string $created) Return the first ChildEvent filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEvent requireOneByUpdated(string $updated) Return the first ChildEvent filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildEvent[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildEvent objects based on current ModelCriteria - * @method ChildEvent[]|ObjectCollection findById(int $id) Return ChildEvent objects filtered by the id column - * @method ChildEvent[]|ObjectCollection findByDate(string $date) Return ChildEvent objects filtered by the date column - * @method ChildEvent[]|ObjectCollection findByName(string $name) Return ChildEvent objects filtered by the name column - * @method ChildEvent[]|ObjectCollection findByCreatedBy(int $createdBy) Return ChildEvent objects filtered by the createdBy column - * @method ChildEvent[]|ObjectCollection findByRehearsalDate(string $rehearsalDate) Return ChildEvent objects filtered by the rehearsalDate column - * @method ChildEvent[]|ObjectCollection findByEventTypeId(int $type) Return ChildEvent objects filtered by the type column - * @method ChildEvent[]|ObjectCollection findByEventSubTypeId(int $subType) Return ChildEvent objects filtered by the subType column - * @method ChildEvent[]|ObjectCollection findByLocationId(int $location) Return ChildEvent objects filtered by the location column - * @method ChildEvent[]|ObjectCollection findByNotified(int $notified) Return ChildEvent objects filtered by the notified column - * @method ChildEvent[]|ObjectCollection findByRehearsal(int $rehearsal) Return ChildEvent objects filtered by the rehearsal column - * @method ChildEvent[]|ObjectCollection findByRemoved(int $removed) Return ChildEvent objects filtered by the removed column - * @method ChildEvent[]|ObjectCollection findByEventGroupId(int $eventGroup) Return ChildEvent objects filtered by the eventGroup column - * @method ChildEvent[]|ObjectCollection findBySermonTitle(string $sermonTitle) Return ChildEvent objects filtered by the sermonTitle column - * @method ChildEvent[]|ObjectCollection findByBibleVerse(string $bibleVerse) Return ChildEvent objects filtered by the bibleVerse column - * @method ChildEvent[]|ObjectCollection findByCreated(string $created) Return ChildEvent objects filtered by the created column - * @method ChildEvent[]|ObjectCollection findByUpdated(string $updated) Return ChildEvent objects filtered by the updated column - * @method ChildEvent[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildEvent[]|Collection find(?ConnectionInterface $con = null) Return ChildEvent objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildEvent objects based on current ModelCriteria + * + * @method ChildEvent[]|Collection findById(int|array $id) Return ChildEvent objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildEvent objects filtered by the id column + * @method ChildEvent[]|Collection findByDate(string|array $date) Return ChildEvent objects filtered by the date column + * @psalm-method Collection&\Traversable findByDate(string|array $date) Return ChildEvent objects filtered by the date column + * @method ChildEvent[]|Collection findByName(string|array $name) Return ChildEvent objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildEvent objects filtered by the name column + * @method ChildEvent[]|Collection findByCreatedBy(int|array $createdBy) Return ChildEvent objects filtered by the createdBy column + * @psalm-method Collection&\Traversable findByCreatedBy(int|array $createdBy) Return ChildEvent objects filtered by the createdBy column + * @method ChildEvent[]|Collection findByRehearsalDate(string|array $rehearsalDate) Return ChildEvent objects filtered by the rehearsalDate column + * @psalm-method Collection&\Traversable findByRehearsalDate(string|array $rehearsalDate) Return ChildEvent objects filtered by the rehearsalDate column + * @method ChildEvent[]|Collection findByEventTypeId(int|array $type) Return ChildEvent objects filtered by the type column + * @psalm-method Collection&\Traversable findByEventTypeId(int|array $type) Return ChildEvent objects filtered by the type column + * @method ChildEvent[]|Collection findByEventSubTypeId(int|array $subType) Return ChildEvent objects filtered by the subType column + * @psalm-method Collection&\Traversable findByEventSubTypeId(int|array $subType) Return ChildEvent objects filtered by the subType column + * @method ChildEvent[]|Collection findByLocationId(int|array $location) Return ChildEvent objects filtered by the location column + * @psalm-method Collection&\Traversable findByLocationId(int|array $location) Return ChildEvent objects filtered by the location column + * @method ChildEvent[]|Collection findByNotified(int|array $notified) Return ChildEvent objects filtered by the notified column + * @psalm-method Collection&\Traversable findByNotified(int|array $notified) Return ChildEvent objects filtered by the notified column + * @method ChildEvent[]|Collection findByRehearsal(int|array $rehearsal) Return ChildEvent objects filtered by the rehearsal column + * @psalm-method Collection&\Traversable findByRehearsal(int|array $rehearsal) Return ChildEvent objects filtered by the rehearsal column + * @method ChildEvent[]|Collection findByRemoved(int|array $removed) Return ChildEvent objects filtered by the removed column + * @psalm-method Collection&\Traversable findByRemoved(int|array $removed) Return ChildEvent objects filtered by the removed column + * @method ChildEvent[]|Collection findByEventGroupId(int|array $eventGroup) Return ChildEvent objects filtered by the eventGroup column + * @psalm-method Collection&\Traversable findByEventGroupId(int|array $eventGroup) Return ChildEvent objects filtered by the eventGroup column + * @method ChildEvent[]|Collection findBySermonTitle(string|array $sermonTitle) Return ChildEvent objects filtered by the sermonTitle column + * @psalm-method Collection&\Traversable findBySermonTitle(string|array $sermonTitle) Return ChildEvent objects filtered by the sermonTitle column + * @method ChildEvent[]|Collection findByBibleVerse(string|array $bibleVerse) Return ChildEvent objects filtered by the bibleVerse column + * @psalm-method Collection&\Traversable findByBibleVerse(string|array $bibleVerse) Return ChildEvent objects filtered by the bibleVerse column + * @method ChildEvent[]|Collection findByCreated(string|array $created) Return ChildEvent objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildEvent objects filtered by the created column + * @method ChildEvent[]|Collection findByUpdated(string|array $updated) Return ChildEvent objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildEvent objects filtered by the updated column * + * @method ChildEvent[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class EventQuery extends ModelCriteria { @@ -211,9 +229,9 @@ abstract class EventQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\EventQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Event', $modelAlias = null) { @@ -223,12 +241,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildEventQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildEventQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildEventQuery) { return $criteria; @@ -258,7 +276,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildEvent|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -290,8 +308,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -323,8 +341,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildEvent|array|mixed the result, formatted by the current formatter */ @@ -344,12 +362,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -366,25 +384,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(EventTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(EventTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(EventTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(EventTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -397,15 +421,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -425,7 +449,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(EventTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -438,17 +464,17 @@ public function filterById($id = null, $comparison = null) * $query->filterByDate(array('max' => 'yesterday')); // WHERE date > '2011-03-13' * * - * @param mixed $date The value to use as filter. + * @param mixed $date The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDate($date = null, $comparison = null) + public function filterByDate($date = null, ?string $comparison = null) { if (is_array($date)) { $useMinMax = false; @@ -468,7 +494,9 @@ public function filterByDate($date = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_DATE, $date, $comparison); + $this->addUsingAlias(EventTableMap::COL_DATE, $date, $comparison); + + return $this; } /** @@ -478,14 +506,15 @@ public function filterByDate($date = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -493,7 +522,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(EventTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -508,15 +539,15 @@ public function filterByName($name = null, $comparison = null) * * @see filterByUser() * - * @param mixed $createdBy The value to use as filter. + * @param mixed $createdBy The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreatedBy($createdBy = null, $comparison = null) + public function filterByCreatedBy($createdBy = null, ?string $comparison = null) { if (is_array($createdBy)) { $useMinMax = false; @@ -536,7 +567,9 @@ public function filterByCreatedBy($createdBy = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_CREATEDBY, $createdBy, $comparison); + $this->addUsingAlias(EventTableMap::COL_CREATEDBY, $createdBy, $comparison); + + return $this; } /** @@ -549,17 +582,17 @@ public function filterByCreatedBy($createdBy = null, $comparison = null) * $query->filterByRehearsalDate(array('max' => 'yesterday')); // WHERE rehearsalDate > '2011-03-13' * * - * @param mixed $rehearsalDate The value to use as filter. + * @param mixed $rehearsalDate The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRehearsalDate($rehearsalDate = null, $comparison = null) + public function filterByRehearsalDate($rehearsalDate = null, ?string $comparison = null) { if (is_array($rehearsalDate)) { $useMinMax = false; @@ -579,7 +612,9 @@ public function filterByRehearsalDate($rehearsalDate = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_REHEARSALDATE, $rehearsalDate, $comparison); + $this->addUsingAlias(EventTableMap::COL_REHEARSALDATE, $rehearsalDate, $comparison); + + return $this; } /** @@ -594,15 +629,15 @@ public function filterByRehearsalDate($rehearsalDate = null, $comparison = null) * * @see filterByEventType() * - * @param mixed $eventTypeId The value to use as filter. + * @param mixed $eventTypeId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventTypeId($eventTypeId = null, $comparison = null) + public function filterByEventTypeId($eventTypeId = null, ?string $comparison = null) { if (is_array($eventTypeId)) { $useMinMax = false; @@ -622,7 +657,9 @@ public function filterByEventTypeId($eventTypeId = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_TYPE, $eventTypeId, $comparison); + $this->addUsingAlias(EventTableMap::COL_TYPE, $eventTypeId, $comparison); + + return $this; } /** @@ -637,15 +674,15 @@ public function filterByEventTypeId($eventTypeId = null, $comparison = null) * * @see filterByEventSubType() * - * @param mixed $eventSubTypeId The value to use as filter. + * @param mixed $eventSubTypeId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventSubTypeId($eventSubTypeId = null, $comparison = null) + public function filterByEventSubTypeId($eventSubTypeId = null, ?string $comparison = null) { if (is_array($eventSubTypeId)) { $useMinMax = false; @@ -665,7 +702,9 @@ public function filterByEventSubTypeId($eventSubTypeId = null, $comparison = nul } } - return $this->addUsingAlias(EventTableMap::COL_SUBTYPE, $eventSubTypeId, $comparison); + $this->addUsingAlias(EventTableMap::COL_SUBTYPE, $eventSubTypeId, $comparison); + + return $this; } /** @@ -680,15 +719,15 @@ public function filterByEventSubTypeId($eventSubTypeId = null, $comparison = nul * * @see filterByLocation() * - * @param mixed $locationId The value to use as filter. + * @param mixed $locationId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLocationId($locationId = null, $comparison = null) + public function filterByLocationId($locationId = null, ?string $comparison = null) { if (is_array($locationId)) { $useMinMax = false; @@ -708,7 +747,9 @@ public function filterByLocationId($locationId = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_LOCATION, $locationId, $comparison); + $this->addUsingAlias(EventTableMap::COL_LOCATION, $locationId, $comparison); + + return $this; } /** @@ -721,15 +762,15 @@ public function filterByLocationId($locationId = null, $comparison = null) * $query->filterByNotified(array('min' => 12)); // WHERE notified > 12 * * - * @param mixed $notified The value to use as filter. + * @param mixed $notified The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotified($notified = null, $comparison = null) + public function filterByNotified($notified = null, ?string $comparison = null) { if (is_array($notified)) { $useMinMax = false; @@ -749,7 +790,9 @@ public function filterByNotified($notified = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_NOTIFIED, $notified, $comparison); + $this->addUsingAlias(EventTableMap::COL_NOTIFIED, $notified, $comparison); + + return $this; } /** @@ -762,15 +805,15 @@ public function filterByNotified($notified = null, $comparison = null) * $query->filterByRehearsal(array('min' => 12)); // WHERE rehearsal > 12 * * - * @param mixed $rehearsal The value to use as filter. + * @param mixed $rehearsal The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRehearsal($rehearsal = null, $comparison = null) + public function filterByRehearsal($rehearsal = null, ?string $comparison = null) { if (is_array($rehearsal)) { $useMinMax = false; @@ -790,7 +833,9 @@ public function filterByRehearsal($rehearsal = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_REHEARSAL, $rehearsal, $comparison); + $this->addUsingAlias(EventTableMap::COL_REHEARSAL, $rehearsal, $comparison); + + return $this; } /** @@ -803,15 +848,15 @@ public function filterByRehearsal($rehearsal = null, $comparison = null) * $query->filterByRemoved(array('min' => 12)); // WHERE removed > 12 * * - * @param mixed $removed The value to use as filter. + * @param mixed $removed The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRemoved($removed = null, $comparison = null) + public function filterByRemoved($removed = null, ?string $comparison = null) { if (is_array($removed)) { $useMinMax = false; @@ -831,7 +876,9 @@ public function filterByRemoved($removed = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_REMOVED, $removed, $comparison); + $this->addUsingAlias(EventTableMap::COL_REMOVED, $removed, $comparison); + + return $this; } /** @@ -846,15 +893,15 @@ public function filterByRemoved($removed = null, $comparison = null) * * @see filterByEventGroup() * - * @param mixed $eventGroupId The value to use as filter. + * @param mixed $eventGroupId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventGroupId($eventGroupId = null, $comparison = null) + public function filterByEventGroupId($eventGroupId = null, ?string $comparison = null) { if (is_array($eventGroupId)) { $useMinMax = false; @@ -874,7 +921,9 @@ public function filterByEventGroupId($eventGroupId = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_EVENTGROUP, $eventGroupId, $comparison); + $this->addUsingAlias(EventTableMap::COL_EVENTGROUP, $eventGroupId, $comparison); + + return $this; } /** @@ -884,14 +933,15 @@ public function filterByEventGroupId($eventGroupId = null, $comparison = null) * * $query->filterBySermonTitle('fooValue'); // WHERE sermonTitle = 'fooValue' * $query->filterBySermonTitle('%fooValue%', Criteria::LIKE); // WHERE sermonTitle LIKE '%fooValue%' + * $query->filterBySermonTitle(['foo', 'bar']); // WHERE sermonTitle IN ('foo', 'bar') * * - * @param string $sermonTitle The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $sermonTitle The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySermonTitle($sermonTitle = null, $comparison = null) + public function filterBySermonTitle($sermonTitle = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($sermonTitle)) { @@ -899,7 +949,9 @@ public function filterBySermonTitle($sermonTitle = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_SERMONTITLE, $sermonTitle, $comparison); + $this->addUsingAlias(EventTableMap::COL_SERMONTITLE, $sermonTitle, $comparison); + + return $this; } /** @@ -909,14 +961,15 @@ public function filterBySermonTitle($sermonTitle = null, $comparison = null) * * $query->filterByBibleVerse('fooValue'); // WHERE bibleVerse = 'fooValue' * $query->filterByBibleVerse('%fooValue%', Criteria::LIKE); // WHERE bibleVerse LIKE '%fooValue%' + * $query->filterByBibleVerse(['foo', 'bar']); // WHERE bibleVerse IN ('foo', 'bar') * * - * @param string $bibleVerse The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $bibleVerse The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByBibleVerse($bibleVerse = null, $comparison = null) + public function filterByBibleVerse($bibleVerse = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($bibleVerse)) { @@ -924,7 +977,9 @@ public function filterByBibleVerse($bibleVerse = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_BIBLEVERSE, $bibleVerse, $comparison); + $this->addUsingAlias(EventTableMap::COL_BIBLEVERSE, $bibleVerse, $comparison); + + return $this; } /** @@ -937,17 +992,17 @@ public function filterByBibleVerse($bibleVerse = null, $comparison = null) * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -967,7 +1022,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(EventTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -980,17 +1037,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -1010,20 +1067,22 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(EventTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(EventTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -1033,8 +1092,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventTableMap::COL_CREATEDBY, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -1043,12 +1104,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -1077,9 +1138,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -1090,17 +1151,113 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\EventType object * * @param \TechWilk\Rota\EventType|ObjectCollection $eventType The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventType($eventType, $comparison = null) + public function filterByEventType($eventType, ?string $comparison = null) { if ($eventType instanceof \TechWilk\Rota\EventType) { return $this @@ -1110,8 +1267,10 @@ public function filterByEventType($eventType, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventTableMap::COL_TYPE, $eventType->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEventType() only accepts arguments of type \TechWilk\Rota\EventType or Collection'); } @@ -1120,12 +1279,12 @@ public function filterByEventType($eventType, $comparison = null) /** * Adds a JOIN clause to the query using the EventType relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventType($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEventType(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventType'); @@ -1154,9 +1313,9 @@ public function joinEventType($relationAlias = null, $joinType = Criteria::INNER * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventTypeQuery A secondary query class using the current class as primary query */ @@ -1167,17 +1326,113 @@ public function useEventTypeQuery($relationAlias = null, $joinType = Criteria::I ->useQuery($relationAlias ? $relationAlias : 'EventType', '\TechWilk\Rota\EventTypeQuery'); } + /** + * Use the EventType relation EventType object + * + * @param callable(\TechWilk\Rota\EventTypeQuery):\TechWilk\Rota\EventTypeQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventTypeQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventTypeQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventType table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the EXISTS statement + */ + public function useEventTypeExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useExistsQuery('EventType', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventType table for a NOT EXISTS query. + * + * @see useEventTypeExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the NOT EXISTS statement + */ + public function useEventTypeNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useExistsQuery('EventType', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventType table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the IN statement + */ + public function useInEventTypeQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useInQuery('EventType', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventType table for a NOT IN query. + * + * @see useEventTypeInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the NOT IN statement + */ + public function useNotInEventTypeQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useInQuery('EventType', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\EventSubType object * * @param \TechWilk\Rota\EventSubType|ObjectCollection $eventSubType The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventSubType($eventSubType, $comparison = null) + public function filterByEventSubType($eventSubType, ?string $comparison = null) { if ($eventSubType instanceof \TechWilk\Rota\EventSubType) { return $this @@ -1187,8 +1442,10 @@ public function filterByEventSubType($eventSubType, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventTableMap::COL_SUBTYPE, $eventSubType->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEventSubType() only accepts arguments of type \TechWilk\Rota\EventSubType or Collection'); } @@ -1197,12 +1454,12 @@ public function filterByEventSubType($eventSubType, $comparison = null) /** * Adds a JOIN clause to the query using the EventSubType relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventSubType($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEventSubType(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventSubType'); @@ -1231,9 +1488,9 @@ public function joinEventSubType($relationAlias = null, $joinType = Criteria::IN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventSubTypeQuery A secondary query class using the current class as primary query */ @@ -1244,17 +1501,113 @@ public function useEventSubTypeQuery($relationAlias = null, $joinType = Criteria ->useQuery($relationAlias ? $relationAlias : 'EventSubType', '\TechWilk\Rota\EventSubTypeQuery'); } + /** + * Use the EventSubType relation EventSubType object + * + * @param callable(\TechWilk\Rota\EventSubTypeQuery):\TechWilk\Rota\EventSubTypeQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventSubTypeQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventSubTypeQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventSubType table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventSubTypeQuery The inner query object of the EXISTS statement + */ + public function useEventSubTypeExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventSubTypeQuery */ + $q = $this->useExistsQuery('EventSubType', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventSubType table for a NOT EXISTS query. + * + * @see useEventSubTypeExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventSubTypeQuery The inner query object of the NOT EXISTS statement + */ + public function useEventSubTypeNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventSubTypeQuery */ + $q = $this->useExistsQuery('EventSubType', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventSubType table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventSubTypeQuery The inner query object of the IN statement + */ + public function useInEventSubTypeQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventSubTypeQuery */ + $q = $this->useInQuery('EventSubType', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventSubType table for a NOT IN query. + * + * @see useEventSubTypeInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventSubTypeQuery The inner query object of the NOT IN statement + */ + public function useNotInEventSubTypeQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventSubTypeQuery */ + $q = $this->useInQuery('EventSubType', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Location object * * @param \TechWilk\Rota\Location|ObjectCollection $location The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLocation($location, $comparison = null) + public function filterByLocation($location, ?string $comparison = null) { if ($location instanceof \TechWilk\Rota\Location) { return $this @@ -1264,8 +1617,10 @@ public function filterByLocation($location, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventTableMap::COL_LOCATION, $location->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByLocation() only accepts arguments of type \TechWilk\Rota\Location or Collection'); } @@ -1274,12 +1629,12 @@ public function filterByLocation($location, $comparison = null) /** * Adds a JOIN clause to the query using the Location relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinLocation($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinLocation(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Location'); @@ -1308,9 +1663,9 @@ public function joinLocation($relationAlias = null, $joinType = Criteria::INNER_ * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\LocationQuery A secondary query class using the current class as primary query */ @@ -1321,17 +1676,113 @@ public function useLocationQuery($relationAlias = null, $joinType = Criteria::IN ->useQuery($relationAlias ? $relationAlias : 'Location', '\TechWilk\Rota\LocationQuery'); } + /** + * Use the Location relation Location object + * + * @param callable(\TechWilk\Rota\LocationQuery):\TechWilk\Rota\LocationQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withLocationQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useLocationQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Location table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the EXISTS statement + */ + public function useLocationExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useExistsQuery('Location', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Location table for a NOT EXISTS query. + * + * @see useLocationExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the NOT EXISTS statement + */ + public function useLocationNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useExistsQuery('Location', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Location table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the IN statement + */ + public function useInLocationQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useInQuery('Location', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Location table for a NOT IN query. + * + * @see useLocationInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the NOT IN statement + */ + public function useNotInLocationQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useInQuery('Location', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\EventGroup object * * @param \TechWilk\Rota\EventGroup|ObjectCollection $eventGroup The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventGroup($eventGroup, $comparison = null) + public function filterByEventGroup($eventGroup, ?string $comparison = null) { if ($eventGroup instanceof \TechWilk\Rota\EventGroup) { return $this @@ -1341,8 +1792,10 @@ public function filterByEventGroup($eventGroup, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventTableMap::COL_EVENTGROUP, $eventGroup->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEventGroup() only accepts arguments of type \TechWilk\Rota\EventGroup or Collection'); } @@ -1351,12 +1804,12 @@ public function filterByEventGroup($eventGroup, $comparison = null) /** * Adds a JOIN clause to the query using the EventGroup relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinEventGroup(?string $relationAlias = null, ?string $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventGroup'); @@ -1385,9 +1838,9 @@ public function joinEventGroup($relationAlias = null, $joinType = Criteria::LEFT * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventGroupQuery A secondary query class using the current class as primary query */ @@ -1398,24 +1851,124 @@ public function useEventGroupQuery($relationAlias = null, $joinType = Criteria:: ->useQuery($relationAlias ? $relationAlias : 'EventGroup', '\TechWilk\Rota\EventGroupQuery'); } + /** + * Use the EventGroup relation EventGroup object + * + * @param callable(\TechWilk\Rota\EventGroupQuery):\TechWilk\Rota\EventGroupQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventGroupQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::LEFT_JOIN + ) { + $relatedQuery = $this->useEventGroupQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventGroup table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventGroupQuery The inner query object of the EXISTS statement + */ + public function useEventGroupExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventGroupQuery */ + $q = $this->useExistsQuery('EventGroup', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventGroup table for a NOT EXISTS query. + * + * @see useEventGroupExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventGroupQuery The inner query object of the NOT EXISTS statement + */ + public function useEventGroupNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventGroupQuery */ + $q = $this->useExistsQuery('EventGroup', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventGroup table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventGroupQuery The inner query object of the IN statement + */ + public function useInEventGroupQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventGroupQuery */ + $q = $this->useInQuery('EventGroup', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventGroup table for a NOT IN query. + * + * @see useEventGroupInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventGroupQuery The inner query object of the NOT IN statement + */ + public function useNotInEventGroupQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventGroupQuery */ + $q = $this->useInQuery('EventGroup', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Comment object * * @param \TechWilk\Rota\Comment|ObjectCollection $comment the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByComment($comment, $comparison = null) + public function filterByComment($comment, ?string $comparison = null) { if ($comment instanceof \TechWilk\Rota\Comment) { - return $this + $this ->addUsingAlias(EventTableMap::COL_ID, $comment->getEventId(), $comparison); + + return $this; } elseif ($comment instanceof ObjectCollection) { - return $this + $this ->useCommentQuery() ->filterByPrimaryKeys($comment->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByComment() only accepts arguments of type \TechWilk\Rota\Comment or Collection'); } @@ -1424,12 +1977,12 @@ public function filterByComment($comment, $comparison = null) /** * Adds a JOIN clause to the query using the Comment relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinComment($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinComment(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Comment'); @@ -1458,9 +2011,9 @@ public function joinComment($relationAlias = null, $joinType = Criteria::INNER_J * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\CommentQuery A secondary query class using the current class as primary query */ @@ -1471,24 +2024,124 @@ public function useCommentQuery($relationAlias = null, $joinType = Criteria::INN ->useQuery($relationAlias ? $relationAlias : 'Comment', '\TechWilk\Rota\CommentQuery'); } + /** + * Use the Comment relation Comment object + * + * @param callable(\TechWilk\Rota\CommentQuery):\TechWilk\Rota\CommentQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withCommentQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useCommentQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Comment table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the EXISTS statement + */ + public function useCommentExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useExistsQuery('Comment', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Comment table for a NOT EXISTS query. + * + * @see useCommentExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the NOT EXISTS statement + */ + public function useCommentNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useExistsQuery('Comment', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Comment table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the IN statement + */ + public function useInCommentQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useInQuery('Comment', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Comment table for a NOT IN query. + * + * @see useCommentInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the NOT IN statement + */ + public function useNotInCommentQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useInQuery('Comment', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\EventPerson object * * @param \TechWilk\Rota\EventPerson|ObjectCollection $eventPerson the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventPerson($eventPerson, $comparison = null) + public function filterByEventPerson($eventPerson, ?string $comparison = null) { if ($eventPerson instanceof \TechWilk\Rota\EventPerson) { - return $this + $this ->addUsingAlias(EventTableMap::COL_ID, $eventPerson->getEventId(), $comparison); + + return $this; } elseif ($eventPerson instanceof ObjectCollection) { - return $this + $this ->useEventPersonQuery() ->filterByPrimaryKeys($eventPerson->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEventPerson() only accepts arguments of type \TechWilk\Rota\EventPerson or Collection'); } @@ -1497,12 +2150,12 @@ public function filterByEventPerson($eventPerson, $comparison = null) /** * Adds a JOIN clause to the query using the EventPerson relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventPerson($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEventPerson(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventPerson'); @@ -1531,9 +2184,9 @@ public function joinEventPerson($relationAlias = null, $joinType = Criteria::INN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventPersonQuery A secondary query class using the current class as primary query */ @@ -1544,24 +2197,124 @@ public function useEventPersonQuery($relationAlias = null, $joinType = Criteria: ->useQuery($relationAlias ? $relationAlias : 'EventPerson', '\TechWilk\Rota\EventPersonQuery'); } + /** + * Use the EventPerson relation EventPerson object + * + * @param callable(\TechWilk\Rota\EventPersonQuery):\TechWilk\Rota\EventPersonQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventPersonQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventPersonQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventPerson table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the EXISTS statement + */ + public function useEventPersonExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useExistsQuery('EventPerson', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventPerson table for a NOT EXISTS query. + * + * @see useEventPersonExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the NOT EXISTS statement + */ + public function useEventPersonNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useExistsQuery('EventPerson', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventPerson table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the IN statement + */ + public function useInEventPersonQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useInQuery('EventPerson', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventPerson table for a NOT IN query. + * + * @see useEventPersonInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the NOT IN statement + */ + public function useNotInEventPersonQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useInQuery('EventPerson', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Availability object * * @param \TechWilk\Rota\Availability|ObjectCollection $availability the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAvailability($availability, $comparison = null) + public function filterByAvailability($availability, ?string $comparison = null) { if ($availability instanceof \TechWilk\Rota\Availability) { - return $this + $this ->addUsingAlias(EventTableMap::COL_ID, $availability->getEventId(), $comparison); + + return $this; } elseif ($availability instanceof ObjectCollection) { - return $this + $this ->useAvailabilityQuery() ->filterByPrimaryKeys($availability->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByAvailability() only accepts arguments of type \TechWilk\Rota\Availability or Collection'); } @@ -1570,12 +2323,12 @@ public function filterByAvailability($availability, $comparison = null) /** * Adds a JOIN clause to the query using the Availability relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinAvailability($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinAvailability(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Availability'); @@ -1604,9 +2357,9 @@ public function joinAvailability($relationAlias = null, $joinType = Criteria::IN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\AvailabilityQuery A secondary query class using the current class as primary query */ @@ -1617,12 +2370,108 @@ public function useAvailabilityQuery($relationAlias = null, $joinType = Criteria ->useQuery($relationAlias ? $relationAlias : 'Availability', '\TechWilk\Rota\AvailabilityQuery'); } + /** + * Use the Availability relation Availability object + * + * @param callable(\TechWilk\Rota\AvailabilityQuery):\TechWilk\Rota\AvailabilityQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withAvailabilityQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useAvailabilityQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Availability table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the EXISTS statement + */ + public function useAvailabilityExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useExistsQuery('Availability', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Availability table for a NOT EXISTS query. + * + * @see useAvailabilityExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the NOT EXISTS statement + */ + public function useAvailabilityNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useExistsQuery('Availability', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Availability table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the IN statement + */ + public function useInAvailabilityQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useInQuery('Availability', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Availability table for a NOT IN query. + * + * @see useAvailabilityInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the NOT IN statement + */ + public function useNotInAvailabilityQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useInQuery('Availability', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildEvent $event Object to remove from the list of results + * @param ChildEvent $event Object to remove from the list of results * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($event = null) { @@ -1639,7 +2488,7 @@ public function prune($event = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventTableMap::DATABASE_NAME); @@ -1664,12 +2513,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventTableMap::DATABASE_NAME); @@ -1699,64 +2548,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(EventTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(EventTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(EventTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(EventTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(EventTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(EventTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(EventTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(EventTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(EventTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(EventTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildEventQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(EventTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(EventTableMap::COL_CREATED); + + return $this; } -} // EventQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/EventSubType.php b/generated-classes/TechWilk/Rota/Base/EventSubType.php index 832d287f..2be8ee1b 100644 --- a/generated-classes/TechWilk/Rota/Base/EventSubType.php +++ b/generated-classes/TechWilk/Rota/Base/EventSubType.php @@ -34,19 +34,21 @@ abstract class EventSubType implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -55,14 +57,14 @@ abstract class EventSubType implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -88,6 +90,7 @@ abstract class EventSubType implements ActiveRecordInterface /** * @var ObjectCollection|ChildEvent[] Collection to store aggregation of ChildEvent objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEvent objects. */ protected $collEvents; protected $collEventsPartial; @@ -96,13 +99,14 @@ abstract class EventSubType implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEvent[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventsScheduledForDeletion = null; @@ -112,7 +116,7 @@ abstract class EventSubType implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->name = ''; } @@ -129,9 +133,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -139,10 +143,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -151,7 +155,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -161,9 +165,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -172,45 +176,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -219,10 +221,10 @@ public function resetModified($col = null) * obj is an instance of EventSubType, delegates to * equals(EventSubType). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -244,7 +246,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -252,10 +254,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -263,15 +265,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -280,12 +282,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|EventSubType The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -295,13 +297,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -312,24 +314,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -337,7 +342,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -377,8 +382,8 @@ public function getDescription() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventSubType The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -392,13 +397,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\EventSubType The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -412,13 +417,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\EventSubType The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -432,7 +437,7 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Indicates whether the columns in this object are only set to default values. @@ -440,17 +445,17 @@ public function setDescription($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->name !== '') { - return false; - } + if ($this->name !== '') { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -460,19 +465,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : EventSubTypeTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -481,8 +487,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : EventSubTypeTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; $this->description = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -490,6 +496,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 3; // 3 = EventSubTypeTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\EventSubType'), 0, $e); } @@ -506,23 +513,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -550,19 +558,20 @@ public function reload($deep = false, ConnectionInterface $con = null) if ($deep) { // also de-associate any related objects? $this->collEvents = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see EventSubType::setDeleted() * @see EventSubType::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -592,12 +601,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -642,12 +651,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -682,22 +691,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[EventSubTypeTableMap::COL_ID] = true; @@ -728,12 +738,15 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; } } @@ -756,12 +769,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -772,14 +785,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = EventSubTypeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -791,24 +804,23 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getDescription(); - break; + default: return null; - break; } // switch() } @@ -818,27 +830,27 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['EventSubType'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['EventSubType'][$this->hashCode()] = true; $keys = EventSubTypeTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getDescription(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -846,6 +858,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collEvents) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'events'; @@ -867,30 +880,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\EventSubType + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = EventSubTypeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\EventSubType + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -920,11 +935,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = EventSubTypeTableMap::getFieldNames($keyType); @@ -937,6 +952,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[2], $arr)) { $this->setDescription($arr[$keys[2]]); } + + return $this; } /** @@ -956,9 +973,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\EventSubType The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -972,9 +989,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(EventSubTypeTableMap::DATABASE_NAME); @@ -995,13 +1012,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildEventSubTypeQuery::create(); $criteria->add(EventSubTypeTableMap::COL_ID, $this->id); @@ -1013,7 +1030,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1043,19 +1060,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1066,12 +1084,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\EventSubType (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\EventSubType (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setDescription($this->getDescription()); @@ -1086,11 +1105,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addEvent($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1102,11 +1122,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\EventSubType Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1122,12 +1142,12 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('Event' == $relationName) { + if ('Event' === $relationName) { $this->initEvents(); return; } @@ -1139,18 +1159,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEvents() + * @return $this + * @see addEvents() */ public function clearEvents() { $this->collEvents = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEvents collection loaded partially. + * + * @return void */ - public function resetPartialEvents($v = true) + public function resetPartialEvents($v = true): void { $this->collEventsPartial = $v; } @@ -1162,12 +1186,12 @@ public function resetPartialEvents($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEvents($overrideExisting = true) + public function initEvents(bool $overrideExisting = true): void { if (null !== $this->collEvents && !$overrideExisting) { return; @@ -1188,18 +1212,28 @@ public function initEvents($overrideExisting = true) * If this ChildEventSubType is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEvent[] List of ChildEvent objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvents(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEvents(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventsPartial && !$this->isNew(); - if (null === $this->collEvents || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEvents) { + if (null === $this->collEvents || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEvents(); + if (null === $this->collEvents) { + $this->initEvents(); + } else { + $collectionClassName = EventTableMap::getTableMap()->getCollectionClassName(); + + $collEvents = new $collectionClassName; + $collEvents->setModel('\TechWilk\Rota\Event'); + + return $collEvents; + } } else { $collEvents = ChildEventQuery::create(null, $criteria) ->filterByEventSubType($this) @@ -1243,11 +1277,11 @@ public function getEvents(Criteria $criteria = null, ConnectionInterface $con = * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $events A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEventSubType The current object (for fluent API support) + * @param Collection $events A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEvents(Collection $events, ConnectionInterface $con = null) + public function setEvents(Collection $events, ?ConnectionInterface $con = null) { /** @var ChildEvent[] $eventsToDelete */ $eventsToDelete = $this->getEvents(new Criteria(), $con)->diff($events); @@ -1273,13 +1307,13 @@ public function setEvents(Collection $events, ConnectionInterface $con = null) /** * Returns the number of related Event objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Event objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Event objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEvents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEvents(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventsPartial && !$this->isNew(); if (null === $this->collEvents || null !== $criteria || $partial) { @@ -1308,8 +1342,8 @@ public function countEvents(Criteria $criteria = null, $distinct = false, Connec * Method called to associate a ChildEvent object to this object * through the ChildEvent foreign key attribute. * - * @param ChildEvent $l ChildEvent - * @return $this|\TechWilk\Rota\EventSubType The current object (for fluent API support) + * @param ChildEvent $l ChildEvent + * @return $this The current object (for fluent API support) */ public function addEvent(ChildEvent $l) { @@ -1332,15 +1366,15 @@ public function addEvent(ChildEvent $l) /** * @param ChildEvent $event The ChildEvent object to add. */ - protected function doAddEvent(ChildEvent $event) + protected function doAddEvent(ChildEvent $event): void { $this->collEvents[]= $event; $event->setEventSubType($this); } /** - * @param ChildEvent $event The ChildEvent object to remove. - * @return $this|ChildEventSubType The current object (for fluent API support) + * @param ChildEvent $event The ChildEvent object to remove. + * @return $this The current object (for fluent API support) */ public function removeEvent(ChildEvent $event) { @@ -1370,12 +1404,13 @@ public function removeEvent(ChildEvent $event) * api reasonable. You can provide public methods for those you * actually need in EventSubType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1395,12 +1430,13 @@ public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface * api reasonable. You can provide public methods for those you * actually need in EventSubType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventType', $joinBehavior); @@ -1420,12 +1456,13 @@ public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInte * api reasonable. You can provide public methods for those you * actually need in EventSubType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinLocation(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('Location', $joinBehavior); @@ -1445,12 +1482,13 @@ public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInter * api reasonable. You can provide public methods for those you * actually need in EventSubType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventGroup(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventGroup', $joinBehavior); @@ -1462,6 +1500,8 @@ public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInt * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1474,6 +1514,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1482,9 +1524,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collEvents) { @@ -1495,6 +1538,7 @@ public function clearAllReferences($deep = false) } // if ($deep) $this->collEvents = null; + return $this; } /** @@ -1509,99 +1553,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1611,7 +1635,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1631,17 +1655,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/EventSubTypeQuery.php b/generated-classes/TechWilk/Rota/Base/EventSubTypeQuery.php index 87141882..94066ee1 100644 --- a/generated-classes/TechWilk/Rota/Base/EventSubTypeQuery.php +++ b/generated-classes/TechWilk/Rota/Base/EventSubTypeQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\EventSubTypeTableMap; /** - * Base class that represents a query for the 'eventSubTypes' table. - * - * + * Base class that represents a query for the `eventSubTypes` table. * * @method ChildEventSubTypeQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildEventSubTypeQuery orderByName($order = Criteria::ASC) Order by the name column @@ -48,26 +47,32 @@ * * @method \TechWilk\Rota\EventQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildEventSubType findOne(ConnectionInterface $con = null) Return the first ChildEventSubType matching the query - * @method ChildEventSubType findOneOrCreate(ConnectionInterface $con = null) Return the first ChildEventSubType matching the query, or a new ChildEventSubType object populated from the query conditions when no match is found + * @method ChildEventSubType|null findOne(?ConnectionInterface $con = null) Return the first ChildEventSubType matching the query + * @method ChildEventSubType findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildEventSubType matching the query, or a new ChildEventSubType object populated from the query conditions when no match is found * - * @method ChildEventSubType findOneById(int $id) Return the first ChildEventSubType filtered by the id column - * @method ChildEventSubType findOneByName(string $name) Return the first ChildEventSubType filtered by the name column - * @method ChildEventSubType findOneByDescription(string $description) Return the first ChildEventSubType filtered by the description column * - - * @method ChildEventSubType requirePk($key, ConnectionInterface $con = null) Return the ChildEventSubType by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildEventSubType requireOne(ConnectionInterface $con = null) Return the first ChildEventSubType matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventSubType|null findOneById(int $id) Return the first ChildEventSubType filtered by the id column + * @method ChildEventSubType|null findOneByName(string $name) Return the first ChildEventSubType filtered by the name column + * @method ChildEventSubType|null findOneByDescription(string $description) Return the first ChildEventSubType filtered by the description column + * + * @method ChildEventSubType requirePk($key, ?ConnectionInterface $con = null) Return the ChildEventSubType by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventSubType requireOne(?ConnectionInterface $con = null) Return the first ChildEventSubType matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildEventSubType requireOneById(int $id) Return the first ChildEventSubType filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventSubType requireOneByName(string $name) Return the first ChildEventSubType filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventSubType requireOneByDescription(string $description) Return the first ChildEventSubType filtered by the description column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildEventSubType[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildEventSubType objects based on current ModelCriteria - * @method ChildEventSubType[]|ObjectCollection findById(int $id) Return ChildEventSubType objects filtered by the id column - * @method ChildEventSubType[]|ObjectCollection findByName(string $name) Return ChildEventSubType objects filtered by the name column - * @method ChildEventSubType[]|ObjectCollection findByDescription(string $description) Return ChildEventSubType objects filtered by the description column - * @method ChildEventSubType[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildEventSubType[]|Collection find(?ConnectionInterface $con = null) Return ChildEventSubType objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildEventSubType objects based on current ModelCriteria + * + * @method ChildEventSubType[]|Collection findById(int|array $id) Return ChildEventSubType objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildEventSubType objects filtered by the id column + * @method ChildEventSubType[]|Collection findByName(string|array $name) Return ChildEventSubType objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildEventSubType objects filtered by the name column + * @method ChildEventSubType[]|Collection findByDescription(string|array $description) Return ChildEventSubType objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildEventSubType objects filtered by the description column * + * @method ChildEventSubType[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class EventSubTypeQuery extends ModelCriteria { @@ -76,9 +81,9 @@ abstract class EventSubTypeQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\EventSubTypeQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\EventSubType', $modelAlias = null) { @@ -88,12 +93,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildEventSubTypeQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildEventSubTypeQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildEventSubTypeQuery) { return $criteria; @@ -123,7 +128,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildEventSubType|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -155,8 +160,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -188,8 +193,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildEventSubType|array|mixed the result, formatted by the current formatter */ @@ -209,12 +214,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -231,25 +236,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(EventSubTypeTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(EventSubTypeTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(EventSubTypeTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(EventSubTypeTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -262,15 +273,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -290,7 +301,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(EventSubTypeTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(EventSubTypeTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -300,14 +313,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -315,7 +329,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(EventSubTypeTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(EventSubTypeTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -325,14 +341,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -340,27 +357,33 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(EventSubTypeTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(EventSubTypeTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { - return $this + $this ->addUsingAlias(EventSubTypeTableMap::COL_ID, $event->getEventSubTypeId(), $comparison); + + return $this; } elseif ($event instanceof ObjectCollection) { - return $this + $this ->useEventQuery() ->filterByPrimaryKeys($event->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -369,12 +392,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -403,9 +426,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -416,12 +439,108 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildEventSubType $eventSubType Object to remove from the list of results + * @param ChildEventSubType $eventSubType Object to remove from the list of results * - * @return $this|ChildEventSubTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($eventSubType = null) { @@ -438,7 +557,7 @@ public function prune($eventSubType = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventSubTypeTableMap::DATABASE_NAME); @@ -463,12 +582,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventSubTypeTableMap::DATABASE_NAME); @@ -492,4 +611,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // EventSubTypeQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/EventType.php b/generated-classes/TechWilk/Rota/Base/EventType.php index 1e6ed34a..75f53126 100644 --- a/generated-classes/TechWilk/Rota/Base/EventType.php +++ b/generated-classes/TechWilk/Rota/Base/EventType.php @@ -38,19 +38,21 @@ abstract class EventType implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventTypeTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\EventTypeTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -59,14 +61,14 @@ abstract class EventType implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -92,28 +94,28 @@ abstract class EventType implements ActiveRecordInterface /** * The value for the defaultday field. * - * @var int + * @var int|null */ protected $defaultday; /** * The value for the defaulttime field. * - * @var DateTime + * @var DateTime|null */ protected $defaulttime; /** * The value for the defaultrepitition field. * - * @var int + * @var int|null */ protected $defaultrepitition; /** * The value for the defaultlocationid field. * - * @var int + * @var int|null */ protected $defaultlocationid; @@ -140,6 +142,7 @@ abstract class EventType implements ActiveRecordInterface /** * @var ObjectCollection|ChildEvent[] Collection to store aggregation of ChildEvent objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEvent objects. */ protected $collEvents; protected $collEventsPartial; @@ -148,13 +151,14 @@ abstract class EventType implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEvent[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventsScheduledForDeletion = null; @@ -164,7 +168,7 @@ abstract class EventType implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->rehearsal = 0; $this->groupformat = 0; @@ -182,9 +186,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -192,10 +196,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -204,7 +208,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -214,9 +218,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -225,45 +229,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -272,10 +274,10 @@ public function resetModified($col = null) * obj is an instance of EventType, delegates to * equals(EventType). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -297,7 +299,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -305,10 +307,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -316,15 +318,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -333,12 +335,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|EventType The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -348,13 +350,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -365,24 +367,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -390,7 +395,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -430,7 +435,7 @@ public function getDescription() /** * Get the [defaultday] column value. * - * @return int + * @return int|null */ public function getDefaultDay() { @@ -441,12 +446,14 @@ public function getDefaultDay() * Get the [optionally formatted] temporal [defaulttime] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getDefaultTime($format = null) { @@ -460,7 +467,7 @@ public function getDefaultTime($format = null) /** * Get the [defaultrepitition] column value. * - * @return int + * @return int|null */ public function getDefaultRepitition() { @@ -470,7 +477,7 @@ public function getDefaultRepitition() /** * Get the [defaultlocationid] column value. * - * @return int + * @return int|null */ public function getDefaultLocationId() { @@ -500,8 +507,8 @@ public function getGroupFormat() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -515,13 +522,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -535,13 +542,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -555,13 +562,13 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Set the value of [defaultday] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setDefaultDay($v) { @@ -575,14 +582,14 @@ public function setDefaultDay($v) } return $this; - } // setDefaultDay() + } /** * Sets the value of [defaulttime] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setDefaultTime($v) { @@ -595,13 +602,13 @@ public function setDefaultTime($v) } // if either are not null return $this; - } // setDefaultTime() + } /** * Set the value of [defaultrepitition] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setDefaultRepitition($v) { @@ -615,13 +622,13 @@ public function setDefaultRepitition($v) } return $this; - } // setDefaultRepitition() + } /** * Set the value of [defaultlocationid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setDefaultLocationId($v) { @@ -639,13 +646,13 @@ public function setDefaultLocationId($v) } return $this; - } // setDefaultLocationId() + } /** * Set the value of [rehearsal] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setRehearsal($v) { @@ -659,13 +666,13 @@ public function setRehearsal($v) } return $this; - } // setRehearsal() + } /** * Set the value of [groupformat] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setGroupFormat($v) { @@ -679,7 +686,7 @@ public function setGroupFormat($v) } return $this; - } // setGroupFormat() + } /** * Indicates whether the columns in this object are only set to default values. @@ -687,21 +694,21 @@ public function setGroupFormat($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->rehearsal !== 0) { - return false; - } + if ($this->rehearsal !== 0) { + return false; + } - if ($this->groupformat !== 0) { - return false; - } + if ($this->groupformat !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -711,19 +718,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : EventTypeTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -750,8 +758,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : EventTypeTableMap::translateFieldName('GroupFormat', TableMap::TYPE_PHPNAME, $indexType)]; $this->groupformat = (null !== $col) ? (int) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -759,6 +767,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 9; // 9 = EventTypeTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\EventType'), 0, $e); } @@ -775,26 +784,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aLocation !== null && $this->defaultlocationid !== $this->aLocation->getId()) { $this->aLocation = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -823,19 +833,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->aLocation = null; $this->collEvents = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see EventType::setDeleted() * @see EventType::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -865,12 +876,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -915,12 +926,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -967,22 +978,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[EventTypeTableMap::COL_ID] = true; @@ -1031,30 +1043,39 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'defaultDay': $stmt->bindValue($identifier, $this->defaultday, PDO::PARAM_INT); + break; case 'defaultTime': - $stmt->bindValue($identifier, $this->defaulttime ? $this->defaulttime->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + $stmt->bindValue($identifier, $this->defaulttime ? $this->defaulttime->format("H:i:s.u") : null, PDO::PARAM_STR); + break; case 'defaultRepitition': $stmt->bindValue($identifier, $this->defaultrepitition, PDO::PARAM_INT); + break; case 'defaultLocationId': $stmt->bindValue($identifier, $this->defaultlocationid, PDO::PARAM_INT); + break; case 'rehearsal': $stmt->bindValue($identifier, $this->rehearsal, PDO::PARAM_INT); + break; case 'groupformat': $stmt->bindValue($identifier, $this->groupformat, PDO::PARAM_INT); + break; } } @@ -1077,12 +1098,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1093,14 +1114,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = EventTypeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1112,42 +1133,41 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getDescription(); - break; + case 3: return $this->getDefaultDay(); - break; + case 4: return $this->getDefaultTime(); - break; + case 5: return $this->getDefaultRepitition(); - break; + case 6: return $this->getDefaultLocationId(); - break; + case 7: return $this->getRehearsal(); - break; + case 8: return $this->getGroupFormat(); - break; + default: return null; - break; } // switch() } @@ -1157,23 +1177,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['EventType'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['EventType'][$this->hashCode()] = true; $keys = EventTypeTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getDescription(), @@ -1183,9 +1203,9 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[6] => $this->getDefaultLocationId(), $keys[7] => $this->getRehearsal(), $keys[8] => $this->getGroupFormat(), - ); + ]; if ($result[$keys[4]] instanceof \DateTimeInterface) { - $result[$keys[4]] = $result[$keys[4]]->format('c'); + $result[$keys[4]] = $result[$keys[4]]->format('H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1195,6 +1215,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aLocation) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'location'; @@ -1206,9 +1227,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Location'; } - $result[$key] = $this->aLocation->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aLocation->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collEvents) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'events'; @@ -1230,30 +1252,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\EventType + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = EventTypeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\EventType + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1301,11 +1325,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = EventTypeTableMap::getFieldNames($keyType); @@ -1336,6 +1360,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[8], $arr)) { $this->setGroupFormat($arr[$keys[8]]); } + + return $this; } /** @@ -1355,9 +1381,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\EventType The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1371,9 +1397,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(EventTypeTableMap::DATABASE_NAME); @@ -1412,13 +1438,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildEventTypeQuery::create(); $criteria->add(EventTypeTableMap::COL_ID, $this->id); @@ -1430,7 +1456,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1460,19 +1486,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1483,12 +1510,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\EventType (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\EventType (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setDescription($this->getDescription()); @@ -1509,11 +1537,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addEvent($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1525,11 +1554,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\EventType Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1542,14 +1571,14 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildLocation object. * - * @param ChildLocation $v - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) - * @throws PropelException + * @param ChildLocation|null $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setLocation(ChildLocation $v = null) { if ($v === null) { - $this->setDefaultLocationId(null); + $this->setDefaultLocationId(NULL); } else { $this->setDefaultLocationId($v->getId()); } @@ -1570,11 +1599,11 @@ public function setLocation(ChildLocation $v = null) /** * Get the associated ChildLocation object * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildLocation The associated ChildLocation object. - * @throws PropelException + * @param ConnectionInterface $con Optional Connection object. + * @return ChildLocation|null The associated ChildLocation object. + * @throws \Propel\Runtime\Exception\PropelException */ - public function getLocation(ConnectionInterface $con = null) + public function getLocation(?ConnectionInterface $con = null) { if ($this->aLocation === null && ($this->defaultlocationid != 0)) { $this->aLocation = ChildLocationQuery::create()->findPk($this->defaultlocationid, $con); @@ -1596,12 +1625,12 @@ public function getLocation(ConnectionInterface $con = null) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('Event' == $relationName) { + if ('Event' === $relationName) { $this->initEvents(); return; } @@ -1613,18 +1642,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEvents() + * @return $this + * @see addEvents() */ public function clearEvents() { $this->collEvents = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEvents collection loaded partially. + * + * @return void */ - public function resetPartialEvents($v = true) + public function resetPartialEvents($v = true): void { $this->collEventsPartial = $v; } @@ -1636,12 +1669,12 @@ public function resetPartialEvents($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEvents($overrideExisting = true) + public function initEvents(bool $overrideExisting = true): void { if (null !== $this->collEvents && !$overrideExisting) { return; @@ -1662,18 +1695,28 @@ public function initEvents($overrideExisting = true) * If this ChildEventType is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEvent[] List of ChildEvent objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvents(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEvents(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventsPartial && !$this->isNew(); - if (null === $this->collEvents || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEvents) { + if (null === $this->collEvents || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEvents(); + if (null === $this->collEvents) { + $this->initEvents(); + } else { + $collectionClassName = EventTableMap::getTableMap()->getCollectionClassName(); + + $collEvents = new $collectionClassName; + $collEvents->setModel('\TechWilk\Rota\Event'); + + return $collEvents; + } } else { $collEvents = ChildEventQuery::create(null, $criteria) ->filterByEventType($this) @@ -1717,11 +1760,11 @@ public function getEvents(Criteria $criteria = null, ConnectionInterface $con = * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $events A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildEventType The current object (for fluent API support) + * @param Collection $events A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEvents(Collection $events, ConnectionInterface $con = null) + public function setEvents(Collection $events, ?ConnectionInterface $con = null) { /** @var ChildEvent[] $eventsToDelete */ $eventsToDelete = $this->getEvents(new Criteria(), $con)->diff($events); @@ -1747,13 +1790,13 @@ public function setEvents(Collection $events, ConnectionInterface $con = null) /** * Returns the number of related Event objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Event objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Event objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEvents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEvents(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventsPartial && !$this->isNew(); if (null === $this->collEvents || null !== $criteria || $partial) { @@ -1782,8 +1825,8 @@ public function countEvents(Criteria $criteria = null, $distinct = false, Connec * Method called to associate a ChildEvent object to this object * through the ChildEvent foreign key attribute. * - * @param ChildEvent $l ChildEvent - * @return $this|\TechWilk\Rota\EventType The current object (for fluent API support) + * @param ChildEvent $l ChildEvent + * @return $this The current object (for fluent API support) */ public function addEvent(ChildEvent $l) { @@ -1806,15 +1849,15 @@ public function addEvent(ChildEvent $l) /** * @param ChildEvent $event The ChildEvent object to add. */ - protected function doAddEvent(ChildEvent $event) + protected function doAddEvent(ChildEvent $event): void { $this->collEvents[]= $event; $event->setEventType($this); } /** - * @param ChildEvent $event The ChildEvent object to remove. - * @return $this|ChildEventType The current object (for fluent API support) + * @param ChildEvent $event The ChildEvent object to remove. + * @return $this The current object (for fluent API support) */ public function removeEvent(ChildEvent $event) { @@ -1844,12 +1887,13 @@ public function removeEvent(ChildEvent $event) * api reasonable. You can provide public methods for those you * actually need in EventType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1869,12 +1913,13 @@ public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface * api reasonable. You can provide public methods for those you * actually need in EventType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventSubType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventSubType', $joinBehavior); @@ -1894,12 +1939,13 @@ public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionI * api reasonable. You can provide public methods for those you * actually need in EventType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinLocation(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('Location', $joinBehavior); @@ -1919,12 +1965,13 @@ public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInter * api reasonable. You can provide public methods for those you * actually need in EventType. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventGroup(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventGroup', $joinBehavior); @@ -1936,6 +1983,8 @@ public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInt * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1957,6 +2006,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1965,9 +2016,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collEvents) { @@ -1979,6 +2031,7 @@ public function clearAllReferences($deep = false) $this->collEvents = null; $this->aLocation = null; + return $this; } /** @@ -1993,99 +2046,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -2095,7 +2128,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -2115,17 +2148,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/EventTypeQuery.php b/generated-classes/TechWilk/Rota/Base/EventTypeQuery.php index 8ebc9914..42c57989 100644 --- a/generated-classes/TechWilk/Rota/Base/EventTypeQuery.php +++ b/generated-classes/TechWilk/Rota/Base/EventTypeQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\EventTypeTableMap; /** - * Base class that represents a query for the 'eventTypes' table. - * - * + * Base class that represents a query for the `eventTypes` table. * * @method ChildEventTypeQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildEventTypeQuery orderByName($order = Criteria::ASC) Order by the name column @@ -70,21 +69,21 @@ * * @method \TechWilk\Rota\LocationQuery|\TechWilk\Rota\EventQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildEventType findOne(ConnectionInterface $con = null) Return the first ChildEventType matching the query - * @method ChildEventType findOneOrCreate(ConnectionInterface $con = null) Return the first ChildEventType matching the query, or a new ChildEventType object populated from the query conditions when no match is found + * @method ChildEventType|null findOne(?ConnectionInterface $con = null) Return the first ChildEventType matching the query + * @method ChildEventType findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildEventType matching the query, or a new ChildEventType object populated from the query conditions when no match is found * - * @method ChildEventType findOneById(int $id) Return the first ChildEventType filtered by the id column - * @method ChildEventType findOneByName(string $name) Return the first ChildEventType filtered by the name column - * @method ChildEventType findOneByDescription(string $description) Return the first ChildEventType filtered by the description column - * @method ChildEventType findOneByDefaultDay(int $defaultDay) Return the first ChildEventType filtered by the defaultDay column - * @method ChildEventType findOneByDefaultTime(string $defaultTime) Return the first ChildEventType filtered by the defaultTime column - * @method ChildEventType findOneByDefaultRepitition(int $defaultRepitition) Return the first ChildEventType filtered by the defaultRepitition column - * @method ChildEventType findOneByDefaultLocationId(int $defaultLocationId) Return the first ChildEventType filtered by the defaultLocationId column - * @method ChildEventType findOneByRehearsal(int $rehearsal) Return the first ChildEventType filtered by the rehearsal column - * @method ChildEventType findOneByGroupFormat(int $groupformat) Return the first ChildEventType filtered by the groupformat column * - - * @method ChildEventType requirePk($key, ConnectionInterface $con = null) Return the ChildEventType by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildEventType requireOne(ConnectionInterface $con = null) Return the first ChildEventType matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventType|null findOneById(int $id) Return the first ChildEventType filtered by the id column + * @method ChildEventType|null findOneByName(string $name) Return the first ChildEventType filtered by the name column + * @method ChildEventType|null findOneByDescription(string $description) Return the first ChildEventType filtered by the description column + * @method ChildEventType|null findOneByDefaultDay(int $defaultDay) Return the first ChildEventType filtered by the defaultDay column + * @method ChildEventType|null findOneByDefaultTime(string $defaultTime) Return the first ChildEventType filtered by the defaultTime column + * @method ChildEventType|null findOneByDefaultRepitition(int $defaultRepitition) Return the first ChildEventType filtered by the defaultRepitition column + * @method ChildEventType|null findOneByDefaultLocationId(int $defaultLocationId) Return the first ChildEventType filtered by the defaultLocationId column + * @method ChildEventType|null findOneByRehearsal(int $rehearsal) Return the first ChildEventType filtered by the rehearsal column + * @method ChildEventType|null findOneByGroupFormat(int $groupformat) Return the first ChildEventType filtered by the groupformat column + * + * @method ChildEventType requirePk($key, ?ConnectionInterface $con = null) Return the ChildEventType by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildEventType requireOne(?ConnectionInterface $con = null) Return the first ChildEventType matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildEventType requireOneById(int $id) Return the first ChildEventType filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventType requireOneByName(string $name) Return the first ChildEventType filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -96,18 +95,30 @@ * @method ChildEventType requireOneByRehearsal(int $rehearsal) Return the first ChildEventType filtered by the rehearsal column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildEventType requireOneByGroupFormat(int $groupformat) Return the first ChildEventType filtered by the groupformat column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildEventType[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildEventType objects based on current ModelCriteria - * @method ChildEventType[]|ObjectCollection findById(int $id) Return ChildEventType objects filtered by the id column - * @method ChildEventType[]|ObjectCollection findByName(string $name) Return ChildEventType objects filtered by the name column - * @method ChildEventType[]|ObjectCollection findByDescription(string $description) Return ChildEventType objects filtered by the description column - * @method ChildEventType[]|ObjectCollection findByDefaultDay(int $defaultDay) Return ChildEventType objects filtered by the defaultDay column - * @method ChildEventType[]|ObjectCollection findByDefaultTime(string $defaultTime) Return ChildEventType objects filtered by the defaultTime column - * @method ChildEventType[]|ObjectCollection findByDefaultRepitition(int $defaultRepitition) Return ChildEventType objects filtered by the defaultRepitition column - * @method ChildEventType[]|ObjectCollection findByDefaultLocationId(int $defaultLocationId) Return ChildEventType objects filtered by the defaultLocationId column - * @method ChildEventType[]|ObjectCollection findByRehearsal(int $rehearsal) Return ChildEventType objects filtered by the rehearsal column - * @method ChildEventType[]|ObjectCollection findByGroupFormat(int $groupformat) Return ChildEventType objects filtered by the groupformat column - * @method ChildEventType[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildEventType[]|Collection find(?ConnectionInterface $con = null) Return ChildEventType objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildEventType objects based on current ModelCriteria + * + * @method ChildEventType[]|Collection findById(int|array $id) Return ChildEventType objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildEventType objects filtered by the id column + * @method ChildEventType[]|Collection findByName(string|array $name) Return ChildEventType objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildEventType objects filtered by the name column + * @method ChildEventType[]|Collection findByDescription(string|array $description) Return ChildEventType objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildEventType objects filtered by the description column + * @method ChildEventType[]|Collection findByDefaultDay(int|array $defaultDay) Return ChildEventType objects filtered by the defaultDay column + * @psalm-method Collection&\Traversable findByDefaultDay(int|array $defaultDay) Return ChildEventType objects filtered by the defaultDay column + * @method ChildEventType[]|Collection findByDefaultTime(string|array $defaultTime) Return ChildEventType objects filtered by the defaultTime column + * @psalm-method Collection&\Traversable findByDefaultTime(string|array $defaultTime) Return ChildEventType objects filtered by the defaultTime column + * @method ChildEventType[]|Collection findByDefaultRepitition(int|array $defaultRepitition) Return ChildEventType objects filtered by the defaultRepitition column + * @psalm-method Collection&\Traversable findByDefaultRepitition(int|array $defaultRepitition) Return ChildEventType objects filtered by the defaultRepitition column + * @method ChildEventType[]|Collection findByDefaultLocationId(int|array $defaultLocationId) Return ChildEventType objects filtered by the defaultLocationId column + * @psalm-method Collection&\Traversable findByDefaultLocationId(int|array $defaultLocationId) Return ChildEventType objects filtered by the defaultLocationId column + * @method ChildEventType[]|Collection findByRehearsal(int|array $rehearsal) Return ChildEventType objects filtered by the rehearsal column + * @psalm-method Collection&\Traversable findByRehearsal(int|array $rehearsal) Return ChildEventType objects filtered by the rehearsal column + * @method ChildEventType[]|Collection findByGroupFormat(int|array $groupformat) Return ChildEventType objects filtered by the groupformat column + * @psalm-method Collection&\Traversable findByGroupFormat(int|array $groupformat) Return ChildEventType objects filtered by the groupformat column * + * @method ChildEventType[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class EventTypeQuery extends ModelCriteria { @@ -116,9 +127,9 @@ abstract class EventTypeQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\EventTypeQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\EventType', $modelAlias = null) { @@ -128,12 +139,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildEventTypeQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildEventTypeQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildEventTypeQuery) { return $criteria; @@ -163,7 +174,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildEventType|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -195,8 +206,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -228,8 +239,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildEventType|array|mixed the result, formatted by the current formatter */ @@ -249,12 +260,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -271,25 +282,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(EventTypeTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(EventTypeTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(EventTypeTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(EventTypeTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -302,15 +319,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -330,7 +347,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -340,14 +359,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -355,7 +375,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -365,14 +387,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -380,7 +403,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -393,15 +418,15 @@ public function filterByDescription($description = null, $comparison = null) * $query->filterByDefaultDay(array('min' => 12)); // WHERE defaultDay > 12 * * - * @param mixed $defaultDay The value to use as filter. + * @param mixed $defaultDay The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDefaultDay($defaultDay = null, $comparison = null) + public function filterByDefaultDay($defaultDay = null, ?string $comparison = null) { if (is_array($defaultDay)) { $useMinMax = false; @@ -421,7 +446,9 @@ public function filterByDefaultDay($defaultDay = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTDAY, $defaultDay, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTDAY, $defaultDay, $comparison); + + return $this; } /** @@ -434,17 +461,17 @@ public function filterByDefaultDay($defaultDay = null, $comparison = null) * $query->filterByDefaultTime(array('max' => 'yesterday')); // WHERE defaultTime > '2011-03-13' * * - * @param mixed $defaultTime The value to use as filter. + * @param mixed $defaultTime The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDefaultTime($defaultTime = null, $comparison = null) + public function filterByDefaultTime($defaultTime = null, ?string $comparison = null) { if (is_array($defaultTime)) { $useMinMax = false; @@ -464,7 +491,9 @@ public function filterByDefaultTime($defaultTime = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTTIME, $defaultTime, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTTIME, $defaultTime, $comparison); + + return $this; } /** @@ -477,15 +506,15 @@ public function filterByDefaultTime($defaultTime = null, $comparison = null) * $query->filterByDefaultRepitition(array('min' => 12)); // WHERE defaultRepitition > 12 * * - * @param mixed $defaultRepitition The value to use as filter. + * @param mixed $defaultRepitition The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDefaultRepitition($defaultRepitition = null, $comparison = null) + public function filterByDefaultRepitition($defaultRepitition = null, ?string $comparison = null) { if (is_array($defaultRepitition)) { $useMinMax = false; @@ -505,7 +534,9 @@ public function filterByDefaultRepitition($defaultRepitition = null, $comparison } } - return $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTREPITITION, $defaultRepitition, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTREPITITION, $defaultRepitition, $comparison); + + return $this; } /** @@ -520,15 +551,15 @@ public function filterByDefaultRepitition($defaultRepitition = null, $comparison * * @see filterByLocation() * - * @param mixed $defaultLocationId The value to use as filter. + * @param mixed $defaultLocationId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDefaultLocationId($defaultLocationId = null, $comparison = null) + public function filterByDefaultLocationId($defaultLocationId = null, ?string $comparison = null) { if (is_array($defaultLocationId)) { $useMinMax = false; @@ -548,7 +579,9 @@ public function filterByDefaultLocationId($defaultLocationId = null, $comparison } } - return $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTLOCATIONID, $defaultLocationId, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_DEFAULTLOCATIONID, $defaultLocationId, $comparison); + + return $this; } /** @@ -561,15 +594,15 @@ public function filterByDefaultLocationId($defaultLocationId = null, $comparison * $query->filterByRehearsal(array('min' => 12)); // WHERE rehearsal > 12 * * - * @param mixed $rehearsal The value to use as filter. + * @param mixed $rehearsal The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRehearsal($rehearsal = null, $comparison = null) + public function filterByRehearsal($rehearsal = null, ?string $comparison = null) { if (is_array($rehearsal)) { $useMinMax = false; @@ -589,7 +622,9 @@ public function filterByRehearsal($rehearsal = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_REHEARSAL, $rehearsal, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_REHEARSAL, $rehearsal, $comparison); + + return $this; } /** @@ -602,15 +637,15 @@ public function filterByRehearsal($rehearsal = null, $comparison = null) * $query->filterByGroupFormat(array('min' => 12)); // WHERE groupformat > 12 * * - * @param mixed $groupFormat The value to use as filter. + * @param mixed $groupFormat The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByGroupFormat($groupFormat = null, $comparison = null) + public function filterByGroupFormat($groupFormat = null, ?string $comparison = null) { if (is_array($groupFormat)) { $useMinMax = false; @@ -630,20 +665,22 @@ public function filterByGroupFormat($groupFormat = null, $comparison = null) } } - return $this->addUsingAlias(EventTypeTableMap::COL_GROUPFORMAT, $groupFormat, $comparison); + $this->addUsingAlias(EventTypeTableMap::COL_GROUPFORMAT, $groupFormat, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Location object * * @param \TechWilk\Rota\Location|ObjectCollection $location The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLocation($location, $comparison = null) + public function filterByLocation($location, ?string $comparison = null) { if ($location instanceof \TechWilk\Rota\Location) { return $this @@ -653,8 +690,10 @@ public function filterByLocation($location, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(EventTypeTableMap::COL_DEFAULTLOCATIONID, $location->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByLocation() only accepts arguments of type \TechWilk\Rota\Location or Collection'); } @@ -663,12 +702,12 @@ public function filterByLocation($location, $comparison = null) /** * Adds a JOIN clause to the query using the Location relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinLocation($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinLocation(?string $relationAlias = null, ?string $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Location'); @@ -697,9 +736,9 @@ public function joinLocation($relationAlias = null, $joinType = Criteria::LEFT_J * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\LocationQuery A secondary query class using the current class as primary query */ @@ -710,24 +749,124 @@ public function useLocationQuery($relationAlias = null, $joinType = Criteria::LE ->useQuery($relationAlias ? $relationAlias : 'Location', '\TechWilk\Rota\LocationQuery'); } + /** + * Use the Location relation Location object + * + * @param callable(\TechWilk\Rota\LocationQuery):\TechWilk\Rota\LocationQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withLocationQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::LEFT_JOIN + ) { + $relatedQuery = $this->useLocationQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Location table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the EXISTS statement + */ + public function useLocationExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useExistsQuery('Location', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Location table for a NOT EXISTS query. + * + * @see useLocationExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the NOT EXISTS statement + */ + public function useLocationNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useExistsQuery('Location', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Location table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the IN statement + */ + public function useInLocationQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useInQuery('Location', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Location table for a NOT IN query. + * + * @see useLocationInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\LocationQuery The inner query object of the NOT IN statement + */ + public function useNotInLocationQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\LocationQuery */ + $q = $this->useInQuery('Location', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { - return $this + $this ->addUsingAlias(EventTypeTableMap::COL_ID, $event->getEventTypeId(), $comparison); + + return $this; } elseif ($event instanceof ObjectCollection) { - return $this + $this ->useEventQuery() ->filterByPrimaryKeys($event->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -736,12 +875,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -770,9 +909,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -783,12 +922,108 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildEventType $eventType Object to remove from the list of results + * @param ChildEventType $eventType Object to remove from the list of results * - * @return $this|ChildEventTypeQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($eventType = null) { @@ -805,7 +1040,7 @@ public function prune($eventType = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventTypeTableMap::DATABASE_NAME); @@ -830,12 +1065,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventTypeTableMap::DATABASE_NAME); @@ -859,4 +1094,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // EventTypeQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Group.php b/generated-classes/TechWilk/Rota/Base/Group.php index 4d1a49bb..4123a67c 100644 --- a/generated-classes/TechWilk/Rota/Base/Group.php +++ b/generated-classes/TechWilk/Rota/Base/Group.php @@ -34,19 +34,21 @@ abstract class Group implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\GroupTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\GroupTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -55,14 +57,14 @@ abstract class Group implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -98,7 +100,7 @@ abstract class Group implements ActiveRecordInterface /** * The value for the description field. * - * @var string + * @var string|null */ protected $description; @@ -112,6 +114,7 @@ abstract class Group implements ActiveRecordInterface /** * @var ObjectCollection|ChildRole[] Collection to store aggregation of ChildRole objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildRole objects. */ protected $collRoles; protected $collRolesPartial; @@ -120,13 +123,14 @@ abstract class Group implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildRole[] + * @phpstan-var ObjectCollection&\Traversable */ protected $rolesScheduledForDeletion = null; @@ -136,7 +140,7 @@ abstract class Group implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->name = ''; $this->rehearsal = 0; @@ -156,9 +160,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -166,10 +170,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -178,7 +182,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -188,9 +192,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -199,45 +203,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -246,10 +248,10 @@ public function resetModified($col = null) * obj is an instance of Group, delegates to * equals(Group). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -271,7 +273,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -279,10 +281,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -290,15 +292,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -307,12 +309,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Group The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -322,13 +324,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -339,24 +341,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -364,7 +369,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -414,7 +419,7 @@ public function getFormatGroup() /** * Get the [description] column value. * - * @return string + * @return string|null */ public function getDescription() { @@ -444,8 +449,8 @@ public function isAllowRoleSwaps() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -459,13 +464,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -479,13 +484,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [rehearsal] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setRehearsal($v) { @@ -499,13 +504,13 @@ public function setRehearsal($v) } return $this; - } // setRehearsal() + } /** * Set the value of [formatgroup] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setFormatGroup($v) { @@ -519,13 +524,13 @@ public function setFormatGroup($v) } return $this; - } // setFormatGroup() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -539,7 +544,7 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Sets the value of the [allowroleswaps] column. @@ -548,8 +553,8 @@ public function setDescription($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setAllowRoleSwaps($v) { @@ -567,7 +572,7 @@ public function setAllowRoleSwaps($v) } return $this; - } // setAllowRoleSwaps() + } /** * Indicates whether the columns in this object are only set to default values. @@ -575,29 +580,29 @@ public function setAllowRoleSwaps($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->name !== '') { - return false; - } + if ($this->name !== '') { + return false; + } - if ($this->rehearsal !== 0) { - return false; - } + if ($this->rehearsal !== 0) { + return false; + } - if ($this->formatgroup !== 0) { - return false; - } + if ($this->formatgroup !== 0) { + return false; + } - if ($this->allowroleswaps !== true) { - return false; - } + if ($this->allowroleswaps !== true) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -607,19 +612,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : GroupTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -637,8 +643,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : GroupTableMap::translateFieldName('AllowRoleSwaps', TableMap::TYPE_PHPNAME, $indexType)]; $this->allowroleswaps = (null !== $col) ? (boolean) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -646,6 +652,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 6; // 6 = GroupTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Group'), 0, $e); } @@ -662,23 +669,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -706,19 +714,20 @@ public function reload($deep = false, ConnectionInterface $con = null) if ($deep) { // also de-associate any related objects? $this->collRoles = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Group::setDeleted() * @see Group::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -748,12 +757,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -798,12 +807,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -838,22 +847,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[GroupTableMap::COL_ID] = true; @@ -893,21 +903,27 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'rehearsal': $stmt->bindValue($identifier, $this->rehearsal, PDO::PARAM_INT); + break; case 'formatgroup': $stmt->bindValue($identifier, $this->formatgroup, PDO::PARAM_INT); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'allowRoleSwaps': $stmt->bindValue($identifier, (int) $this->allowroleswaps, PDO::PARAM_INT); + break; } } @@ -930,12 +946,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -946,14 +962,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = GroupTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -965,33 +981,32 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getRehearsal(); - break; + case 3: return $this->getFormatGroup(); - break; + case 4: return $this->getDescription(); - break; + case 5: return $this->getAllowRoleSwaps(); - break; + default: return null; - break; } // switch() } @@ -1001,30 +1016,30 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Group'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Group'][$this->hashCode()] = true; $keys = GroupTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getRehearsal(), $keys[3] => $this->getFormatGroup(), $keys[4] => $this->getDescription(), $keys[5] => $this->getAllowRoleSwaps(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -1032,6 +1047,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collRoles) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'roles'; @@ -1053,30 +1069,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Group + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = GroupTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Group + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1115,11 +1133,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = GroupTableMap::getFieldNames($keyType); @@ -1141,6 +1159,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[5], $arr)) { $this->setAllowRoleSwaps($arr[$keys[5]]); } + + return $this; } /** @@ -1160,9 +1180,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Group The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1176,9 +1196,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(GroupTableMap::DATABASE_NAME); @@ -1208,13 +1228,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildGroupQuery::create(); $criteria->add(GroupTableMap::COL_ID, $this->id); @@ -1226,7 +1246,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1256,19 +1276,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1279,12 +1300,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Group (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Group (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setRehearsal($this->getRehearsal()); @@ -1302,11 +1324,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addRole($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1318,11 +1341,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Group Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1338,12 +1361,12 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('Role' == $relationName) { + if ('Role' === $relationName) { $this->initRoles(); return; } @@ -1355,18 +1378,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addRoles() + * @return $this + * @see addRoles() */ public function clearRoles() { $this->collRoles = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collRoles collection loaded partially. + * + * @return void */ - public function resetPartialRoles($v = true) + public function resetPartialRoles($v = true): void { $this->collRolesPartial = $v; } @@ -1378,12 +1405,12 @@ public function resetPartialRoles($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initRoles($overrideExisting = true) + public function initRoles(bool $overrideExisting = true): void { if (null !== $this->collRoles && !$overrideExisting) { return; @@ -1404,18 +1431,28 @@ public function initRoles($overrideExisting = true) * If this ChildGroup is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildRole[] List of ChildRole objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildRole objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getRoles(Criteria $criteria = null, ConnectionInterface $con = null) + public function getRoles(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collRolesPartial && !$this->isNew(); - if (null === $this->collRoles || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRoles) { + if (null === $this->collRoles || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initRoles(); + if (null === $this->collRoles) { + $this->initRoles(); + } else { + $collectionClassName = RoleTableMap::getTableMap()->getCollectionClassName(); + + $collRoles = new $collectionClassName; + $collRoles->setModel('\TechWilk\Rota\Role'); + + return $collRoles; + } } else { $collRoles = ChildRoleQuery::create(null, $criteria) ->filterByGroup($this) @@ -1459,11 +1496,11 @@ public function getRoles(Criteria $criteria = null, ConnectionInterface $con = n * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $roles A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildGroup The current object (for fluent API support) + * @param Collection $roles A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setRoles(Collection $roles, ConnectionInterface $con = null) + public function setRoles(Collection $roles, ?ConnectionInterface $con = null) { /** @var ChildRole[] $rolesToDelete */ $rolesToDelete = $this->getRoles(new Criteria(), $con)->diff($roles); @@ -1489,13 +1526,13 @@ public function setRoles(Collection $roles, ConnectionInterface $con = null) /** * Returns the number of related Role objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Role objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Role objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countRoles(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countRoles(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collRolesPartial && !$this->isNew(); if (null === $this->collRoles || null !== $criteria || $partial) { @@ -1524,8 +1561,8 @@ public function countRoles(Criteria $criteria = null, $distinct = false, Connect * Method called to associate a ChildRole object to this object * through the ChildRole foreign key attribute. * - * @param ChildRole $l ChildRole - * @return $this|\TechWilk\Rota\Group The current object (for fluent API support) + * @param ChildRole $l ChildRole + * @return $this The current object (for fluent API support) */ public function addRole(ChildRole $l) { @@ -1548,15 +1585,15 @@ public function addRole(ChildRole $l) /** * @param ChildRole $role The ChildRole object to add. */ - protected function doAddRole(ChildRole $role) + protected function doAddRole(ChildRole $role): void { $this->collRoles[]= $role; $role->setGroup($this); } /** - * @param ChildRole $role The ChildRole object to remove. - * @return $this|ChildGroup The current object (for fluent API support) + * @param ChildRole $role The ChildRole object to remove. + * @return $this The current object (for fluent API support) */ public function removeRole(ChildRole $role) { @@ -1578,6 +1615,8 @@ public function removeRole(ChildRole $role) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1593,6 +1632,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1601,9 +1642,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collRoles) { @@ -1614,6 +1656,7 @@ public function clearAllReferences($deep = false) } // if ($deep) $this->collRoles = null; + return $this; } /** @@ -1628,99 +1671,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1730,7 +1753,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1750,17 +1773,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/GroupQuery.php b/generated-classes/TechWilk/Rota/Base/GroupQuery.php index b47702a5..32d61b73 100644 --- a/generated-classes/TechWilk/Rota/Base/GroupQuery.php +++ b/generated-classes/TechWilk/Rota/Base/GroupQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\GroupTableMap; /** - * Base class that represents a query for the 'groups' table. - * - * + * Base class that represents a query for the `groups` table. * * @method ChildGroupQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildGroupQuery orderByName($order = Criteria::ASC) Order by the name column @@ -54,18 +53,18 @@ * * @method \TechWilk\Rota\RoleQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildGroup findOne(ConnectionInterface $con = null) Return the first ChildGroup matching the query - * @method ChildGroup findOneOrCreate(ConnectionInterface $con = null) Return the first ChildGroup matching the query, or a new ChildGroup object populated from the query conditions when no match is found + * @method ChildGroup|null findOne(?ConnectionInterface $con = null) Return the first ChildGroup matching the query + * @method ChildGroup findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildGroup matching the query, or a new ChildGroup object populated from the query conditions when no match is found + * + * @method ChildGroup|null findOneById(int $id) Return the first ChildGroup filtered by the id column + * @method ChildGroup|null findOneByName(string $name) Return the first ChildGroup filtered by the name column + * @method ChildGroup|null findOneByRehearsal(int $rehearsal) Return the first ChildGroup filtered by the rehearsal column + * @method ChildGroup|null findOneByFormatGroup(int $formatgroup) Return the first ChildGroup filtered by the formatgroup column + * @method ChildGroup|null findOneByDescription(string $description) Return the first ChildGroup filtered by the description column + * @method ChildGroup|null findOneByAllowRoleSwaps(boolean $allowRoleSwaps) Return the first ChildGroup filtered by the allowRoleSwaps column * - * @method ChildGroup findOneById(int $id) Return the first ChildGroup filtered by the id column - * @method ChildGroup findOneByName(string $name) Return the first ChildGroup filtered by the name column - * @method ChildGroup findOneByRehearsal(int $rehearsal) Return the first ChildGroup filtered by the rehearsal column - * @method ChildGroup findOneByFormatGroup(int $formatgroup) Return the first ChildGroup filtered by the formatgroup column - * @method ChildGroup findOneByDescription(string $description) Return the first ChildGroup filtered by the description column - * @method ChildGroup findOneByAllowRoleSwaps(boolean $allowRoleSwaps) Return the first ChildGroup filtered by the allowRoleSwaps column * - - * @method ChildGroup requirePk($key, ConnectionInterface $con = null) Return the ChildGroup by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildGroup requireOne(ConnectionInterface $con = null) Return the first ChildGroup matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildGroup requirePk($key, ?ConnectionInterface $con = null) Return the ChildGroup by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildGroup requireOne(?ConnectionInterface $con = null) Return the first ChildGroup matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildGroup requireOneById(int $id) Return the first ChildGroup filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildGroup requireOneByName(string $name) Return the first ChildGroup filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -74,15 +73,24 @@ * @method ChildGroup requireOneByDescription(string $description) Return the first ChildGroup filtered by the description column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildGroup requireOneByAllowRoleSwaps(boolean $allowRoleSwaps) Return the first ChildGroup filtered by the allowRoleSwaps column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildGroup[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildGroup objects based on current ModelCriteria - * @method ChildGroup[]|ObjectCollection findById(int $id) Return ChildGroup objects filtered by the id column - * @method ChildGroup[]|ObjectCollection findByName(string $name) Return ChildGroup objects filtered by the name column - * @method ChildGroup[]|ObjectCollection findByRehearsal(int $rehearsal) Return ChildGroup objects filtered by the rehearsal column - * @method ChildGroup[]|ObjectCollection findByFormatGroup(int $formatgroup) Return ChildGroup objects filtered by the formatgroup column - * @method ChildGroup[]|ObjectCollection findByDescription(string $description) Return ChildGroup objects filtered by the description column - * @method ChildGroup[]|ObjectCollection findByAllowRoleSwaps(boolean $allowRoleSwaps) Return ChildGroup objects filtered by the allowRoleSwaps column - * @method ChildGroup[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildGroup[]|Collection find(?ConnectionInterface $con = null) Return ChildGroup objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildGroup objects based on current ModelCriteria * + * @method ChildGroup[]|Collection findById(int|array $id) Return ChildGroup objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildGroup objects filtered by the id column + * @method ChildGroup[]|Collection findByName(string|array $name) Return ChildGroup objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildGroup objects filtered by the name column + * @method ChildGroup[]|Collection findByRehearsal(int|array $rehearsal) Return ChildGroup objects filtered by the rehearsal column + * @psalm-method Collection&\Traversable findByRehearsal(int|array $rehearsal) Return ChildGroup objects filtered by the rehearsal column + * @method ChildGroup[]|Collection findByFormatGroup(int|array $formatgroup) Return ChildGroup objects filtered by the formatgroup column + * @psalm-method Collection&\Traversable findByFormatGroup(int|array $formatgroup) Return ChildGroup objects filtered by the formatgroup column + * @method ChildGroup[]|Collection findByDescription(string|array $description) Return ChildGroup objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildGroup objects filtered by the description column + * @method ChildGroup[]|Collection findByAllowRoleSwaps(boolean|array $allowRoleSwaps) Return ChildGroup objects filtered by the allowRoleSwaps column + * @psalm-method Collection&\Traversable findByAllowRoleSwaps(boolean|array $allowRoleSwaps) Return ChildGroup objects filtered by the allowRoleSwaps column + * + * @method ChildGroup[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class GroupQuery extends ModelCriteria { @@ -91,9 +99,9 @@ abstract class GroupQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\GroupQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Group', $modelAlias = null) { @@ -103,12 +111,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildGroupQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildGroupQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildGroupQuery) { return $criteria; @@ -138,7 +146,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildGroup|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -170,8 +178,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -203,8 +211,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildGroup|array|mixed the result, formatted by the current formatter */ @@ -224,12 +232,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -246,25 +254,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(GroupTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(GroupTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(GroupTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(GroupTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -277,15 +291,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -305,7 +319,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(GroupTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(GroupTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -315,14 +331,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -330,7 +347,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(GroupTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(GroupTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -343,15 +362,15 @@ public function filterByName($name = null, $comparison = null) * $query->filterByRehearsal(array('min' => 12)); // WHERE rehearsal > 12 * * - * @param mixed $rehearsal The value to use as filter. + * @param mixed $rehearsal The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRehearsal($rehearsal = null, $comparison = null) + public function filterByRehearsal($rehearsal = null, ?string $comparison = null) { if (is_array($rehearsal)) { $useMinMax = false; @@ -371,7 +390,9 @@ public function filterByRehearsal($rehearsal = null, $comparison = null) } } - return $this->addUsingAlias(GroupTableMap::COL_REHEARSAL, $rehearsal, $comparison); + $this->addUsingAlias(GroupTableMap::COL_REHEARSAL, $rehearsal, $comparison); + + return $this; } /** @@ -384,15 +405,15 @@ public function filterByRehearsal($rehearsal = null, $comparison = null) * $query->filterByFormatGroup(array('min' => 12)); // WHERE formatgroup > 12 * * - * @param mixed $formatGroup The value to use as filter. + * @param mixed $formatGroup The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByFormatGroup($formatGroup = null, $comparison = null) + public function filterByFormatGroup($formatGroup = null, ?string $comparison = null) { if (is_array($formatGroup)) { $useMinMax = false; @@ -412,7 +433,9 @@ public function filterByFormatGroup($formatGroup = null, $comparison = null) } } - return $this->addUsingAlias(GroupTableMap::COL_FORMATGROUP, $formatGroup, $comparison); + $this->addUsingAlias(GroupTableMap::COL_FORMATGROUP, $formatGroup, $comparison); + + return $this; } /** @@ -422,14 +445,15 @@ public function filterByFormatGroup($formatGroup = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -437,7 +461,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(GroupTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(GroupTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -449,42 +475,48 @@ public function filterByDescription($description = null, $comparison = null) * $query->filterByAllowRoleSwaps('yes'); // WHERE allowRoleSwaps = true * * - * @param boolean|string $allowRoleSwaps The value to use as filter. + * @param bool|string $allowRoleSwaps The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAllowRoleSwaps($allowRoleSwaps = null, $comparison = null) + public function filterByAllowRoleSwaps($allowRoleSwaps = null, ?string $comparison = null) { if (is_string($allowRoleSwaps)) { - $allowRoleSwaps = in_array(strtolower($allowRoleSwaps), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $allowRoleSwaps = in_array(strtolower($allowRoleSwaps), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(GroupTableMap::COL_ALLOWROLESWAPS, $allowRoleSwaps, $comparison); + $this->addUsingAlias(GroupTableMap::COL_ALLOWROLESWAPS, $allowRoleSwaps, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Role object * * @param \TechWilk\Rota\Role|ObjectCollection $role the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRole($role, $comparison = null) + public function filterByRole($role, ?string $comparison = null) { if ($role instanceof \TechWilk\Rota\Role) { - return $this + $this ->addUsingAlias(GroupTableMap::COL_ID, $role->getGroupId(), $comparison); + + return $this; } elseif ($role instanceof ObjectCollection) { - return $this + $this ->useRoleQuery() ->filterByPrimaryKeys($role->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByRole() only accepts arguments of type \TechWilk\Rota\Role or Collection'); } @@ -493,12 +525,12 @@ public function filterByRole($role, $comparison = null) /** * Adds a JOIN clause to the query using the Role relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Role'); @@ -527,9 +559,9 @@ public function joinRole($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\RoleQuery A secondary query class using the current class as primary query */ @@ -540,12 +572,108 @@ public function useRoleQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'Role', '\TechWilk\Rota\RoleQuery'); } + /** + * Use the Role relation Role object + * + * @param callable(\TechWilk\Rota\RoleQuery):\TechWilk\Rota\RoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Role table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the EXISTS statement + */ + public function useRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useExistsQuery('Role', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Role table for a NOT EXISTS query. + * + * @see useRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the NOT EXISTS statement + */ + public function useRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useExistsQuery('Role', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Role table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the IN statement + */ + public function useInRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useInQuery('Role', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Role table for a NOT IN query. + * + * @see useRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the NOT IN statement + */ + public function useNotInRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useInQuery('Role', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildGroup $group Object to remove from the list of results + * @param ChildGroup $group Object to remove from the list of results * - * @return $this|ChildGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($group = null) { @@ -562,7 +690,7 @@ public function prune($group = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME); @@ -587,12 +715,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME); @@ -616,4 +744,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // GroupQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Location.php b/generated-classes/TechWilk/Rota/Base/Location.php index 0ad5c801..b0de09cd 100644 --- a/generated-classes/TechWilk/Rota/Base/Location.php +++ b/generated-classes/TechWilk/Rota/Base/Location.php @@ -37,19 +37,21 @@ abstract class Location implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\LocationTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\LocationTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -58,14 +60,14 @@ abstract class Location implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -84,18 +86,20 @@ abstract class Location implements ActiveRecordInterface /** * The value for the address field. * - * @var string + * @var string|null */ protected $address; /** * @var ObjectCollection|ChildEventType[] Collection to store aggregation of ChildEventType objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEventType objects. */ protected $collEventTypes; protected $collEventTypesPartial; /** * @var ObjectCollection|ChildEvent[] Collection to store aggregation of ChildEvent objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEvent objects. */ protected $collEvents; protected $collEventsPartial; @@ -104,19 +108,21 @@ abstract class Location implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEventType[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventTypesScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEvent[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventsScheduledForDeletion = null; @@ -130,9 +136,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -140,10 +146,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -152,7 +158,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -162,9 +168,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -173,45 +179,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -220,10 +224,10 @@ public function resetModified($col = null) * obj is an instance of Location, delegates to * equals(Location). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -245,7 +249,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -253,10 +257,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -264,15 +268,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -281,12 +285,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Location The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -296,13 +300,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -313,24 +317,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -338,7 +345,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -368,7 +375,7 @@ public function getName() /** * Get the [address] column value. * - * @return string + * @return string|null */ public function getAddress() { @@ -378,8 +385,8 @@ public function getAddress() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Location The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -393,13 +400,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Location The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -413,13 +420,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [address] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Location The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setAddress($v) { @@ -433,7 +440,7 @@ public function setAddress($v) } return $this; - } // setAddress() + } /** * Indicates whether the columns in this object are only set to default values. @@ -441,13 +448,13 @@ public function setAddress($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -457,19 +464,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : LocationTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -478,8 +486,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : LocationTableMap::translateFieldName('Address', TableMap::TYPE_PHPNAME, $indexType)]; $this->address = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -487,6 +495,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 3; // 3 = LocationTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Location'), 0, $e); } @@ -503,23 +512,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -549,19 +559,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->collEventTypes = null; $this->collEvents = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Location::setDeleted() * @see Location::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -591,12 +602,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -641,12 +652,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -699,22 +710,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[LocationTableMap::COL_ID] = true; @@ -745,12 +757,15 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'address': $stmt->bindValue($identifier, $this->address, PDO::PARAM_STR); + break; } } @@ -773,12 +788,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -789,14 +804,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = LocationTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -808,24 +823,23 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getAddress(); - break; + default: return null; - break; } // switch() } @@ -835,27 +849,27 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Location'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Location'][$this->hashCode()] = true; $keys = LocationTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getAddress(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -863,6 +877,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collEventTypes) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventTypes'; @@ -877,6 +892,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collEventTypes->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collEvents) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'events'; @@ -898,30 +914,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Location + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = LocationTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Location + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -951,11 +969,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = LocationTableMap::getFieldNames($keyType); @@ -968,6 +986,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[2], $arr)) { $this->setAddress($arr[$keys[2]]); } + + return $this; } /** @@ -987,9 +1007,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Location The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1003,9 +1023,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(LocationTableMap::DATABASE_NAME); @@ -1026,13 +1046,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildLocationQuery::create(); $criteria->add(LocationTableMap::COL_ID, $this->id); @@ -1044,7 +1064,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1074,19 +1094,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1097,12 +1118,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Location (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Location (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setAddress($this->getAddress()); @@ -1123,11 +1145,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addEvent($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1139,11 +1162,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Location Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1159,16 +1182,16 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('EventType' == $relationName) { + if ('EventType' === $relationName) { $this->initEventTypes(); return; } - if ('Event' == $relationName) { + if ('Event' === $relationName) { $this->initEvents(); return; } @@ -1180,18 +1203,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEventTypes() + * @return $this + * @see addEventTypes() */ public function clearEventTypes() { $this->collEventTypes = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEventTypes collection loaded partially. + * + * @return void */ - public function resetPartialEventTypes($v = true) + public function resetPartialEventTypes($v = true): void { $this->collEventTypesPartial = $v; } @@ -1203,12 +1230,12 @@ public function resetPartialEventTypes($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEventTypes($overrideExisting = true) + public function initEventTypes(bool $overrideExisting = true): void { if (null !== $this->collEventTypes && !$overrideExisting) { return; @@ -1229,18 +1256,28 @@ public function initEventTypes($overrideExisting = true) * If this ChildLocation is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEventType[] List of ChildEventType objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEventType objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventTypes(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEventTypes(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventTypesPartial && !$this->isNew(); - if (null === $this->collEventTypes || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEventTypes) { + if (null === $this->collEventTypes || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEventTypes(); + if (null === $this->collEventTypes) { + $this->initEventTypes(); + } else { + $collectionClassName = EventTypeTableMap::getTableMap()->getCollectionClassName(); + + $collEventTypes = new $collectionClassName; + $collEventTypes->setModel('\TechWilk\Rota\EventType'); + + return $collEventTypes; + } } else { $collEventTypes = ChildEventTypeQuery::create(null, $criteria) ->filterByLocation($this) @@ -1284,11 +1321,11 @@ public function getEventTypes(Criteria $criteria = null, ConnectionInterface $co * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $eventTypes A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildLocation The current object (for fluent API support) + * @param Collection $eventTypes A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEventTypes(Collection $eventTypes, ConnectionInterface $con = null) + public function setEventTypes(Collection $eventTypes, ?ConnectionInterface $con = null) { /** @var ChildEventType[] $eventTypesToDelete */ $eventTypesToDelete = $this->getEventTypes(new Criteria(), $con)->diff($eventTypes); @@ -1314,13 +1351,13 @@ public function setEventTypes(Collection $eventTypes, ConnectionInterface $con = /** * Returns the number of related EventType objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related EventType objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related EventType objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEventTypes(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEventTypes(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventTypesPartial && !$this->isNew(); if (null === $this->collEventTypes || null !== $criteria || $partial) { @@ -1349,8 +1386,8 @@ public function countEventTypes(Criteria $criteria = null, $distinct = false, Co * Method called to associate a ChildEventType object to this object * through the ChildEventType foreign key attribute. * - * @param ChildEventType $l ChildEventType - * @return $this|\TechWilk\Rota\Location The current object (for fluent API support) + * @param ChildEventType $l ChildEventType + * @return $this The current object (for fluent API support) */ public function addEventType(ChildEventType $l) { @@ -1373,15 +1410,15 @@ public function addEventType(ChildEventType $l) /** * @param ChildEventType $eventType The ChildEventType object to add. */ - protected function doAddEventType(ChildEventType $eventType) + protected function doAddEventType(ChildEventType $eventType): void { $this->collEventTypes[]= $eventType; $eventType->setLocation($this); } /** - * @param ChildEventType $eventType The ChildEventType object to remove. - * @return $this|ChildLocation The current object (for fluent API support) + * @param ChildEventType $eventType The ChildEventType object to remove. + * @return $this The current object (for fluent API support) */ public function removeEventType(ChildEventType $eventType) { @@ -1405,18 +1442,22 @@ public function removeEventType(ChildEventType $eventType) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEvents() + * @return $this + * @see addEvents() */ public function clearEvents() { $this->collEvents = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEvents collection loaded partially. + * + * @return void */ - public function resetPartialEvents($v = true) + public function resetPartialEvents($v = true): void { $this->collEventsPartial = $v; } @@ -1428,12 +1469,12 @@ public function resetPartialEvents($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEvents($overrideExisting = true) + public function initEvents(bool $overrideExisting = true): void { if (null !== $this->collEvents && !$overrideExisting) { return; @@ -1454,18 +1495,28 @@ public function initEvents($overrideExisting = true) * If this ChildLocation is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEvent[] List of ChildEvent objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvents(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEvents(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventsPartial && !$this->isNew(); - if (null === $this->collEvents || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEvents) { + if (null === $this->collEvents || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEvents(); + if (null === $this->collEvents) { + $this->initEvents(); + } else { + $collectionClassName = EventTableMap::getTableMap()->getCollectionClassName(); + + $collEvents = new $collectionClassName; + $collEvents->setModel('\TechWilk\Rota\Event'); + + return $collEvents; + } } else { $collEvents = ChildEventQuery::create(null, $criteria) ->filterByLocation($this) @@ -1509,11 +1560,11 @@ public function getEvents(Criteria $criteria = null, ConnectionInterface $con = * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $events A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildLocation The current object (for fluent API support) + * @param Collection $events A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEvents(Collection $events, ConnectionInterface $con = null) + public function setEvents(Collection $events, ?ConnectionInterface $con = null) { /** @var ChildEvent[] $eventsToDelete */ $eventsToDelete = $this->getEvents(new Criteria(), $con)->diff($events); @@ -1539,13 +1590,13 @@ public function setEvents(Collection $events, ConnectionInterface $con = null) /** * Returns the number of related Event objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Event objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Event objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEvents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEvents(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventsPartial && !$this->isNew(); if (null === $this->collEvents || null !== $criteria || $partial) { @@ -1574,8 +1625,8 @@ public function countEvents(Criteria $criteria = null, $distinct = false, Connec * Method called to associate a ChildEvent object to this object * through the ChildEvent foreign key attribute. * - * @param ChildEvent $l ChildEvent - * @return $this|\TechWilk\Rota\Location The current object (for fluent API support) + * @param ChildEvent $l ChildEvent + * @return $this The current object (for fluent API support) */ public function addEvent(ChildEvent $l) { @@ -1598,15 +1649,15 @@ public function addEvent(ChildEvent $l) /** * @param ChildEvent $event The ChildEvent object to add. */ - protected function doAddEvent(ChildEvent $event) + protected function doAddEvent(ChildEvent $event): void { $this->collEvents[]= $event; $event->setLocation($this); } /** - * @param ChildEvent $event The ChildEvent object to remove. - * @return $this|ChildLocation The current object (for fluent API support) + * @param ChildEvent $event The ChildEvent object to remove. + * @return $this The current object (for fluent API support) */ public function removeEvent(ChildEvent $event) { @@ -1636,12 +1687,13 @@ public function removeEvent(ChildEvent $event) * api reasonable. You can provide public methods for those you * actually need in Location. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1661,12 +1713,13 @@ public function getEventsJoinUser(Criteria $criteria = null, ConnectionInterface * api reasonable. You can provide public methods for those you * actually need in Location. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventType', $joinBehavior); @@ -1686,12 +1739,13 @@ public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInte * api reasonable. You can provide public methods for those you * actually need in Location. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventSubType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventSubType', $joinBehavior); @@ -1711,12 +1765,13 @@ public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionI * api reasonable. You can provide public methods for those you * actually need in Location. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventGroup(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventGroup', $joinBehavior); @@ -1728,6 +1783,8 @@ public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInt * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1739,6 +1796,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1747,9 +1806,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collEventTypes) { @@ -1766,6 +1826,7 @@ public function clearAllReferences($deep = false) $this->collEventTypes = null; $this->collEvents = null; + return $this; } /** @@ -1780,99 +1841,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1882,7 +1923,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1902,17 +1943,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/LocationQuery.php b/generated-classes/TechWilk/Rota/Base/LocationQuery.php index 052462ab..df1ec187 100644 --- a/generated-classes/TechWilk/Rota/Base/LocationQuery.php +++ b/generated-classes/TechWilk/Rota/Base/LocationQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\LocationTableMap; /** - * Base class that represents a query for the 'locations' table. - * - * + * Base class that represents a query for the `locations` table. * * @method ChildLocationQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildLocationQuery orderByName($order = Criteria::ASC) Order by the name column @@ -58,26 +57,32 @@ * * @method \TechWilk\Rota\EventTypeQuery|\TechWilk\Rota\EventQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildLocation findOne(ConnectionInterface $con = null) Return the first ChildLocation matching the query - * @method ChildLocation findOneOrCreate(ConnectionInterface $con = null) Return the first ChildLocation matching the query, or a new ChildLocation object populated from the query conditions when no match is found + * @method ChildLocation|null findOne(?ConnectionInterface $con = null) Return the first ChildLocation matching the query + * @method ChildLocation findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildLocation matching the query, or a new ChildLocation object populated from the query conditions when no match is found * - * @method ChildLocation findOneById(int $id) Return the first ChildLocation filtered by the id column - * @method ChildLocation findOneByName(string $name) Return the first ChildLocation filtered by the name column - * @method ChildLocation findOneByAddress(string $address) Return the first ChildLocation filtered by the address column * - - * @method ChildLocation requirePk($key, ConnectionInterface $con = null) Return the ChildLocation by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildLocation requireOne(ConnectionInterface $con = null) Return the first ChildLocation matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildLocation|null findOneById(int $id) Return the first ChildLocation filtered by the id column + * @method ChildLocation|null findOneByName(string $name) Return the first ChildLocation filtered by the name column + * @method ChildLocation|null findOneByAddress(string $address) Return the first ChildLocation filtered by the address column + * + * @method ChildLocation requirePk($key, ?ConnectionInterface $con = null) Return the ChildLocation by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildLocation requireOne(?ConnectionInterface $con = null) Return the first ChildLocation matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildLocation requireOneById(int $id) Return the first ChildLocation filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildLocation requireOneByName(string $name) Return the first ChildLocation filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildLocation requireOneByAddress(string $address) Return the first ChildLocation filtered by the address column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildLocation[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildLocation objects based on current ModelCriteria - * @method ChildLocation[]|ObjectCollection findById(int $id) Return ChildLocation objects filtered by the id column - * @method ChildLocation[]|ObjectCollection findByName(string $name) Return ChildLocation objects filtered by the name column - * @method ChildLocation[]|ObjectCollection findByAddress(string $address) Return ChildLocation objects filtered by the address column - * @method ChildLocation[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildLocation[]|Collection find(?ConnectionInterface $con = null) Return ChildLocation objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildLocation objects based on current ModelCriteria * + * @method ChildLocation[]|Collection findById(int|array $id) Return ChildLocation objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildLocation objects filtered by the id column + * @method ChildLocation[]|Collection findByName(string|array $name) Return ChildLocation objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildLocation objects filtered by the name column + * @method ChildLocation[]|Collection findByAddress(string|array $address) Return ChildLocation objects filtered by the address column + * @psalm-method Collection&\Traversable findByAddress(string|array $address) Return ChildLocation objects filtered by the address column + * + * @method ChildLocation[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class LocationQuery extends ModelCriteria { @@ -86,9 +91,9 @@ abstract class LocationQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\LocationQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Location', $modelAlias = null) { @@ -98,12 +103,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildLocationQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildLocationQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildLocationQuery) { return $criteria; @@ -133,7 +138,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildLocation|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -165,8 +170,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -198,8 +203,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildLocation|array|mixed the result, formatted by the current formatter */ @@ -219,12 +224,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -241,25 +246,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(LocationTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(LocationTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(LocationTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(LocationTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -272,15 +283,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -300,7 +311,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(LocationTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(LocationTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -310,14 +323,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -325,7 +339,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(LocationTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(LocationTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -335,14 +351,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByAddress('fooValue'); // WHERE address = 'fooValue' * $query->filterByAddress('%fooValue%', Criteria::LIKE); // WHERE address LIKE '%fooValue%' + * $query->filterByAddress(['foo', 'bar']); // WHERE address IN ('foo', 'bar') * * - * @param string $address The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $address The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAddress($address = null, $comparison = null) + public function filterByAddress($address = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($address)) { @@ -350,27 +367,33 @@ public function filterByAddress($address = null, $comparison = null) } } - return $this->addUsingAlias(LocationTableMap::COL_ADDRESS, $address, $comparison); + $this->addUsingAlias(LocationTableMap::COL_ADDRESS, $address, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\EventType object * * @param \TechWilk\Rota\EventType|ObjectCollection $eventType the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventType($eventType, $comparison = null) + public function filterByEventType($eventType, ?string $comparison = null) { if ($eventType instanceof \TechWilk\Rota\EventType) { - return $this + $this ->addUsingAlias(LocationTableMap::COL_ID, $eventType->getDefaultLocationId(), $comparison); + + return $this; } elseif ($eventType instanceof ObjectCollection) { - return $this + $this ->useEventTypeQuery() ->filterByPrimaryKeys($eventType->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEventType() only accepts arguments of type \TechWilk\Rota\EventType or Collection'); } @@ -379,12 +402,12 @@ public function filterByEventType($eventType, $comparison = null) /** * Adds a JOIN clause to the query using the EventType relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventType($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinEventType(?string $relationAlias = null, ?string $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventType'); @@ -413,9 +436,9 @@ public function joinEventType($relationAlias = null, $joinType = Criteria::LEFT_ * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventTypeQuery A secondary query class using the current class as primary query */ @@ -426,24 +449,124 @@ public function useEventTypeQuery($relationAlias = null, $joinType = Criteria::L ->useQuery($relationAlias ? $relationAlias : 'EventType', '\TechWilk\Rota\EventTypeQuery'); } + /** + * Use the EventType relation EventType object + * + * @param callable(\TechWilk\Rota\EventTypeQuery):\TechWilk\Rota\EventTypeQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventTypeQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::LEFT_JOIN + ) { + $relatedQuery = $this->useEventTypeQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventType table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the EXISTS statement + */ + public function useEventTypeExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useExistsQuery('EventType', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventType table for a NOT EXISTS query. + * + * @see useEventTypeExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the NOT EXISTS statement + */ + public function useEventTypeNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useExistsQuery('EventType', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventType table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the IN statement + */ + public function useInEventTypeQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useInQuery('EventType', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventType table for a NOT IN query. + * + * @see useEventTypeInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventTypeQuery The inner query object of the NOT IN statement + */ + public function useNotInEventTypeQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventTypeQuery */ + $q = $this->useInQuery('EventType', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { - return $this + $this ->addUsingAlias(LocationTableMap::COL_ID, $event->getLocationId(), $comparison); + + return $this; } elseif ($event instanceof ObjectCollection) { - return $this + $this ->useEventQuery() ->filterByPrimaryKeys($event->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -452,12 +575,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -486,9 +609,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -499,12 +622,108 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildLocation $location Object to remove from the list of results + * @param ChildLocation $location Object to remove from the list of results * - * @return $this|ChildLocationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($location = null) { @@ -521,7 +740,7 @@ public function prune($location = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(LocationTableMap::DATABASE_NAME); @@ -546,12 +765,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(LocationTableMap::DATABASE_NAME); @@ -575,4 +794,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // LocationQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/LoginFailure.php b/generated-classes/TechWilk/Rota/Base/LoginFailure.php index a6ebf89e..238d441c 100644 --- a/generated-classes/TechWilk/Rota/Base/LoginFailure.php +++ b/generated-classes/TechWilk/Rota/Base/LoginFailure.php @@ -31,19 +31,21 @@ abstract class LoginFailure implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\LoginFailureTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\LoginFailureTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -52,14 +54,14 @@ abstract class LoginFailure implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the username field. @@ -87,7 +89,7 @@ abstract class LoginFailure implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -97,7 +99,7 @@ abstract class LoginFailure implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { } @@ -113,9 +115,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -123,10 +125,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -135,7 +137,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -145,9 +147,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -156,45 +158,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -203,10 +203,10 @@ public function resetModified($col = null) * obj is an instance of LoginFailure, delegates to * equals(LoginFailure). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -228,7 +228,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -236,10 +236,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -247,15 +247,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -264,12 +264,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|LoginFailure The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -279,13 +279,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -296,24 +296,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -321,7 +324,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -352,12 +355,14 @@ public function getipAddress() * Get the [optionally formatted] temporal [timestamp] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime : string) */ public function getTimestamp($format = null) { @@ -371,8 +376,8 @@ public function getTimestamp($format = null) /** * Set the value of [username] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\LoginFailure The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setUsername($v) { @@ -386,13 +391,13 @@ public function setUsername($v) } return $this; - } // setUsername() + } /** * Set the value of [ipaddress] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\LoginFailure The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setipAddress($v) { @@ -406,14 +411,14 @@ public function setipAddress($v) } return $this; - } // setipAddress() + } /** * Sets the value of [timestamp] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\LoginFailure The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setTimestamp($v) { @@ -426,7 +431,7 @@ public function setTimestamp($v) } // if either are not null return $this; - } // setTimestamp() + } /** * Indicates whether the columns in this object are only set to default values. @@ -434,13 +439,13 @@ public function setTimestamp($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -450,19 +455,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : LoginFailureTableMap::translateFieldName('Username', TableMap::TYPE_PHPNAME, $indexType)]; $this->username = (null !== $col) ? (string) $col : null; @@ -474,8 +480,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->timestamp = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -483,6 +489,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 3; // 3 = LoginFailureTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\LoginFailure'), 0, $e); } @@ -499,23 +506,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -541,19 +549,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see LoginFailure::setDeleted() * @see LoginFailure::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -583,12 +592,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -633,12 +642,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -656,22 +665,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; @@ -698,12 +708,15 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'username': $stmt->bindValue($identifier, $this->username, PDO::PARAM_STR); + break; case 'ipAddress': $stmt->bindValue($identifier, $this->ipaddress, PDO::PARAM_STR); + break; case 'timestamp': $stmt->bindValue($identifier, $this->timestamp ? $this->timestamp->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -719,12 +732,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -735,14 +748,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = LoginFailureTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -754,24 +767,23 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getUsername(); - break; + case 1: return $this->getipAddress(); - break; + case 2: return $this->getTimestamp(); - break; + default: return null; - break; } // switch() } @@ -781,28 +793,28 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array()) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = []): array { if (isset($alreadyDumpedObjects['LoginFailure'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['LoginFailure'][$this->hashCode()] = true; $keys = LoginFailureTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getUsername(), $keys[1] => $this->getipAddress(), $keys[2] => $this->getTimestamp(), - ); + ]; if ($result[$keys[2]] instanceof \DateTimeInterface) { - $result[$keys[2]] = $result[$keys[2]]->format('c'); + $result[$keys[2]] = $result[$keys[2]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -817,30 +829,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\LoginFailure + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = LoginFailureTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\LoginFailure + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -870,11 +884,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = LoginFailureTableMap::getFieldNames($keyType); @@ -887,6 +901,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[2], $arr)) { $this->setTimestamp($arr[$keys[2]]); } + + return $this; } /** @@ -906,9 +922,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\LoginFailure The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -922,9 +938,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(LoginFailureTableMap::DATABASE_NAME); @@ -945,13 +961,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { throw new LogicException('The LoginFailure object has no primary key'); @@ -962,7 +978,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -990,27 +1006,14 @@ public function getPrimaryKey() return null; } - /** - * Dummy primary key setter. - * - * This function only exists to preserve backwards compatibility. It is no longer - * needed or required by the Persistent interface. It will be removed in next BC-breaking - * release of Propel. - * - * @deprecated - */ - public function setPrimaryKey($pk) - { - // do nothing, because this object doesn't have any primary keys - } - /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { - return ; + return false; } /** @@ -1019,12 +1022,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\LoginFailure (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\LoginFailure (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setUsername($this->getUsername()); $copyObj->setipAddress($this->getipAddress()); @@ -1042,11 +1046,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\LoginFailure Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1060,6 +1064,8 @@ public function copy($deepCopy = false) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1072,6 +1078,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1080,12 +1088,15 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) + + return $this; } /** @@ -1100,99 +1111,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1202,7 +1193,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1222,17 +1213,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/LoginFailureQuery.php b/generated-classes/TechWilk/Rota/Base/LoginFailureQuery.php index bcc28604..ecbf088a 100644 --- a/generated-classes/TechWilk/Rota/Base/LoginFailureQuery.php +++ b/generated-classes/TechWilk/Rota/Base/LoginFailureQuery.php @@ -6,7 +6,7 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\Collection\ObjectCollection; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\LogicException; use Propel\Runtime\Exception\PropelException; @@ -15,9 +15,7 @@ use TechWilk\Rota\Map\LoginFailureTableMap; /** - * Base class that represents a query for the 'loginFailures' table. - * - * + * Base class that represents a query for the `loginFailures` table. * * @method ChildLoginFailureQuery orderByUsername($order = Criteria::ASC) Order by the username column * @method ChildLoginFailureQuery orderByipAddress($order = Criteria::ASC) Order by the ipAddress column @@ -35,26 +33,32 @@ * @method ChildLoginFailureQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query * @method ChildLoginFailureQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query * - * @method ChildLoginFailure findOne(ConnectionInterface $con = null) Return the first ChildLoginFailure matching the query - * @method ChildLoginFailure findOneOrCreate(ConnectionInterface $con = null) Return the first ChildLoginFailure matching the query, or a new ChildLoginFailure object populated from the query conditions when no match is found + * @method ChildLoginFailure|null findOne(?ConnectionInterface $con = null) Return the first ChildLoginFailure matching the query + * @method ChildLoginFailure findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildLoginFailure matching the query, or a new ChildLoginFailure object populated from the query conditions when no match is found * - * @method ChildLoginFailure findOneByUsername(string $username) Return the first ChildLoginFailure filtered by the username column - * @method ChildLoginFailure findOneByipAddress(string $ipAddress) Return the first ChildLoginFailure filtered by the ipAddress column - * @method ChildLoginFailure findOneByTimestamp(string $timestamp) Return the first ChildLoginFailure filtered by the timestamp column * - - * @method ChildLoginFailure requirePk($key, ConnectionInterface $con = null) Return the ChildLoginFailure by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildLoginFailure requireOne(ConnectionInterface $con = null) Return the first ChildLoginFailure matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildLoginFailure|null findOneByUsername(string $username) Return the first ChildLoginFailure filtered by the username column + * @method ChildLoginFailure|null findOneByipAddress(string $ipAddress) Return the first ChildLoginFailure filtered by the ipAddress column + * @method ChildLoginFailure|null findOneByTimestamp(string $timestamp) Return the first ChildLoginFailure filtered by the timestamp column + * + * @method ChildLoginFailure requirePk($key, ?ConnectionInterface $con = null) Return the ChildLoginFailure by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildLoginFailure requireOne(?ConnectionInterface $con = null) Return the first ChildLoginFailure matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildLoginFailure requireOneByUsername(string $username) Return the first ChildLoginFailure filtered by the username column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildLoginFailure requireOneByipAddress(string $ipAddress) Return the first ChildLoginFailure filtered by the ipAddress column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildLoginFailure requireOneByTimestamp(string $timestamp) Return the first ChildLoginFailure filtered by the timestamp column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildLoginFailure[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildLoginFailure objects based on current ModelCriteria - * @method ChildLoginFailure[]|ObjectCollection findByUsername(string $username) Return ChildLoginFailure objects filtered by the username column - * @method ChildLoginFailure[]|ObjectCollection findByipAddress(string $ipAddress) Return ChildLoginFailure objects filtered by the ipAddress column - * @method ChildLoginFailure[]|ObjectCollection findByTimestamp(string $timestamp) Return ChildLoginFailure objects filtered by the timestamp column - * @method ChildLoginFailure[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildLoginFailure[]|Collection find(?ConnectionInterface $con = null) Return ChildLoginFailure objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildLoginFailure objects based on current ModelCriteria * + * @method ChildLoginFailure[]|Collection findByUsername(string|array $username) Return ChildLoginFailure objects filtered by the username column + * @psalm-method Collection&\Traversable findByUsername(string|array $username) Return ChildLoginFailure objects filtered by the username column + * @method ChildLoginFailure[]|Collection findByipAddress(string|array $ipAddress) Return ChildLoginFailure objects filtered by the ipAddress column + * @psalm-method Collection&\Traversable findByipAddress(string|array $ipAddress) Return ChildLoginFailure objects filtered by the ipAddress column + * @method ChildLoginFailure[]|Collection findByTimestamp(string|array $timestamp) Return ChildLoginFailure objects filtered by the timestamp column + * @psalm-method Collection&\Traversable findByTimestamp(string|array $timestamp) Return ChildLoginFailure objects filtered by the timestamp column + * + * @method ChildLoginFailure[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class LoginFailureQuery extends ModelCriteria { @@ -63,9 +67,9 @@ abstract class LoginFailureQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\LoginFailureQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\LoginFailure', $modelAlias = null) { @@ -75,12 +79,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildLoginFailureQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildLoginFailureQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildLoginFailureQuery) { return $criteria; @@ -110,7 +114,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildLoginFailure|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { throw new LogicException('The LoginFailure object has no primary key'); } @@ -120,12 +124,12 @@ public function findPk($key, ConnectionInterface $con = null) * * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { throw new LogicException('The LoginFailure object has no primary key'); } @@ -133,9 +137,9 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildLoginFailureQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { @@ -145,9 +149,9 @@ public function filterByPrimaryKey($key) /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildLoginFailureQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { @@ -161,14 +165,15 @@ public function filterByPrimaryKeys($keys) * * $query->filterByUsername('fooValue'); // WHERE username = 'fooValue' * $query->filterByUsername('%fooValue%', Criteria::LIKE); // WHERE username LIKE '%fooValue%' + * $query->filterByUsername(['foo', 'bar']); // WHERE username IN ('foo', 'bar') * * - * @param string $username The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $username The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildLoginFailureQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUsername($username = null, $comparison = null) + public function filterByUsername($username = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($username)) { @@ -176,7 +181,9 @@ public function filterByUsername($username = null, $comparison = null) } } - return $this->addUsingAlias(LoginFailureTableMap::COL_USERNAME, $username, $comparison); + $this->addUsingAlias(LoginFailureTableMap::COL_USERNAME, $username, $comparison); + + return $this; } /** @@ -186,14 +193,15 @@ public function filterByUsername($username = null, $comparison = null) * * $query->filterByipAddress('fooValue'); // WHERE ipAddress = 'fooValue' * $query->filterByipAddress('%fooValue%', Criteria::LIKE); // WHERE ipAddress LIKE '%fooValue%' + * $query->filterByipAddress(['foo', 'bar']); // WHERE ipAddress IN ('foo', 'bar') * * - * @param string $ipAddress The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $ipAddress The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildLoginFailureQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByipAddress($ipAddress = null, $comparison = null) + public function filterByipAddress($ipAddress = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($ipAddress)) { @@ -201,7 +209,9 @@ public function filterByipAddress($ipAddress = null, $comparison = null) } } - return $this->addUsingAlias(LoginFailureTableMap::COL_IPADDRESS, $ipAddress, $comparison); + $this->addUsingAlias(LoginFailureTableMap::COL_IPADDRESS, $ipAddress, $comparison); + + return $this; } /** @@ -214,17 +224,17 @@ public function filterByipAddress($ipAddress = null, $comparison = null) * $query->filterByTimestamp(array('max' => 'yesterday')); // WHERE timestamp > '2011-03-13' * * - * @param mixed $timestamp The value to use as filter. + * @param mixed $timestamp The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildLoginFailureQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimestamp($timestamp = null, $comparison = null) + public function filterByTimestamp($timestamp = null, ?string $comparison = null) { if (is_array($timestamp)) { $useMinMax = false; @@ -244,20 +254,23 @@ public function filterByTimestamp($timestamp = null, $comparison = null) } } - return $this->addUsingAlias(LoginFailureTableMap::COL_TIMESTAMP, $timestamp, $comparison); + $this->addUsingAlias(LoginFailureTableMap::COL_TIMESTAMP, $timestamp, $comparison); + + return $this; } /** * Exclude object from result * - * @param ChildLoginFailure $loginFailure Object to remove from the list of results + * @param ChildLoginFailure $loginFailure Object to remove from the list of results * - * @return $this|ChildLoginFailureQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($loginFailure = null) { if ($loginFailure) { throw new LogicException('LoginFailure object has no primary key'); + } return $this; @@ -269,7 +282,7 @@ public function prune($loginFailure = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(LoginFailureTableMap::DATABASE_NAME); @@ -294,12 +307,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(LoginFailureTableMap::DATABASE_NAME); @@ -323,4 +336,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // LoginFailureQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Notification.php b/generated-classes/TechWilk/Rota/Base/Notification.php index 63ab364a..d5a9ab3f 100644 --- a/generated-classes/TechWilk/Rota/Base/Notification.php +++ b/generated-classes/TechWilk/Rota/Base/Notification.php @@ -38,19 +38,21 @@ abstract class Notification implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\NotificationTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\NotificationTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -59,14 +61,14 @@ abstract class Notification implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -107,7 +109,7 @@ abstract class Notification implements ActiveRecordInterface /** * The value for the link field. * - * @var string + * @var string|null */ protected $link; @@ -149,6 +151,7 @@ abstract class Notification implements ActiveRecordInterface /** * @var ObjectCollection|ChildNotificationClick[] Collection to store aggregation of ChildNotificationClick objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildNotificationClick objects. */ protected $collNotificationClicks; protected $collNotificationClicksPartial; @@ -157,13 +160,14 @@ abstract class Notification implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildNotificationClick[] + * @phpstan-var ObjectCollection&\Traversable */ protected $notificationClicksScheduledForDeletion = null; @@ -173,7 +177,7 @@ abstract class Notification implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->seen = false; $this->dismissed = false; @@ -192,9 +196,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -202,10 +206,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -214,7 +218,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -224,9 +228,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -235,45 +239,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -282,10 +284,10 @@ public function resetModified($col = null) * obj is an instance of Notification, delegates to * equals(Notification). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -307,7 +309,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -315,10 +317,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -326,15 +328,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -343,12 +345,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Notification The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -358,13 +360,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -375,24 +377,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -400,7 +405,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -421,12 +426,14 @@ public function getId() * Get the [optionally formatted] temporal [timestamp] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime : string) */ public function getTimestamp($format = null) { @@ -470,7 +477,7 @@ public function getBody() /** * Get the [link] column value. * - * @return string + * @return string|null */ public function getLink() { @@ -550,8 +557,8 @@ public function isArchived() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -565,14 +572,14 @@ public function setId($v) } return $this; - } // setId() + } /** * Sets the value of [timestamp] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setTimestamp($v) { @@ -585,13 +592,13 @@ public function setTimestamp($v) } // if either are not null return $this; - } // setTimestamp() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -609,13 +616,13 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Set the value of [summary] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setSummary($v) { @@ -629,13 +636,13 @@ public function setSummary($v) } return $this; - } // setSummary() + } /** * Set the value of [body] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setBody($v) { @@ -649,13 +656,13 @@ public function setBody($v) } return $this; - } // setBody() + } /** * Set the value of [link] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setLink($v) { @@ -669,13 +676,13 @@ public function setLink($v) } return $this; - } // setLink() + } /** * Set the value of [type] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setType($v) { @@ -689,7 +696,7 @@ public function setType($v) } return $this; - } // setType() + } /** * Sets the value of the [seen] column. @@ -698,8 +705,8 @@ public function setType($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setSeen($v) { @@ -717,7 +724,7 @@ public function setSeen($v) } return $this; - } // setSeen() + } /** * Sets the value of the [dismissed] column. @@ -726,8 +733,8 @@ public function setSeen($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setDismissed($v) { @@ -745,7 +752,7 @@ public function setDismissed($v) } return $this; - } // setDismissed() + } /** * Sets the value of the [archived] column. @@ -754,8 +761,8 @@ public function setDismissed($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setArchived($v) { @@ -773,7 +780,7 @@ public function setArchived($v) } return $this; - } // setArchived() + } /** * Indicates whether the columns in this object are only set to default values. @@ -781,25 +788,25 @@ public function setArchived($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->seen !== false) { - return false; - } + if ($this->seen !== false) { + return false; + } - if ($this->dismissed !== false) { - return false; - } + if ($this->dismissed !== false) { + return false; + } - if ($this->archived !== false) { - return false; - } + if ($this->archived !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -809,19 +816,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : NotificationTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -854,8 +862,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : NotificationTableMap::translateFieldName('Archived', TableMap::TYPE_PHPNAME, $indexType)]; $this->archived = (null !== $col) ? (boolean) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -863,6 +871,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 10; // 10 = NotificationTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Notification'), 0, $e); } @@ -879,26 +888,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -927,19 +937,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->aUser = null; $this->collNotificationClicks = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Notification::setDeleted() * @see Notification::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -969,12 +980,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -1019,12 +1030,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -1071,22 +1082,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[NotificationTableMap::COL_ID] = true; @@ -1138,33 +1150,43 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'timestamp': $stmt->bindValue($identifier, $this->timestamp ? $this->timestamp->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'summary': $stmt->bindValue($identifier, $this->summary, PDO::PARAM_STR); + break; case 'body': $stmt->bindValue($identifier, $this->body, PDO::PARAM_STR); + break; case 'link': $stmt->bindValue($identifier, $this->link, PDO::PARAM_STR); + break; case 'type': $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT); + break; case 'seen': $stmt->bindValue($identifier, (int) $this->seen, PDO::PARAM_INT); + break; case 'dismissed': $stmt->bindValue($identifier, (int) $this->dismissed, PDO::PARAM_INT); + break; case 'archived': $stmt->bindValue($identifier, (int) $this->archived, PDO::PARAM_INT); + break; } } @@ -1187,12 +1209,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1203,14 +1225,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = NotificationTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1222,45 +1244,44 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getTimestamp(); - break; + case 2: return $this->getUserId(); - break; + case 3: return $this->getSummary(); - break; + case 4: return $this->getBody(); - break; + case 5: return $this->getLink(); - break; + case 6: return $this->getType(); - break; + case 7: return $this->getSeen(); - break; + case 8: return $this->getDismissed(); - break; + case 9: return $this->getArchived(); - break; + default: return null; - break; } // switch() } @@ -1270,23 +1291,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Notification'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Notification'][$this->hashCode()] = true; $keys = NotificationTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getTimestamp(), $keys[2] => $this->getUserId(), @@ -1297,9 +1318,9 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[7] => $this->getSeen(), $keys[8] => $this->getDismissed(), $keys[9] => $this->getArchived(), - ); + ]; if ($result[$keys[1]] instanceof \DateTimeInterface) { - $result[$keys[1]] = $result[$keys[1]]->format('c'); + $result[$keys[1]] = $result[$keys[1]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1309,6 +1330,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1320,9 +1342,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collNotificationClicks) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'notificationClicks'; @@ -1344,30 +1367,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Notification + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = NotificationTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Notification + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1418,11 +1443,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = NotificationTableMap::getFieldNames($keyType); @@ -1456,6 +1481,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[9], $arr)) { $this->setArchived($arr[$keys[9]]); } + + return $this; } /** @@ -1475,9 +1502,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Notification The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1491,9 +1518,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(NotificationTableMap::DATABASE_NAME); @@ -1535,13 +1562,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildNotificationQuery::create(); $criteria->add(NotificationTableMap::COL_ID, $this->id); @@ -1553,7 +1580,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1583,19 +1610,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1606,12 +1634,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Notification (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Notification (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setTimestamp($this->getTimestamp()); $copyObj->setUserId($this->getUserId()); @@ -1633,11 +1662,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addNotificationClick($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1649,11 +1679,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Notification Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1666,14 +1696,14 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { if ($v === null) { - $this->setUserId(null); + $this->setUserId(NULL); } else { $this->setUserId($v->getId()); } @@ -1694,11 +1724,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1720,12 +1750,12 @@ public function getUser(ConnectionInterface $con = null) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('NotificationClick' == $relationName) { + if ('NotificationClick' === $relationName) { $this->initNotificationClicks(); return; } @@ -1737,18 +1767,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addNotificationClicks() + * @return $this + * @see addNotificationClicks() */ public function clearNotificationClicks() { $this->collNotificationClicks = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collNotificationClicks collection loaded partially. + * + * @return void */ - public function resetPartialNotificationClicks($v = true) + public function resetPartialNotificationClicks($v = true): void { $this->collNotificationClicksPartial = $v; } @@ -1760,12 +1794,12 @@ public function resetPartialNotificationClicks($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initNotificationClicks($overrideExisting = true) + public function initNotificationClicks(bool $overrideExisting = true): void { if (null !== $this->collNotificationClicks && !$overrideExisting) { return; @@ -1786,18 +1820,28 @@ public function initNotificationClicks($overrideExisting = true) * If this ChildNotification is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildNotificationClick[] List of ChildNotificationClick objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildNotificationClick objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getNotificationClicks(Criteria $criteria = null, ConnectionInterface $con = null) + public function getNotificationClicks(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collNotificationClicksPartial && !$this->isNew(); - if (null === $this->collNotificationClicks || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collNotificationClicks) { + if (null === $this->collNotificationClicks || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initNotificationClicks(); + if (null === $this->collNotificationClicks) { + $this->initNotificationClicks(); + } else { + $collectionClassName = NotificationClickTableMap::getTableMap()->getCollectionClassName(); + + $collNotificationClicks = new $collectionClassName; + $collNotificationClicks->setModel('\TechWilk\Rota\NotificationClick'); + + return $collNotificationClicks; + } } else { $collNotificationClicks = ChildNotificationClickQuery::create(null, $criteria) ->filterByNotification($this) @@ -1841,11 +1885,11 @@ public function getNotificationClicks(Criteria $criteria = null, ConnectionInter * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $notificationClicks A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildNotification The current object (for fluent API support) + * @param Collection $notificationClicks A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setNotificationClicks(Collection $notificationClicks, ConnectionInterface $con = null) + public function setNotificationClicks(Collection $notificationClicks, ?ConnectionInterface $con = null) { /** @var ChildNotificationClick[] $notificationClicksToDelete */ $notificationClicksToDelete = $this->getNotificationClicks(new Criteria(), $con)->diff($notificationClicks); @@ -1871,13 +1915,13 @@ public function setNotificationClicks(Collection $notificationClicks, Connection /** * Returns the number of related NotificationClick objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related NotificationClick objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related NotificationClick objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countNotificationClicks(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countNotificationClicks(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collNotificationClicksPartial && !$this->isNew(); if (null === $this->collNotificationClicks || null !== $criteria || $partial) { @@ -1906,8 +1950,8 @@ public function countNotificationClicks(Criteria $criteria = null, $distinct = f * Method called to associate a ChildNotificationClick object to this object * through the ChildNotificationClick foreign key attribute. * - * @param ChildNotificationClick $l ChildNotificationClick - * @return $this|\TechWilk\Rota\Notification The current object (for fluent API support) + * @param ChildNotificationClick $l ChildNotificationClick + * @return $this The current object (for fluent API support) */ public function addNotificationClick(ChildNotificationClick $l) { @@ -1930,15 +1974,15 @@ public function addNotificationClick(ChildNotificationClick $l) /** * @param ChildNotificationClick $notificationClick The ChildNotificationClick object to add. */ - protected function doAddNotificationClick(ChildNotificationClick $notificationClick) + protected function doAddNotificationClick(ChildNotificationClick $notificationClick): void { $this->collNotificationClicks[]= $notificationClick; $notificationClick->setNotification($this); } /** - * @param ChildNotificationClick $notificationClick The ChildNotificationClick object to remove. - * @return $this|ChildNotification The current object (for fluent API support) + * @param ChildNotificationClick $notificationClick The ChildNotificationClick object to remove. + * @return $this The current object (for fluent API support) */ public function removeNotificationClick(ChildNotificationClick $notificationClick) { @@ -1960,6 +2004,8 @@ public function removeNotificationClick(ChildNotificationClick $notificationClic * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1982,6 +2028,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1990,9 +2038,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collNotificationClicks) { @@ -2004,6 +2053,7 @@ public function clearAllReferences($deep = false) $this->collNotificationClicks = null; $this->aUser = null; + return $this; } /** @@ -2018,99 +2068,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -2120,7 +2150,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -2140,17 +2170,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/NotificationClick.php b/generated-classes/TechWilk/Rota/Base/NotificationClick.php index cf8c0fd5..b3755880 100644 --- a/generated-classes/TechWilk/Rota/Base/NotificationClick.php +++ b/generated-classes/TechWilk/Rota/Base/NotificationClick.php @@ -33,19 +33,21 @@ abstract class NotificationClick implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\NotificationClickTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\NotificationClickTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -54,14 +56,14 @@ abstract class NotificationClick implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -87,7 +89,7 @@ abstract class NotificationClick implements ActiveRecordInterface /** * The value for the timestamp field. * - * @var DateTime + * @var DateTime|null */ protected $timestamp; @@ -100,7 +102,7 @@ abstract class NotificationClick implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -114,9 +116,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -124,10 +126,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -136,7 +138,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -146,9 +148,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -157,45 +159,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -204,10 +204,10 @@ public function resetModified($col = null) * obj is an instance of NotificationClick, delegates to * equals(NotificationClick). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -229,7 +229,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -237,10 +237,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -248,15 +248,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -265,12 +265,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|NotificationClick The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -280,13 +280,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -297,24 +297,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -322,7 +325,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -363,12 +366,14 @@ public function getReferer() * Get the [optionally formatted] temporal [timestamp] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getTimestamp($format = null) { @@ -382,8 +387,8 @@ public function getTimestamp($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\NotificationClick The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -397,13 +402,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [notificationid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\NotificationClick The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setNotificationId($v) { @@ -421,13 +426,13 @@ public function setNotificationId($v) } return $this; - } // setNotificationId() + } /** * Set the value of [referer] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\NotificationClick The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setReferer($v) { @@ -441,14 +446,14 @@ public function setReferer($v) } return $this; - } // setReferer() + } /** * Sets the value of [timestamp] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\NotificationClick The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setTimestamp($v) { @@ -461,7 +466,7 @@ public function setTimestamp($v) } // if either are not null return $this; - } // setTimestamp() + } /** * Indicates whether the columns in this object are only set to default values. @@ -469,13 +474,13 @@ public function setTimestamp($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -485,19 +490,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : NotificationClickTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -512,8 +518,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->timestamp = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -521,6 +527,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 4; // 4 = NotificationClickTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\NotificationClick'), 0, $e); } @@ -537,26 +544,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aNotification !== null && $this->notificationid !== $this->aNotification->getId()) { $this->aNotification = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -590,13 +598,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see NotificationClick::setDeleted() * @see NotificationClick::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -626,12 +634,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -651,9 +659,10 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(NotificationClickTableMap::COL_TIMESTAMP)) { - $this->setTimestamp(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setTimestamp($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -681,12 +690,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -716,22 +725,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[NotificationClickTableMap::COL_ID] = true; @@ -765,15 +775,19 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'notificationId': $stmt->bindValue($identifier, $this->notificationid, PDO::PARAM_INT); + break; case 'referer': $stmt->bindValue($identifier, $this->referer, PDO::PARAM_STR); + break; case 'timestamp': $stmt->bindValue($identifier, $this->timestamp ? $this->timestamp->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -796,12 +810,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -812,14 +826,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = NotificationClickTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -831,27 +845,26 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getNotificationId(); - break; + case 2: return $this->getReferer(); - break; + case 3: return $this->getTimestamp(); - break; + default: return null; - break; } // switch() } @@ -861,30 +874,30 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['NotificationClick'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['NotificationClick'][$this->hashCode()] = true; $keys = NotificationClickTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getNotificationId(), $keys[2] => $this->getReferer(), $keys[3] => $this->getTimestamp(), - ); + ]; if ($result[$keys[3]] instanceof \DateTimeInterface) { - $result[$keys[3]] = $result[$keys[3]]->format('c'); + $result[$keys[3]] = $result[$keys[3]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -894,6 +907,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aNotification) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'notification'; @@ -905,7 +919,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Notification'; } - $result[$key] = $this->aNotification->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aNotification->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -915,30 +929,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\NotificationClick + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = NotificationClickTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\NotificationClick + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -971,11 +987,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = NotificationClickTableMap::getFieldNames($keyType); @@ -991,6 +1007,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[3], $arr)) { $this->setTimestamp($arr[$keys[3]]); } + + return $this; } /** @@ -1010,9 +1028,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\NotificationClick The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1026,9 +1044,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(NotificationClickTableMap::DATABASE_NAME); @@ -1052,13 +1070,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildNotificationClickQuery::create(); $criteria->add(NotificationClickTableMap::COL_ID, $this->id); @@ -1070,7 +1088,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1100,19 +1118,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1123,19 +1142,20 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\NotificationClick (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\NotificationClick (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setNotificationId($this->getNotificationId()); $copyObj->setReferer($this->getReferer()); $copyObj->setTimestamp($this->getTimestamp()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1147,11 +1167,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\NotificationClick Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1164,14 +1184,14 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildNotification object. * - * @param ChildNotification $v - * @return $this|\TechWilk\Rota\NotificationClick The current object (for fluent API support) - * @throws PropelException + * @param ChildNotification $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setNotification(ChildNotification $v = null) { if ($v === null) { - $this->setNotificationId(null); + $this->setNotificationId(NULL); } else { $this->setNotificationId($v->getId()); } @@ -1192,11 +1212,11 @@ public function setNotification(ChildNotification $v = null) /** * Get the associated ChildNotification object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildNotification The associated ChildNotification object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getNotification(ConnectionInterface $con = null) + public function getNotification(?ConnectionInterface $con = null) { if ($this->aNotification === null && ($this->notificationid != 0)) { $this->aNotification = ChildNotificationQuery::create()->findPk($this->notificationid, $con); @@ -1216,6 +1236,8 @@ public function getNotification(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1231,6 +1253,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1239,14 +1263,16 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aNotification = null; + return $this; } /** @@ -1261,99 +1287,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1363,7 +1369,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1383,17 +1389,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/NotificationClickQuery.php b/generated-classes/TechWilk/Rota/Base/NotificationClickQuery.php index 346c979f..4e78cdf5 100644 --- a/generated-classes/TechWilk/Rota/Base/NotificationClickQuery.php +++ b/generated-classes/TechWilk/Rota/Base/NotificationClickQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\NotificationClickTableMap; /** - * Base class that represents a query for the 'notificationClicks' table. - * - * + * Base class that represents a query for the `notificationClicks` table. * * @method ChildNotificationClickQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildNotificationClickQuery orderByNotificationId($order = Criteria::ASC) Order by the notificationId column @@ -50,29 +49,36 @@ * * @method \TechWilk\Rota\NotificationQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildNotificationClick findOne(ConnectionInterface $con = null) Return the first ChildNotificationClick matching the query - * @method ChildNotificationClick findOneOrCreate(ConnectionInterface $con = null) Return the first ChildNotificationClick matching the query, or a new ChildNotificationClick object populated from the query conditions when no match is found + * @method ChildNotificationClick|null findOne(?ConnectionInterface $con = null) Return the first ChildNotificationClick matching the query + * @method ChildNotificationClick findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildNotificationClick matching the query, or a new ChildNotificationClick object populated from the query conditions when no match is found * - * @method ChildNotificationClick findOneById(int $id) Return the first ChildNotificationClick filtered by the id column - * @method ChildNotificationClick findOneByNotificationId(int $notificationId) Return the first ChildNotificationClick filtered by the notificationId column - * @method ChildNotificationClick findOneByReferer(string $referer) Return the first ChildNotificationClick filtered by the referer column - * @method ChildNotificationClick findOneByTimestamp(string $timestamp) Return the first ChildNotificationClick filtered by the timestamp column * - - * @method ChildNotificationClick requirePk($key, ConnectionInterface $con = null) Return the ChildNotificationClick by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildNotificationClick requireOne(ConnectionInterface $con = null) Return the first ChildNotificationClick matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildNotificationClick|null findOneById(int $id) Return the first ChildNotificationClick filtered by the id column + * @method ChildNotificationClick|null findOneByNotificationId(int $notificationId) Return the first ChildNotificationClick filtered by the notificationId column + * @method ChildNotificationClick|null findOneByReferer(string $referer) Return the first ChildNotificationClick filtered by the referer column + * @method ChildNotificationClick|null findOneByTimestamp(string $timestamp) Return the first ChildNotificationClick filtered by the timestamp column + * + * @method ChildNotificationClick requirePk($key, ?ConnectionInterface $con = null) Return the ChildNotificationClick by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildNotificationClick requireOne(?ConnectionInterface $con = null) Return the first ChildNotificationClick matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildNotificationClick requireOneById(int $id) Return the first ChildNotificationClick filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildNotificationClick requireOneByNotificationId(int $notificationId) Return the first ChildNotificationClick filtered by the notificationId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildNotificationClick requireOneByReferer(string $referer) Return the first ChildNotificationClick filtered by the referer column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildNotificationClick requireOneByTimestamp(string $timestamp) Return the first ChildNotificationClick filtered by the timestamp column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildNotificationClick[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildNotificationClick objects based on current ModelCriteria - * @method ChildNotificationClick[]|ObjectCollection findById(int $id) Return ChildNotificationClick objects filtered by the id column - * @method ChildNotificationClick[]|ObjectCollection findByNotificationId(int $notificationId) Return ChildNotificationClick objects filtered by the notificationId column - * @method ChildNotificationClick[]|ObjectCollection findByReferer(string $referer) Return ChildNotificationClick objects filtered by the referer column - * @method ChildNotificationClick[]|ObjectCollection findByTimestamp(string $timestamp) Return ChildNotificationClick objects filtered by the timestamp column - * @method ChildNotificationClick[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildNotificationClick[]|Collection find(?ConnectionInterface $con = null) Return ChildNotificationClick objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildNotificationClick objects based on current ModelCriteria + * + * @method ChildNotificationClick[]|Collection findById(int|array $id) Return ChildNotificationClick objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildNotificationClick objects filtered by the id column + * @method ChildNotificationClick[]|Collection findByNotificationId(int|array $notificationId) Return ChildNotificationClick objects filtered by the notificationId column + * @psalm-method Collection&\Traversable findByNotificationId(int|array $notificationId) Return ChildNotificationClick objects filtered by the notificationId column + * @method ChildNotificationClick[]|Collection findByReferer(string|array $referer) Return ChildNotificationClick objects filtered by the referer column + * @psalm-method Collection&\Traversable findByReferer(string|array $referer) Return ChildNotificationClick objects filtered by the referer column + * @method ChildNotificationClick[]|Collection findByTimestamp(string|array $timestamp) Return ChildNotificationClick objects filtered by the timestamp column + * @psalm-method Collection&\Traversable findByTimestamp(string|array $timestamp) Return ChildNotificationClick objects filtered by the timestamp column * + * @method ChildNotificationClick[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class NotificationClickQuery extends ModelCriteria { @@ -81,9 +87,9 @@ abstract class NotificationClickQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\NotificationClickQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\NotificationClick', $modelAlias = null) { @@ -93,12 +99,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildNotificationClickQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildNotificationClickQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildNotificationClickQuery) { return $criteria; @@ -128,7 +134,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildNotificationClick|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -160,8 +166,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -193,8 +199,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildNotificationClick|array|mixed the result, formatted by the current formatter */ @@ -214,12 +220,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -236,25 +242,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(NotificationClickTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(NotificationClickTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(NotificationClickTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(NotificationClickTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -267,15 +279,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -295,7 +307,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(NotificationClickTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(NotificationClickTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -310,15 +324,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByNotification() * - * @param mixed $notificationId The value to use as filter. + * @param mixed $notificationId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotificationId($notificationId = null, $comparison = null) + public function filterByNotificationId($notificationId = null, ?string $comparison = null) { if (is_array($notificationId)) { $useMinMax = false; @@ -338,7 +352,9 @@ public function filterByNotificationId($notificationId = null, $comparison = nul } } - return $this->addUsingAlias(NotificationClickTableMap::COL_NOTIFICATIONID, $notificationId, $comparison); + $this->addUsingAlias(NotificationClickTableMap::COL_NOTIFICATIONID, $notificationId, $comparison); + + return $this; } /** @@ -348,14 +364,15 @@ public function filterByNotificationId($notificationId = null, $comparison = nul * * $query->filterByReferer('fooValue'); // WHERE referer = 'fooValue' * $query->filterByReferer('%fooValue%', Criteria::LIKE); // WHERE referer LIKE '%fooValue%' + * $query->filterByReferer(['foo', 'bar']); // WHERE referer IN ('foo', 'bar') * * - * @param string $referer The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $referer The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByReferer($referer = null, $comparison = null) + public function filterByReferer($referer = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($referer)) { @@ -363,7 +380,9 @@ public function filterByReferer($referer = null, $comparison = null) } } - return $this->addUsingAlias(NotificationClickTableMap::COL_REFERER, $referer, $comparison); + $this->addUsingAlias(NotificationClickTableMap::COL_REFERER, $referer, $comparison); + + return $this; } /** @@ -376,17 +395,17 @@ public function filterByReferer($referer = null, $comparison = null) * $query->filterByTimestamp(array('max' => 'yesterday')); // WHERE timestamp > '2011-03-13' * * - * @param mixed $timestamp The value to use as filter. + * @param mixed $timestamp The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimestamp($timestamp = null, $comparison = null) + public function filterByTimestamp($timestamp = null, ?string $comparison = null) { if (is_array($timestamp)) { $useMinMax = false; @@ -406,20 +425,22 @@ public function filterByTimestamp($timestamp = null, $comparison = null) } } - return $this->addUsingAlias(NotificationClickTableMap::COL_TIMESTAMP, $timestamp, $comparison); + $this->addUsingAlias(NotificationClickTableMap::COL_TIMESTAMP, $timestamp, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Notification object * * @param \TechWilk\Rota\Notification|ObjectCollection $notification The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotification($notification, $comparison = null) + public function filterByNotification($notification, ?string $comparison = null) { if ($notification instanceof \TechWilk\Rota\Notification) { return $this @@ -429,8 +450,10 @@ public function filterByNotification($notification, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(NotificationClickTableMap::COL_NOTIFICATIONID, $notification->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByNotification() only accepts arguments of type \TechWilk\Rota\Notification or Collection'); } @@ -439,12 +462,12 @@ public function filterByNotification($notification, $comparison = null) /** * Adds a JOIN clause to the query using the Notification relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinNotification($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinNotification(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Notification'); @@ -473,9 +496,9 @@ public function joinNotification($relationAlias = null, $joinType = Criteria::IN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\NotificationQuery A secondary query class using the current class as primary query */ @@ -486,12 +509,108 @@ public function useNotificationQuery($relationAlias = null, $joinType = Criteria ->useQuery($relationAlias ? $relationAlias : 'Notification', '\TechWilk\Rota\NotificationQuery'); } + /** + * Use the Notification relation Notification object + * + * @param callable(\TechWilk\Rota\NotificationQuery):\TechWilk\Rota\NotificationQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withNotificationQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useNotificationQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Notification table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the EXISTS statement + */ + public function useNotificationExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useExistsQuery('Notification', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Notification table for a NOT EXISTS query. + * + * @see useNotificationExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the NOT EXISTS statement + */ + public function useNotificationNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useExistsQuery('Notification', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Notification table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the IN statement + */ + public function useInNotificationQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useInQuery('Notification', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Notification table for a NOT IN query. + * + * @see useNotificationInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the NOT IN statement + */ + public function useNotInNotificationQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useInQuery('Notification', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildNotificationClick $notificationClick Object to remove from the list of results + * @param ChildNotificationClick $notificationClick Object to remove from the list of results * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($notificationClick = null) { @@ -508,7 +627,7 @@ public function prune($notificationClick = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(NotificationClickTableMap::DATABASE_NAME); @@ -533,12 +652,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(NotificationClickTableMap::DATABASE_NAME); @@ -568,32 +687,39 @@ public function delete(ConnectionInterface $con = null) /** * Order by create date desc * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(NotificationClickTableMap::COL_TIMESTAMP); + $this->addDescendingOrderByColumn(NotificationClickTableMap::COL_TIMESTAMP); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(NotificationClickTableMap::COL_TIMESTAMP, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(NotificationClickTableMap::COL_TIMESTAMP, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildNotificationClickQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(NotificationClickTableMap::COL_TIMESTAMP); + $this->addAscendingOrderByColumn(NotificationClickTableMap::COL_TIMESTAMP); + + return $this; } -} // NotificationClickQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/NotificationQuery.php b/generated-classes/TechWilk/Rota/Base/NotificationQuery.php index fac5b754..37fc3275 100644 --- a/generated-classes/TechWilk/Rota/Base/NotificationQuery.php +++ b/generated-classes/TechWilk/Rota/Base/NotificationQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\NotificationTableMap; /** - * Base class that represents a query for the 'notifications' table. - * - * + * Base class that represents a query for the `notifications` table. * * @method ChildNotificationQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildNotificationQuery orderByTimestamp($order = Criteria::ASC) Order by the timestamp column @@ -72,22 +71,22 @@ * * @method \TechWilk\Rota\UserQuery|\TechWilk\Rota\NotificationClickQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildNotification findOne(ConnectionInterface $con = null) Return the first ChildNotification matching the query - * @method ChildNotification findOneOrCreate(ConnectionInterface $con = null) Return the first ChildNotification matching the query, or a new ChildNotification object populated from the query conditions when no match is found + * @method ChildNotification|null findOne(?ConnectionInterface $con = null) Return the first ChildNotification matching the query + * @method ChildNotification findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildNotification matching the query, or a new ChildNotification object populated from the query conditions when no match is found * - * @method ChildNotification findOneById(int $id) Return the first ChildNotification filtered by the id column - * @method ChildNotification findOneByTimestamp(string $timestamp) Return the first ChildNotification filtered by the timestamp column - * @method ChildNotification findOneByUserId(int $userId) Return the first ChildNotification filtered by the userId column - * @method ChildNotification findOneBySummary(string $summary) Return the first ChildNotification filtered by the summary column - * @method ChildNotification findOneByBody(string $body) Return the first ChildNotification filtered by the body column - * @method ChildNotification findOneByLink(string $link) Return the first ChildNotification filtered by the link column - * @method ChildNotification findOneByType(int $type) Return the first ChildNotification filtered by the type column - * @method ChildNotification findOneBySeen(boolean $seen) Return the first ChildNotification filtered by the seen column - * @method ChildNotification findOneByDismissed(boolean $dismissed) Return the first ChildNotification filtered by the dismissed column - * @method ChildNotification findOneByArchived(boolean $archived) Return the first ChildNotification filtered by the archived column * - - * @method ChildNotification requirePk($key, ConnectionInterface $con = null) Return the ChildNotification by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildNotification requireOne(ConnectionInterface $con = null) Return the first ChildNotification matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildNotification|null findOneById(int $id) Return the first ChildNotification filtered by the id column + * @method ChildNotification|null findOneByTimestamp(string $timestamp) Return the first ChildNotification filtered by the timestamp column + * @method ChildNotification|null findOneByUserId(int $userId) Return the first ChildNotification filtered by the userId column + * @method ChildNotification|null findOneBySummary(string $summary) Return the first ChildNotification filtered by the summary column + * @method ChildNotification|null findOneByBody(string $body) Return the first ChildNotification filtered by the body column + * @method ChildNotification|null findOneByLink(string $link) Return the first ChildNotification filtered by the link column + * @method ChildNotification|null findOneByType(int $type) Return the first ChildNotification filtered by the type column + * @method ChildNotification|null findOneBySeen(boolean $seen) Return the first ChildNotification filtered by the seen column + * @method ChildNotification|null findOneByDismissed(boolean $dismissed) Return the first ChildNotification filtered by the dismissed column + * @method ChildNotification|null findOneByArchived(boolean $archived) Return the first ChildNotification filtered by the archived column + * + * @method ChildNotification requirePk($key, ?ConnectionInterface $con = null) Return the ChildNotification by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildNotification requireOne(?ConnectionInterface $con = null) Return the first ChildNotification matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildNotification requireOneById(int $id) Return the first ChildNotification filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildNotification requireOneByTimestamp(string $timestamp) Return the first ChildNotification filtered by the timestamp column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -100,19 +99,32 @@ * @method ChildNotification requireOneByDismissed(boolean $dismissed) Return the first ChildNotification filtered by the dismissed column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildNotification requireOneByArchived(boolean $archived) Return the first ChildNotification filtered by the archived column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildNotification[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildNotification objects based on current ModelCriteria - * @method ChildNotification[]|ObjectCollection findById(int $id) Return ChildNotification objects filtered by the id column - * @method ChildNotification[]|ObjectCollection findByTimestamp(string $timestamp) Return ChildNotification objects filtered by the timestamp column - * @method ChildNotification[]|ObjectCollection findByUserId(int $userId) Return ChildNotification objects filtered by the userId column - * @method ChildNotification[]|ObjectCollection findBySummary(string $summary) Return ChildNotification objects filtered by the summary column - * @method ChildNotification[]|ObjectCollection findByBody(string $body) Return ChildNotification objects filtered by the body column - * @method ChildNotification[]|ObjectCollection findByLink(string $link) Return ChildNotification objects filtered by the link column - * @method ChildNotification[]|ObjectCollection findByType(int $type) Return ChildNotification objects filtered by the type column - * @method ChildNotification[]|ObjectCollection findBySeen(boolean $seen) Return ChildNotification objects filtered by the seen column - * @method ChildNotification[]|ObjectCollection findByDismissed(boolean $dismissed) Return ChildNotification objects filtered by the dismissed column - * @method ChildNotification[]|ObjectCollection findByArchived(boolean $archived) Return ChildNotification objects filtered by the archived column - * @method ChildNotification[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildNotification[]|Collection find(?ConnectionInterface $con = null) Return ChildNotification objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildNotification objects based on current ModelCriteria + * + * @method ChildNotification[]|Collection findById(int|array $id) Return ChildNotification objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildNotification objects filtered by the id column + * @method ChildNotification[]|Collection findByTimestamp(string|array $timestamp) Return ChildNotification objects filtered by the timestamp column + * @psalm-method Collection&\Traversable findByTimestamp(string|array $timestamp) Return ChildNotification objects filtered by the timestamp column + * @method ChildNotification[]|Collection findByUserId(int|array $userId) Return ChildNotification objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserId(int|array $userId) Return ChildNotification objects filtered by the userId column + * @method ChildNotification[]|Collection findBySummary(string|array $summary) Return ChildNotification objects filtered by the summary column + * @psalm-method Collection&\Traversable findBySummary(string|array $summary) Return ChildNotification objects filtered by the summary column + * @method ChildNotification[]|Collection findByBody(string|array $body) Return ChildNotification objects filtered by the body column + * @psalm-method Collection&\Traversable findByBody(string|array $body) Return ChildNotification objects filtered by the body column + * @method ChildNotification[]|Collection findByLink(string|array $link) Return ChildNotification objects filtered by the link column + * @psalm-method Collection&\Traversable findByLink(string|array $link) Return ChildNotification objects filtered by the link column + * @method ChildNotification[]|Collection findByType(int|array $type) Return ChildNotification objects filtered by the type column + * @psalm-method Collection&\Traversable findByType(int|array $type) Return ChildNotification objects filtered by the type column + * @method ChildNotification[]|Collection findBySeen(boolean|array $seen) Return ChildNotification objects filtered by the seen column + * @psalm-method Collection&\Traversable findBySeen(boolean|array $seen) Return ChildNotification objects filtered by the seen column + * @method ChildNotification[]|Collection findByDismissed(boolean|array $dismissed) Return ChildNotification objects filtered by the dismissed column + * @psalm-method Collection&\Traversable findByDismissed(boolean|array $dismissed) Return ChildNotification objects filtered by the dismissed column + * @method ChildNotification[]|Collection findByArchived(boolean|array $archived) Return ChildNotification objects filtered by the archived column + * @psalm-method Collection&\Traversable findByArchived(boolean|array $archived) Return ChildNotification objects filtered by the archived column * + * @method ChildNotification[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class NotificationQuery extends ModelCriteria { @@ -121,9 +133,9 @@ abstract class NotificationQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\NotificationQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Notification', $modelAlias = null) { @@ -133,12 +145,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildNotificationQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildNotificationQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildNotificationQuery) { return $criteria; @@ -168,7 +180,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildNotification|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -200,8 +212,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -233,8 +245,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildNotification|array|mixed the result, formatted by the current formatter */ @@ -254,12 +266,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -276,25 +288,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(NotificationTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(NotificationTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(NotificationTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(NotificationTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -307,15 +325,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -335,7 +353,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -348,17 +368,17 @@ public function filterById($id = null, $comparison = null) * $query->filterByTimestamp(array('max' => 'yesterday')); // WHERE timestamp > '2011-03-13' * * - * @param mixed $timestamp The value to use as filter. + * @param mixed $timestamp The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimestamp($timestamp = null, $comparison = null) + public function filterByTimestamp($timestamp = null, ?string $comparison = null) { if (is_array($timestamp)) { $useMinMax = false; @@ -378,7 +398,9 @@ public function filterByTimestamp($timestamp = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_TIMESTAMP, $timestamp, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_TIMESTAMP, $timestamp, $comparison); + + return $this; } /** @@ -393,15 +415,15 @@ public function filterByTimestamp($timestamp = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -421,7 +443,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -431,14 +455,15 @@ public function filterByUserId($userId = null, $comparison = null) * * $query->filterBySummary('fooValue'); // WHERE summary = 'fooValue' * $query->filterBySummary('%fooValue%', Criteria::LIKE); // WHERE summary LIKE '%fooValue%' + * $query->filterBySummary(['foo', 'bar']); // WHERE summary IN ('foo', 'bar') * * - * @param string $summary The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $summary The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySummary($summary = null, $comparison = null) + public function filterBySummary($summary = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($summary)) { @@ -446,7 +471,9 @@ public function filterBySummary($summary = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_SUMMARY, $summary, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_SUMMARY, $summary, $comparison); + + return $this; } /** @@ -456,14 +483,15 @@ public function filterBySummary($summary = null, $comparison = null) * * $query->filterByBody('fooValue'); // WHERE body = 'fooValue' * $query->filterByBody('%fooValue%', Criteria::LIKE); // WHERE body LIKE '%fooValue%' + * $query->filterByBody(['foo', 'bar']); // WHERE body IN ('foo', 'bar') * * - * @param string $body The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $body The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByBody($body = null, $comparison = null) + public function filterByBody($body = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($body)) { @@ -471,7 +499,9 @@ public function filterByBody($body = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_BODY, $body, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_BODY, $body, $comparison); + + return $this; } /** @@ -481,14 +511,15 @@ public function filterByBody($body = null, $comparison = null) * * $query->filterByLink('fooValue'); // WHERE link = 'fooValue' * $query->filterByLink('%fooValue%', Criteria::LIKE); // WHERE link LIKE '%fooValue%' + * $query->filterByLink(['foo', 'bar']); // WHERE link IN ('foo', 'bar') * * - * @param string $link The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $link The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLink($link = null, $comparison = null) + public function filterByLink($link = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($link)) { @@ -496,7 +527,9 @@ public function filterByLink($link = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_LINK, $link, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_LINK, $link, $comparison); + + return $this; } /** @@ -509,15 +542,15 @@ public function filterByLink($link = null, $comparison = null) * $query->filterByType(array('min' => 12)); // WHERE type > 12 * * - * @param mixed $type The value to use as filter. + * @param mixed $type The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByType($type = null, $comparison = null) + public function filterByType($type = null, ?string $comparison = null) { if (is_array($type)) { $useMinMax = false; @@ -537,7 +570,9 @@ public function filterByType($type = null, $comparison = null) } } - return $this->addUsingAlias(NotificationTableMap::COL_TYPE, $type, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_TYPE, $type, $comparison); + + return $this; } /** @@ -549,22 +584,24 @@ public function filterByType($type = null, $comparison = null) * $query->filterBySeen('yes'); // WHERE seen = true * * - * @param boolean|string $seen The value to use as filter. + * @param bool|string $seen The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySeen($seen = null, $comparison = null) + public function filterBySeen($seen = null, ?string $comparison = null) { if (is_string($seen)) { - $seen = in_array(strtolower($seen), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $seen = in_array(strtolower($seen), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(NotificationTableMap::COL_SEEN, $seen, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_SEEN, $seen, $comparison); + + return $this; } /** @@ -576,22 +613,24 @@ public function filterBySeen($seen = null, $comparison = null) * $query->filterByDismissed('yes'); // WHERE dismissed = true * * - * @param boolean|string $dismissed The value to use as filter. + * @param bool|string $dismissed The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDismissed($dismissed = null, $comparison = null) + public function filterByDismissed($dismissed = null, ?string $comparison = null) { if (is_string($dismissed)) { - $dismissed = in_array(strtolower($dismissed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $dismissed = in_array(strtolower($dismissed), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(NotificationTableMap::COL_DISMISSED, $dismissed, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_DISMISSED, $dismissed, $comparison); + + return $this; } /** @@ -603,35 +642,37 @@ public function filterByDismissed($dismissed = null, $comparison = null) * $query->filterByArchived('yes'); // WHERE archived = true * * - * @param boolean|string $archived The value to use as filter. + * @param bool|string $archived The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByArchived($archived = null, $comparison = null) + public function filterByArchived($archived = null, ?string $comparison = null) { if (is_string($archived)) { - $archived = in_array(strtolower($archived), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $archived = in_array(strtolower($archived), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(NotificationTableMap::COL_ARCHIVED, $archived, $comparison); + $this->addUsingAlias(NotificationTableMap::COL_ARCHIVED, $archived, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -641,8 +682,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(NotificationTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -651,12 +694,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -685,9 +728,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -698,24 +741,124 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\NotificationClick object * * @param \TechWilk\Rota\NotificationClick|ObjectCollection $notificationClick the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotificationClick($notificationClick, $comparison = null) + public function filterByNotificationClick($notificationClick, ?string $comparison = null) { if ($notificationClick instanceof \TechWilk\Rota\NotificationClick) { - return $this + $this ->addUsingAlias(NotificationTableMap::COL_ID, $notificationClick->getNotificationId(), $comparison); + + return $this; } elseif ($notificationClick instanceof ObjectCollection) { - return $this + $this ->useNotificationClickQuery() ->filterByPrimaryKeys($notificationClick->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByNotificationClick() only accepts arguments of type \TechWilk\Rota\NotificationClick or Collection'); } @@ -724,12 +867,12 @@ public function filterByNotificationClick($notificationClick, $comparison = null /** * Adds a JOIN clause to the query using the NotificationClick relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinNotificationClick($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinNotificationClick(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('NotificationClick'); @@ -758,9 +901,9 @@ public function joinNotificationClick($relationAlias = null, $joinType = Criteri * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\NotificationClickQuery A secondary query class using the current class as primary query */ @@ -771,12 +914,108 @@ public function useNotificationClickQuery($relationAlias = null, $joinType = Cri ->useQuery($relationAlias ? $relationAlias : 'NotificationClick', '\TechWilk\Rota\NotificationClickQuery'); } + /** + * Use the NotificationClick relation NotificationClick object + * + * @param callable(\TechWilk\Rota\NotificationClickQuery):\TechWilk\Rota\NotificationClickQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withNotificationClickQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useNotificationClickQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to NotificationClick table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\NotificationClickQuery The inner query object of the EXISTS statement + */ + public function useNotificationClickExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\NotificationClickQuery */ + $q = $this->useExistsQuery('NotificationClick', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to NotificationClick table for a NOT EXISTS query. + * + * @see useNotificationClickExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\NotificationClickQuery The inner query object of the NOT EXISTS statement + */ + public function useNotificationClickNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\NotificationClickQuery */ + $q = $this->useExistsQuery('NotificationClick', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to NotificationClick table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\NotificationClickQuery The inner query object of the IN statement + */ + public function useInNotificationClickQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\NotificationClickQuery */ + $q = $this->useInQuery('NotificationClick', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to NotificationClick table for a NOT IN query. + * + * @see useNotificationClickInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\NotificationClickQuery The inner query object of the NOT IN statement + */ + public function useNotInNotificationClickQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\NotificationClickQuery */ + $q = $this->useInQuery('NotificationClick', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildNotification $notification Object to remove from the list of results + * @param ChildNotification $notification Object to remove from the list of results * - * @return $this|ChildNotificationQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($notification = null) { @@ -793,7 +1032,7 @@ public function prune($notification = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(NotificationTableMap::DATABASE_NAME); @@ -818,12 +1057,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(NotificationTableMap::DATABASE_NAME); @@ -847,4 +1086,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // NotificationQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/PendingUser.php b/generated-classes/TechWilk/Rota/Base/PendingUser.php index 4436b6c5..375941e1 100644 --- a/generated-classes/TechWilk/Rota/Base/PendingUser.php +++ b/generated-classes/TechWilk/Rota/Base/PendingUser.php @@ -29,19 +29,21 @@ abstract class PendingUser implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PendingUserTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PendingUserTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -50,14 +52,14 @@ abstract class PendingUser implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -69,7 +71,7 @@ abstract class PendingUser implements ActiveRecordInterface /** * The value for the socialid field. * - * @var string + * @var string|null */ protected $socialid; @@ -121,7 +123,7 @@ abstract class PendingUser implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -131,7 +133,7 @@ abstract class PendingUser implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->approved = false; $this->declined = false; @@ -149,9 +151,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -159,10 +161,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -171,7 +173,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -181,9 +183,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -192,45 +194,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -239,10 +239,10 @@ public function resetModified($col = null) * obj is an instance of PendingUser, delegates to * equals(PendingUser). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -264,7 +264,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -272,10 +272,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -283,15 +283,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -300,12 +300,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|PendingUser The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -315,13 +315,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -332,24 +332,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -357,7 +360,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -377,7 +380,7 @@ public function getId() /** * Get the [socialid] column value. * - * @return string + * @return string|null */ public function getSocialId() { @@ -467,8 +470,8 @@ public function getSource() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -482,13 +485,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [socialid] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setSocialId($v) { @@ -502,13 +505,13 @@ public function setSocialId($v) } return $this; - } // setSocialId() + } /** * Set the value of [firstname] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setFirstName($v) { @@ -522,13 +525,13 @@ public function setFirstName($v) } return $this; - } // setFirstName() + } /** * Set the value of [lastname] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setLastName($v) { @@ -542,13 +545,13 @@ public function setLastName($v) } return $this; - } // setLastName() + } /** * Set the value of [email] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setEmail($v) { @@ -562,7 +565,7 @@ public function setEmail($v) } return $this; - } // setEmail() + } /** * Sets the value of the [approved] column. @@ -571,8 +574,8 @@ public function setEmail($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setApproved($v) { @@ -590,7 +593,7 @@ public function setApproved($v) } return $this; - } // setApproved() + } /** * Sets the value of the [declined] column. @@ -599,8 +602,8 @@ public function setApproved($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setDeclined($v) { @@ -618,13 +621,13 @@ public function setDeclined($v) } return $this; - } // setDeclined() + } /** * Set the value of [source] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PendingUser The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setSource($v) { @@ -638,7 +641,7 @@ public function setSource($v) } return $this; - } // setSource() + } /** * Indicates whether the columns in this object are only set to default values. @@ -646,21 +649,21 @@ public function setSource($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->approved !== false) { - return false; - } + if ($this->approved !== false) { + return false; + } - if ($this->declined !== false) { - return false; - } + if ($this->declined !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -670,19 +673,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : PendingUserTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -706,8 +710,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : PendingUserTableMap::translateFieldName('Source', TableMap::TYPE_PHPNAME, $indexType)]; $this->source = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -715,6 +719,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 8; // 8 = PendingUserTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\PendingUser'), 0, $e); } @@ -731,23 +736,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -773,19 +779,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see PendingUser::setDeleted() * @see PendingUser::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -815,12 +822,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -865,12 +872,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -888,22 +895,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[PendingUserTableMap::COL_ID] = true; @@ -949,27 +957,35 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'socialId': $stmt->bindValue($identifier, $this->socialid, PDO::PARAM_INT); + break; case 'firstName': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); + break; case 'lastName': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); + break; case 'email': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); + break; case 'approved': $stmt->bindValue($identifier, (int) $this->approved, PDO::PARAM_INT); + break; case 'declined': $stmt->bindValue($identifier, (int) $this->declined, PDO::PARAM_INT); + break; case 'source': $stmt->bindValue($identifier, $this->source, PDO::PARAM_STR); + break; } } @@ -992,12 +1008,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1008,14 +1024,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = PendingUserTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1027,39 +1043,38 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getSocialId(); - break; + case 2: return $this->getFirstName(); - break; + case 3: return $this->getLastName(); - break; + case 4: return $this->getEmail(); - break; + case 5: return $this->getApproved(); - break; + case 6: return $this->getDeclined(); - break; + case 7: return $this->getSource(); - break; + default: return null; - break; } // switch() } @@ -1069,22 +1084,22 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array()) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = []): array { if (isset($alreadyDumpedObjects['PendingUser'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['PendingUser'][$this->hashCode()] = true; $keys = PendingUserTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getSocialId(), $keys[2] => $this->getFirstName(), @@ -1093,7 +1108,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[5] => $this->getApproved(), $keys[6] => $this->getDeclined(), $keys[7] => $this->getSource(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -1106,30 +1121,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\PendingUser + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = PendingUserTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\PendingUser + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1174,11 +1191,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = PendingUserTableMap::getFieldNames($keyType); @@ -1206,6 +1223,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[7], $arr)) { $this->setSource($arr[$keys[7]]); } + + return $this; } /** @@ -1225,9 +1244,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\PendingUser The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1241,9 +1260,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(PendingUserTableMap::DATABASE_NAME); @@ -1279,13 +1298,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildPendingUserQuery::create(); $criteria->add(PendingUserTableMap::COL_ID, $this->id); @@ -1297,7 +1316,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1327,19 +1346,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1350,12 +1370,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\PendingUser (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\PendingUser (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setSocialId($this->getSocialId()); $copyObj->setFirstName($this->getFirstName()); @@ -1366,7 +1387,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setSource($this->getSource()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1378,11 +1399,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\PendingUser Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1396,6 +1417,8 @@ public function copy($deepCopy = false) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1413,6 +1436,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1421,12 +1446,15 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) + + return $this; } /** @@ -1441,99 +1469,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1543,7 +1551,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1563,17 +1571,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/PendingUserQuery.php b/generated-classes/TechWilk/Rota/Base/PendingUserQuery.php index 5d993418..c42da11d 100644 --- a/generated-classes/TechWilk/Rota/Base/PendingUserQuery.php +++ b/generated-classes/TechWilk/Rota/Base/PendingUserQuery.php @@ -7,7 +7,7 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\Collection\ObjectCollection; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; use TechWilk\Rota\PendingUser as ChildPendingUser; @@ -15,9 +15,7 @@ use TechWilk\Rota\Map\PendingUserTableMap; /** - * Base class that represents a query for the 'pendingUsers' table. - * - * + * Base class that represents a query for the `pendingUsers` table. * * @method ChildPendingUserQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildPendingUserQuery orderBySocialId($order = Criteria::ASC) Order by the socialId column @@ -45,20 +43,20 @@ * @method ChildPendingUserQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query * @method ChildPendingUserQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query * - * @method ChildPendingUser findOne(ConnectionInterface $con = null) Return the first ChildPendingUser matching the query - * @method ChildPendingUser findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPendingUser matching the query, or a new ChildPendingUser object populated from the query conditions when no match is found + * @method ChildPendingUser|null findOne(?ConnectionInterface $con = null) Return the first ChildPendingUser matching the query + * @method ChildPendingUser findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildPendingUser matching the query, or a new ChildPendingUser object populated from the query conditions when no match is found * - * @method ChildPendingUser findOneById(int $id) Return the first ChildPendingUser filtered by the id column - * @method ChildPendingUser findOneBySocialId(string $socialId) Return the first ChildPendingUser filtered by the socialId column - * @method ChildPendingUser findOneByFirstName(string $firstName) Return the first ChildPendingUser filtered by the firstName column - * @method ChildPendingUser findOneByLastName(string $lastName) Return the first ChildPendingUser filtered by the lastName column - * @method ChildPendingUser findOneByEmail(string $email) Return the first ChildPendingUser filtered by the email column - * @method ChildPendingUser findOneByApproved(boolean $approved) Return the first ChildPendingUser filtered by the approved column - * @method ChildPendingUser findOneByDeclined(boolean $declined) Return the first ChildPendingUser filtered by the declined column - * @method ChildPendingUser findOneBySource(string $source) Return the first ChildPendingUser filtered by the source column * - - * @method ChildPendingUser requirePk($key, ConnectionInterface $con = null) Return the ChildPendingUser by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildPendingUser requireOne(ConnectionInterface $con = null) Return the first ChildPendingUser matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPendingUser|null findOneById(int $id) Return the first ChildPendingUser filtered by the id column + * @method ChildPendingUser|null findOneBySocialId(string $socialId) Return the first ChildPendingUser filtered by the socialId column + * @method ChildPendingUser|null findOneByFirstName(string $firstName) Return the first ChildPendingUser filtered by the firstName column + * @method ChildPendingUser|null findOneByLastName(string $lastName) Return the first ChildPendingUser filtered by the lastName column + * @method ChildPendingUser|null findOneByEmail(string $email) Return the first ChildPendingUser filtered by the email column + * @method ChildPendingUser|null findOneByApproved(boolean $approved) Return the first ChildPendingUser filtered by the approved column + * @method ChildPendingUser|null findOneByDeclined(boolean $declined) Return the first ChildPendingUser filtered by the declined column + * @method ChildPendingUser|null findOneBySource(string $source) Return the first ChildPendingUser filtered by the source column + * + * @method ChildPendingUser requirePk($key, ?ConnectionInterface $con = null) Return the ChildPendingUser by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPendingUser requireOne(?ConnectionInterface $con = null) Return the first ChildPendingUser matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildPendingUser requireOneById(int $id) Return the first ChildPendingUser filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPendingUser requireOneBySocialId(string $socialId) Return the first ChildPendingUser filtered by the socialId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -69,17 +67,28 @@ * @method ChildPendingUser requireOneByDeclined(boolean $declined) Return the first ChildPendingUser filtered by the declined column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPendingUser requireOneBySource(string $source) Return the first ChildPendingUser filtered by the source column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildPendingUser[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildPendingUser objects based on current ModelCriteria - * @method ChildPendingUser[]|ObjectCollection findById(int $id) Return ChildPendingUser objects filtered by the id column - * @method ChildPendingUser[]|ObjectCollection findBySocialId(string $socialId) Return ChildPendingUser objects filtered by the socialId column - * @method ChildPendingUser[]|ObjectCollection findByFirstName(string $firstName) Return ChildPendingUser objects filtered by the firstName column - * @method ChildPendingUser[]|ObjectCollection findByLastName(string $lastName) Return ChildPendingUser objects filtered by the lastName column - * @method ChildPendingUser[]|ObjectCollection findByEmail(string $email) Return ChildPendingUser objects filtered by the email column - * @method ChildPendingUser[]|ObjectCollection findByApproved(boolean $approved) Return ChildPendingUser objects filtered by the approved column - * @method ChildPendingUser[]|ObjectCollection findByDeclined(boolean $declined) Return ChildPendingUser objects filtered by the declined column - * @method ChildPendingUser[]|ObjectCollection findBySource(string $source) Return ChildPendingUser objects filtered by the source column - * @method ChildPendingUser[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildPendingUser[]|Collection find(?ConnectionInterface $con = null) Return ChildPendingUser objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildPendingUser objects based on current ModelCriteria + * + * @method ChildPendingUser[]|Collection findById(int|array $id) Return ChildPendingUser objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildPendingUser objects filtered by the id column + * @method ChildPendingUser[]|Collection findBySocialId(string|array $socialId) Return ChildPendingUser objects filtered by the socialId column + * @psalm-method Collection&\Traversable findBySocialId(string|array $socialId) Return ChildPendingUser objects filtered by the socialId column + * @method ChildPendingUser[]|Collection findByFirstName(string|array $firstName) Return ChildPendingUser objects filtered by the firstName column + * @psalm-method Collection&\Traversable findByFirstName(string|array $firstName) Return ChildPendingUser objects filtered by the firstName column + * @method ChildPendingUser[]|Collection findByLastName(string|array $lastName) Return ChildPendingUser objects filtered by the lastName column + * @psalm-method Collection&\Traversable findByLastName(string|array $lastName) Return ChildPendingUser objects filtered by the lastName column + * @method ChildPendingUser[]|Collection findByEmail(string|array $email) Return ChildPendingUser objects filtered by the email column + * @psalm-method Collection&\Traversable findByEmail(string|array $email) Return ChildPendingUser objects filtered by the email column + * @method ChildPendingUser[]|Collection findByApproved(boolean|array $approved) Return ChildPendingUser objects filtered by the approved column + * @psalm-method Collection&\Traversable findByApproved(boolean|array $approved) Return ChildPendingUser objects filtered by the approved column + * @method ChildPendingUser[]|Collection findByDeclined(boolean|array $declined) Return ChildPendingUser objects filtered by the declined column + * @psalm-method Collection&\Traversable findByDeclined(boolean|array $declined) Return ChildPendingUser objects filtered by the declined column + * @method ChildPendingUser[]|Collection findBySource(string|array $source) Return ChildPendingUser objects filtered by the source column + * @psalm-method Collection&\Traversable findBySource(string|array $source) Return ChildPendingUser objects filtered by the source column * + * @method ChildPendingUser[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class PendingUserQuery extends ModelCriteria { @@ -88,9 +97,9 @@ abstract class PendingUserQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\PendingUserQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\PendingUser', $modelAlias = null) { @@ -100,12 +109,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildPendingUserQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildPendingUserQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildPendingUserQuery) { return $criteria; @@ -135,7 +144,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildPendingUser|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -167,8 +176,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -200,8 +209,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildPendingUser|array|mixed the result, formatted by the current formatter */ @@ -221,12 +230,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -243,25 +252,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(PendingUserTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(PendingUserTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(PendingUserTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(PendingUserTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -274,15 +289,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -302,7 +317,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(PendingUserTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -315,15 +332,15 @@ public function filterById($id = null, $comparison = null) * $query->filterBySocialId(array('min' => 12)); // WHERE socialId > 12 * * - * @param mixed $socialId The value to use as filter. + * @param mixed $socialId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySocialId($socialId = null, $comparison = null) + public function filterBySocialId($socialId = null, ?string $comparison = null) { if (is_array($socialId)) { $useMinMax = false; @@ -343,7 +360,9 @@ public function filterBySocialId($socialId = null, $comparison = null) } } - return $this->addUsingAlias(PendingUserTableMap::COL_SOCIALID, $socialId, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_SOCIALID, $socialId, $comparison); + + return $this; } /** @@ -353,14 +372,15 @@ public function filterBySocialId($socialId = null, $comparison = null) * * $query->filterByFirstName('fooValue'); // WHERE firstName = 'fooValue' * $query->filterByFirstName('%fooValue%', Criteria::LIKE); // WHERE firstName LIKE '%fooValue%' + * $query->filterByFirstName(['foo', 'bar']); // WHERE firstName IN ('foo', 'bar') * * - * @param string $firstName The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $firstName The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByFirstName($firstName = null, $comparison = null) + public function filterByFirstName($firstName = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($firstName)) { @@ -368,7 +388,9 @@ public function filterByFirstName($firstName = null, $comparison = null) } } - return $this->addUsingAlias(PendingUserTableMap::COL_FIRSTNAME, $firstName, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_FIRSTNAME, $firstName, $comparison); + + return $this; } /** @@ -378,14 +400,15 @@ public function filterByFirstName($firstName = null, $comparison = null) * * $query->filterByLastName('fooValue'); // WHERE lastName = 'fooValue' * $query->filterByLastName('%fooValue%', Criteria::LIKE); // WHERE lastName LIKE '%fooValue%' + * $query->filterByLastName(['foo', 'bar']); // WHERE lastName IN ('foo', 'bar') * * - * @param string $lastName The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $lastName The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLastName($lastName = null, $comparison = null) + public function filterByLastName($lastName = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($lastName)) { @@ -393,7 +416,9 @@ public function filterByLastName($lastName = null, $comparison = null) } } - return $this->addUsingAlias(PendingUserTableMap::COL_LASTNAME, $lastName, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_LASTNAME, $lastName, $comparison); + + return $this; } /** @@ -403,14 +428,15 @@ public function filterByLastName($lastName = null, $comparison = null) * * $query->filterByEmail('fooValue'); // WHERE email = 'fooValue' * $query->filterByEmail('%fooValue%', Criteria::LIKE); // WHERE email LIKE '%fooValue%' + * $query->filterByEmail(['foo', 'bar']); // WHERE email IN ('foo', 'bar') * * - * @param string $email The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $email The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEmail($email = null, $comparison = null) + public function filterByEmail($email = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($email)) { @@ -418,7 +444,9 @@ public function filterByEmail($email = null, $comparison = null) } } - return $this->addUsingAlias(PendingUserTableMap::COL_EMAIL, $email, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_EMAIL, $email, $comparison); + + return $this; } /** @@ -430,22 +458,24 @@ public function filterByEmail($email = null, $comparison = null) * $query->filterByApproved('yes'); // WHERE approved = true * * - * @param boolean|string $approved The value to use as filter. + * @param bool|string $approved The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByApproved($approved = null, $comparison = null) + public function filterByApproved($approved = null, ?string $comparison = null) { if (is_string($approved)) { - $approved = in_array(strtolower($approved), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $approved = in_array(strtolower($approved), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(PendingUserTableMap::COL_APPROVED, $approved, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_APPROVED, $approved, $comparison); + + return $this; } /** @@ -457,22 +487,24 @@ public function filterByApproved($approved = null, $comparison = null) * $query->filterByDeclined('yes'); // WHERE declined = true * * - * @param boolean|string $declined The value to use as filter. + * @param bool|string $declined The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDeclined($declined = null, $comparison = null) + public function filterByDeclined($declined = null, ?string $comparison = null) { if (is_string($declined)) { - $declined = in_array(strtolower($declined), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $declined = in_array(strtolower($declined), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(PendingUserTableMap::COL_DECLINED, $declined, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_DECLINED, $declined, $comparison); + + return $this; } /** @@ -482,14 +514,15 @@ public function filterByDeclined($declined = null, $comparison = null) * * $query->filterBySource('fooValue'); // WHERE source = 'fooValue' * $query->filterBySource('%fooValue%', Criteria::LIKE); // WHERE source LIKE '%fooValue%' + * $query->filterBySource(['foo', 'bar']); // WHERE source IN ('foo', 'bar') * * - * @param string $source The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $source The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySource($source = null, $comparison = null) + public function filterBySource($source = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($source)) { @@ -497,15 +530,17 @@ public function filterBySource($source = null, $comparison = null) } } - return $this->addUsingAlias(PendingUserTableMap::COL_SOURCE, $source, $comparison); + $this->addUsingAlias(PendingUserTableMap::COL_SOURCE, $source, $comparison); + + return $this; } /** * Exclude object from result * - * @param ChildPendingUser $pendingUser Object to remove from the list of results + * @param ChildPendingUser $pendingUser Object to remove from the list of results * - * @return $this|ChildPendingUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($pendingUser = null) { @@ -522,7 +557,7 @@ public function prune($pendingUser = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PendingUserTableMap::DATABASE_NAME); @@ -547,12 +582,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PendingUserTableMap::DATABASE_NAME); @@ -576,4 +611,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // PendingUserQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Permission.php b/generated-classes/TechWilk/Rota/Base/Permission.php index c4026121..4b914a61 100644 --- a/generated-classes/TechWilk/Rota/Base/Permission.php +++ b/generated-classes/TechWilk/Rota/Base/Permission.php @@ -37,19 +37,21 @@ abstract class Permission implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PermissionTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PermissionTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -58,14 +60,14 @@ abstract class Permission implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -77,14 +79,14 @@ abstract class Permission implements ActiveRecordInterface /** * The value for the name field. * - * @var string + * @var string|null */ protected $name; /** * The value for the description field. * - * @var string + * @var string|null */ protected $description; @@ -97,12 +99,14 @@ abstract class Permission implements ActiveRecordInterface /** * @var ObjectCollection|ChildUserPermission[] Collection to store aggregation of ChildUserPermission objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildUserPermission objects. */ protected $collUserPermissions; protected $collUserPermissionsPartial; /** * @var ObjectCollection|ChildPermissionGroupPermission[] Collection to store aggregation of ChildPermissionGroupPermission objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildPermissionGroupPermission objects. */ protected $collPermissionGroupPermissions; protected $collPermissionGroupPermissionsPartial; @@ -111,19 +115,21 @@ abstract class Permission implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildUserPermission[] + * @phpstan-var ObjectCollection&\Traversable */ protected $userPermissionsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildPermissionGroupPermission[] + * @phpstan-var ObjectCollection&\Traversable */ protected $permissionGroupPermissionsScheduledForDeletion = null; @@ -137,9 +143,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -147,10 +153,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -159,7 +165,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -169,9 +175,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -180,45 +186,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -227,10 +231,10 @@ public function resetModified($col = null) * obj is an instance of Permission, delegates to * equals(Permission). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -252,7 +256,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -260,10 +264,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -271,15 +275,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -288,12 +292,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Permission The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -303,13 +307,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -320,24 +324,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -345,7 +352,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -365,7 +372,7 @@ public function getId() /** * Get the [name] column value. * - * @return string + * @return string|null */ public function getName() { @@ -375,7 +382,7 @@ public function getName() /** * Get the [description] column value. * - * @return string + * @return string|null */ public function getDescription() { @@ -395,8 +402,8 @@ public function getSlug() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Permission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -410,13 +417,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Permission The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -430,13 +437,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Permission The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -450,13 +457,13 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Set the value of [slug] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Permission The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setSlug($v) { @@ -470,7 +477,7 @@ public function setSlug($v) } return $this; - } // setSlug() + } /** * Indicates whether the columns in this object are only set to default values. @@ -478,13 +485,13 @@ public function setSlug($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -494,19 +501,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : PermissionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -518,8 +526,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : PermissionTableMap::translateFieldName('Slug', TableMap::TYPE_PHPNAME, $indexType)]; $this->slug = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -527,6 +535,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 4; // 4 = PermissionTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Permission'), 0, $e); } @@ -543,23 +552,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -589,19 +599,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->collUserPermissions = null; $this->collPermissionGroupPermissions = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Permission::setDeleted() * @see Permission::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -631,12 +642,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -681,12 +692,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -738,22 +749,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[PermissionTableMap::COL_ID] = true; @@ -784,15 +796,19 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'slug': $stmt->bindValue($identifier, $this->slug, PDO::PARAM_STR); + break; } } @@ -817,12 +833,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -833,14 +849,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = PermissionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -852,27 +868,26 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getDescription(); - break; + case 3: return $this->getSlug(); - break; + default: return null; - break; } // switch() } @@ -882,28 +897,28 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Permission'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Permission'][$this->hashCode()] = true; $keys = PermissionTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getDescription(), $keys[3] => $this->getSlug(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -911,6 +926,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collUserPermissions) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userPermissions'; @@ -925,6 +941,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collUserPermissions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collPermissionGroupPermissions) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'permissionGroupPermissions'; @@ -946,30 +963,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Permission + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = PermissionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Permission + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1002,11 +1021,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = PermissionTableMap::getFieldNames($keyType); @@ -1022,6 +1041,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[3], $arr)) { $this->setSlug($arr[$keys[3]]); } + + return $this; } /** @@ -1041,9 +1062,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Permission The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1057,9 +1078,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(PermissionTableMap::DATABASE_NAME); @@ -1083,13 +1104,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildPermissionQuery::create(); $criteria->add(PermissionTableMap::COL_ID, $this->id); @@ -1101,7 +1122,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1131,19 +1152,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1154,12 +1176,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Permission (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Permission (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setDescription($this->getDescription()); @@ -1181,11 +1204,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addPermissionGroupPermission($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1197,11 +1221,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Permission Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1217,16 +1241,16 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('UserPermission' == $relationName) { + if ('UserPermission' === $relationName) { $this->initUserPermissions(); return; } - if ('PermissionGroupPermission' == $relationName) { + if ('PermissionGroupPermission' === $relationName) { $this->initPermissionGroupPermissions(); return; } @@ -1238,18 +1262,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addUserPermissions() + * @return $this + * @see addUserPermissions() */ public function clearUserPermissions() { $this->collUserPermissions = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collUserPermissions collection loaded partially. + * + * @return void */ - public function resetPartialUserPermissions($v = true) + public function resetPartialUserPermissions($v = true): void { $this->collUserPermissionsPartial = $v; } @@ -1261,12 +1289,12 @@ public function resetPartialUserPermissions($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initUserPermissions($overrideExisting = true) + public function initUserPermissions(bool $overrideExisting = true): void { if (null !== $this->collUserPermissions && !$overrideExisting) { return; @@ -1287,18 +1315,28 @@ public function initUserPermissions($overrideExisting = true) * If this ChildPermission is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildUserPermission[] List of ChildUserPermission objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildUserPermission objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUserPermissions(Criteria $criteria = null, ConnectionInterface $con = null) + public function getUserPermissions(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collUserPermissionsPartial && !$this->isNew(); - if (null === $this->collUserPermissions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collUserPermissions) { + if (null === $this->collUserPermissions || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initUserPermissions(); + if (null === $this->collUserPermissions) { + $this->initUserPermissions(); + } else { + $collectionClassName = UserPermissionTableMap::getTableMap()->getCollectionClassName(); + + $collUserPermissions = new $collectionClassName; + $collUserPermissions->setModel('\TechWilk\Rota\UserPermission'); + + return $collUserPermissions; + } } else { $collUserPermissions = ChildUserPermissionQuery::create(null, $criteria) ->filterByPermission($this) @@ -1342,11 +1380,11 @@ public function getUserPermissions(Criteria $criteria = null, ConnectionInterfac * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $userPermissions A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildPermission The current object (for fluent API support) + * @param Collection $userPermissions A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setUserPermissions(Collection $userPermissions, ConnectionInterface $con = null) + public function setUserPermissions(Collection $userPermissions, ?ConnectionInterface $con = null) { /** @var ChildUserPermission[] $userPermissionsToDelete */ $userPermissionsToDelete = $this->getUserPermissions(new Criteria(), $con)->diff($userPermissions); @@ -1372,13 +1410,13 @@ public function setUserPermissions(Collection $userPermissions, ConnectionInterf /** * Returns the number of related UserPermission objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related UserPermission objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related UserPermission objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countUserPermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countUserPermissions(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collUserPermissionsPartial && !$this->isNew(); if (null === $this->collUserPermissions || null !== $criteria || $partial) { @@ -1407,8 +1445,8 @@ public function countUserPermissions(Criteria $criteria = null, $distinct = fals * Method called to associate a ChildUserPermission object to this object * through the ChildUserPermission foreign key attribute. * - * @param ChildUserPermission $l ChildUserPermission - * @return $this|\TechWilk\Rota\Permission The current object (for fluent API support) + * @param ChildUserPermission $l ChildUserPermission + * @return $this The current object (for fluent API support) */ public function addUserPermission(ChildUserPermission $l) { @@ -1431,15 +1469,15 @@ public function addUserPermission(ChildUserPermission $l) /** * @param ChildUserPermission $userPermission The ChildUserPermission object to add. */ - protected function doAddUserPermission(ChildUserPermission $userPermission) + protected function doAddUserPermission(ChildUserPermission $userPermission): void { $this->collUserPermissions[]= $userPermission; $userPermission->setPermission($this); } /** - * @param ChildUserPermission $userPermission The ChildUserPermission object to remove. - * @return $this|ChildPermission The current object (for fluent API support) + * @param ChildUserPermission $userPermission The ChildUserPermission object to remove. + * @return $this The current object (for fluent API support) */ public function removeUserPermission(ChildUserPermission $userPermission) { @@ -1469,12 +1507,13 @@ public function removeUserPermission(ChildUserPermission $userPermission) * api reasonable. You can provide public methods for those you * actually need in Permission. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildUserPermission[] List of ChildUserPermission objects + * @phpstan-return ObjectCollection&\Traversable List of ChildUserPermission objects */ - public function getUserPermissionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getUserPermissionsJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildUserPermissionQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1488,18 +1527,22 @@ public function getUserPermissionsJoinUser(Criteria $criteria = null, Connection * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addPermissionGroupPermissions() + * @return $this + * @see addPermissionGroupPermissions() */ public function clearPermissionGroupPermissions() { $this->collPermissionGroupPermissions = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collPermissionGroupPermissions collection loaded partially. + * + * @return void */ - public function resetPartialPermissionGroupPermissions($v = true) + public function resetPartialPermissionGroupPermissions($v = true): void { $this->collPermissionGroupPermissionsPartial = $v; } @@ -1511,12 +1554,12 @@ public function resetPartialPermissionGroupPermissions($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initPermissionGroupPermissions($overrideExisting = true) + public function initPermissionGroupPermissions(bool $overrideExisting = true): void { if (null !== $this->collPermissionGroupPermissions && !$overrideExisting) { return; @@ -1537,18 +1580,28 @@ public function initPermissionGroupPermissions($overrideExisting = true) * If this ChildPermission is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildPermissionGroupPermission[] List of ChildPermissionGroupPermission objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildPermissionGroupPermission objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getPermissionGroupPermissions(Criteria $criteria = null, ConnectionInterface $con = null) + public function getPermissionGroupPermissions(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collPermissionGroupPermissionsPartial && !$this->isNew(); - if (null === $this->collPermissionGroupPermissions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collPermissionGroupPermissions) { + if (null === $this->collPermissionGroupPermissions || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initPermissionGroupPermissions(); + if (null === $this->collPermissionGroupPermissions) { + $this->initPermissionGroupPermissions(); + } else { + $collectionClassName = PermissionGroupPermissionTableMap::getTableMap()->getCollectionClassName(); + + $collPermissionGroupPermissions = new $collectionClassName; + $collPermissionGroupPermissions->setModel('\TechWilk\Rota\PermissionGroupPermission'); + + return $collPermissionGroupPermissions; + } } else { $collPermissionGroupPermissions = ChildPermissionGroupPermissionQuery::create(null, $criteria) ->filterByPermission($this) @@ -1592,11 +1645,11 @@ public function getPermissionGroupPermissions(Criteria $criteria = null, Connect * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $permissionGroupPermissions A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildPermission The current object (for fluent API support) + * @param Collection $permissionGroupPermissions A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setPermissionGroupPermissions(Collection $permissionGroupPermissions, ConnectionInterface $con = null) + public function setPermissionGroupPermissions(Collection $permissionGroupPermissions, ?ConnectionInterface $con = null) { /** @var ChildPermissionGroupPermission[] $permissionGroupPermissionsToDelete */ $permissionGroupPermissionsToDelete = $this->getPermissionGroupPermissions(new Criteria(), $con)->diff($permissionGroupPermissions); @@ -1622,13 +1675,13 @@ public function setPermissionGroupPermissions(Collection $permissionGroupPermiss /** * Returns the number of related PermissionGroupPermission objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related PermissionGroupPermission objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related PermissionGroupPermission objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countPermissionGroupPermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countPermissionGroupPermissions(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collPermissionGroupPermissionsPartial && !$this->isNew(); if (null === $this->collPermissionGroupPermissions || null !== $criteria || $partial) { @@ -1657,8 +1710,8 @@ public function countPermissionGroupPermissions(Criteria $criteria = null, $dist * Method called to associate a ChildPermissionGroupPermission object to this object * through the ChildPermissionGroupPermission foreign key attribute. * - * @param ChildPermissionGroupPermission $l ChildPermissionGroupPermission - * @return $this|\TechWilk\Rota\Permission The current object (for fluent API support) + * @param ChildPermissionGroupPermission $l ChildPermissionGroupPermission + * @return $this The current object (for fluent API support) */ public function addPermissionGroupPermission(ChildPermissionGroupPermission $l) { @@ -1681,15 +1734,15 @@ public function addPermissionGroupPermission(ChildPermissionGroupPermission $l) /** * @param ChildPermissionGroupPermission $permissionGroupPermission The ChildPermissionGroupPermission object to add. */ - protected function doAddPermissionGroupPermission(ChildPermissionGroupPermission $permissionGroupPermission) + protected function doAddPermissionGroupPermission(ChildPermissionGroupPermission $permissionGroupPermission): void { $this->collPermissionGroupPermissions[]= $permissionGroupPermission; $permissionGroupPermission->setPermission($this); } /** - * @param ChildPermissionGroupPermission $permissionGroupPermission The ChildPermissionGroupPermission object to remove. - * @return $this|ChildPermission The current object (for fluent API support) + * @param ChildPermissionGroupPermission $permissionGroupPermission The ChildPermissionGroupPermission object to remove. + * @return $this The current object (for fluent API support) */ public function removePermissionGroupPermission(ChildPermissionGroupPermission $permissionGroupPermission) { @@ -1719,12 +1772,13 @@ public function removePermissionGroupPermission(ChildPermissionGroupPermission $ * api reasonable. You can provide public methods for those you * actually need in Permission. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildPermissionGroupPermission[] List of ChildPermissionGroupPermission objects + * @phpstan-return ObjectCollection&\Traversable List of ChildPermissionGroupPermission objects */ - public function getPermissionGroupPermissionsJoinPermissionGroup(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getPermissionGroupPermissionsJoinPermissionGroup(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildPermissionGroupPermissionQuery::create(null, $criteria); $query->joinWith('PermissionGroup', $joinBehavior); @@ -1736,6 +1790,8 @@ public function getPermissionGroupPermissionsJoinPermissionGroup(Criteria $crite * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1748,6 +1804,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1756,9 +1814,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collUserPermissions) { @@ -1775,6 +1834,7 @@ public function clearAllReferences($deep = false) $this->collUserPermissions = null; $this->collPermissionGroupPermissions = null; + return $this; } /** @@ -1789,99 +1849,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1891,7 +1931,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1911,17 +1951,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/PermissionGroup.php b/generated-classes/TechWilk/Rota/Base/PermissionGroup.php index e0f55597..72c9ffee 100644 --- a/generated-classes/TechWilk/Rota/Base/PermissionGroup.php +++ b/generated-classes/TechWilk/Rota/Base/PermissionGroup.php @@ -36,19 +36,21 @@ abstract class PermissionGroup implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -57,14 +59,14 @@ abstract class PermissionGroup implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -76,33 +78,34 @@ abstract class PermissionGroup implements ActiveRecordInterface /** * The value for the name field. * - * @var string + * @var string|null */ protected $name; /** * The value for the description field. * - * @var string + * @var string|null */ protected $description; /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; /** * @var ObjectCollection|ChildPermissionGroupPermission[] Collection to store aggregation of ChildPermissionGroupPermission objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildPermissionGroupPermission objects. */ protected $collPermissionGroupPermissions; protected $collPermissionGroupPermissionsPartial; @@ -111,13 +114,14 @@ abstract class PermissionGroup implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildPermissionGroupPermission[] + * @phpstan-var ObjectCollection&\Traversable */ protected $permissionGroupPermissionsScheduledForDeletion = null; @@ -131,9 +135,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -141,10 +145,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -153,7 +157,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -163,9 +167,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -174,45 +178,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -221,10 +223,10 @@ public function resetModified($col = null) * obj is an instance of PermissionGroup, delegates to * equals(PermissionGroup). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -246,7 +248,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -254,10 +256,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -265,15 +267,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -282,12 +284,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|PermissionGroup The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -297,13 +299,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -314,24 +316,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -339,7 +344,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -359,7 +364,7 @@ public function getId() /** * Get the [name] column value. * - * @return string + * @return string|null */ public function getName() { @@ -369,7 +374,7 @@ public function getName() /** * Get the [description] column value. * - * @return string + * @return string|null */ public function getDescription() { @@ -380,12 +385,14 @@ public function getDescription() * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -400,12 +407,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -419,8 +428,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\PermissionGroup The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -434,13 +443,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PermissionGroup The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -454,13 +463,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\PermissionGroup The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -474,14 +483,14 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\PermissionGroup The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -494,14 +503,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\PermissionGroup The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -514,7 +523,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -522,13 +531,13 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -538,19 +547,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : PermissionGroupTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -571,8 +581,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -580,6 +590,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 5; // 5 = PermissionGroupTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\PermissionGroup'), 0, $e); } @@ -596,23 +607,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -640,19 +652,20 @@ public function reload($deep = false, ConnectionInterface $con = null) if ($deep) { // also de-associate any related objects? $this->collPermissionGroupPermissions = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see PermissionGroup::setDeleted() * @see PermissionGroup::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -682,12 +695,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -707,12 +720,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(PermissionGroupTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(PermissionGroupTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -744,12 +758,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -784,22 +798,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[PermissionGroupTableMap::COL_ID] = true; @@ -836,18 +851,23 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -870,12 +890,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -886,14 +906,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = PermissionGroupTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -905,30 +925,29 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getName(); - break; + case 2: return $this->getDescription(); - break; + case 3: return $this->getCreated(); - break; + case 4: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -938,35 +957,35 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['PermissionGroup'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['PermissionGroup'][$this->hashCode()] = true; $keys = PermissionGroupTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getDescription(), $keys[3] => $this->getCreated(), $keys[4] => $this->getUpdated(), - ); + ]; if ($result[$keys[3]] instanceof \DateTimeInterface) { - $result[$keys[3]] = $result[$keys[3]]->format('c'); + $result[$keys[3]] = $result[$keys[3]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[4]] instanceof \DateTimeInterface) { - $result[$keys[4]] = $result[$keys[4]]->format('c'); + $result[$keys[4]] = $result[$keys[4]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -976,6 +995,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collPermissionGroupPermissions) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'permissionGroupPermissions'; @@ -997,30 +1017,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\PermissionGroup + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = PermissionGroupTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\PermissionGroup + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1056,11 +1078,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = PermissionGroupTableMap::getFieldNames($keyType); @@ -1079,6 +1101,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[4], $arr)) { $this->setUpdated($arr[$keys[4]]); } + + return $this; } /** @@ -1098,9 +1122,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\PermissionGroup The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1114,9 +1138,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(PermissionGroupTableMap::DATABASE_NAME); @@ -1143,13 +1167,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildPermissionGroupQuery::create(); $criteria->add(PermissionGroupTableMap::COL_ID, $this->id); @@ -1161,7 +1185,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1191,19 +1215,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1214,12 +1239,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\PermissionGroup (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\PermissionGroup (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setName($this->getName()); $copyObj->setDescription($this->getDescription()); @@ -1236,11 +1262,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addPermissionGroupPermission($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1252,11 +1279,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\PermissionGroup Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1272,12 +1299,12 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('PermissionGroupPermission' == $relationName) { + if ('PermissionGroupPermission' === $relationName) { $this->initPermissionGroupPermissions(); return; } @@ -1289,18 +1316,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addPermissionGroupPermissions() + * @return $this + * @see addPermissionGroupPermissions() */ public function clearPermissionGroupPermissions() { $this->collPermissionGroupPermissions = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collPermissionGroupPermissions collection loaded partially. + * + * @return void */ - public function resetPartialPermissionGroupPermissions($v = true) + public function resetPartialPermissionGroupPermissions($v = true): void { $this->collPermissionGroupPermissionsPartial = $v; } @@ -1312,12 +1343,12 @@ public function resetPartialPermissionGroupPermissions($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initPermissionGroupPermissions($overrideExisting = true) + public function initPermissionGroupPermissions(bool $overrideExisting = true): void { if (null !== $this->collPermissionGroupPermissions && !$overrideExisting) { return; @@ -1338,18 +1369,28 @@ public function initPermissionGroupPermissions($overrideExisting = true) * If this ChildPermissionGroup is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildPermissionGroupPermission[] List of ChildPermissionGroupPermission objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildPermissionGroupPermission objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getPermissionGroupPermissions(Criteria $criteria = null, ConnectionInterface $con = null) + public function getPermissionGroupPermissions(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collPermissionGroupPermissionsPartial && !$this->isNew(); - if (null === $this->collPermissionGroupPermissions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collPermissionGroupPermissions) { + if (null === $this->collPermissionGroupPermissions || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initPermissionGroupPermissions(); + if (null === $this->collPermissionGroupPermissions) { + $this->initPermissionGroupPermissions(); + } else { + $collectionClassName = PermissionGroupPermissionTableMap::getTableMap()->getCollectionClassName(); + + $collPermissionGroupPermissions = new $collectionClassName; + $collPermissionGroupPermissions->setModel('\TechWilk\Rota\PermissionGroupPermission'); + + return $collPermissionGroupPermissions; + } } else { $collPermissionGroupPermissions = ChildPermissionGroupPermissionQuery::create(null, $criteria) ->filterByPermissionGroup($this) @@ -1393,11 +1434,11 @@ public function getPermissionGroupPermissions(Criteria $criteria = null, Connect * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $permissionGroupPermissions A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildPermissionGroup The current object (for fluent API support) + * @param Collection $permissionGroupPermissions A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setPermissionGroupPermissions(Collection $permissionGroupPermissions, ConnectionInterface $con = null) + public function setPermissionGroupPermissions(Collection $permissionGroupPermissions, ?ConnectionInterface $con = null) { /** @var ChildPermissionGroupPermission[] $permissionGroupPermissionsToDelete */ $permissionGroupPermissionsToDelete = $this->getPermissionGroupPermissions(new Criteria(), $con)->diff($permissionGroupPermissions); @@ -1423,13 +1464,13 @@ public function setPermissionGroupPermissions(Collection $permissionGroupPermiss /** * Returns the number of related PermissionGroupPermission objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related PermissionGroupPermission objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related PermissionGroupPermission objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countPermissionGroupPermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countPermissionGroupPermissions(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collPermissionGroupPermissionsPartial && !$this->isNew(); if (null === $this->collPermissionGroupPermissions || null !== $criteria || $partial) { @@ -1458,8 +1499,8 @@ public function countPermissionGroupPermissions(Criteria $criteria = null, $dist * Method called to associate a ChildPermissionGroupPermission object to this object * through the ChildPermissionGroupPermission foreign key attribute. * - * @param ChildPermissionGroupPermission $l ChildPermissionGroupPermission - * @return $this|\TechWilk\Rota\PermissionGroup The current object (for fluent API support) + * @param ChildPermissionGroupPermission $l ChildPermissionGroupPermission + * @return $this The current object (for fluent API support) */ public function addPermissionGroupPermission(ChildPermissionGroupPermission $l) { @@ -1482,15 +1523,15 @@ public function addPermissionGroupPermission(ChildPermissionGroupPermission $l) /** * @param ChildPermissionGroupPermission $permissionGroupPermission The ChildPermissionGroupPermission object to add. */ - protected function doAddPermissionGroupPermission(ChildPermissionGroupPermission $permissionGroupPermission) + protected function doAddPermissionGroupPermission(ChildPermissionGroupPermission $permissionGroupPermission): void { $this->collPermissionGroupPermissions[]= $permissionGroupPermission; $permissionGroupPermission->setPermissionGroup($this); } /** - * @param ChildPermissionGroupPermission $permissionGroupPermission The ChildPermissionGroupPermission object to remove. - * @return $this|ChildPermissionGroup The current object (for fluent API support) + * @param ChildPermissionGroupPermission $permissionGroupPermission The ChildPermissionGroupPermission object to remove. + * @return $this The current object (for fluent API support) */ public function removePermissionGroupPermission(ChildPermissionGroupPermission $permissionGroupPermission) { @@ -1520,12 +1561,13 @@ public function removePermissionGroupPermission(ChildPermissionGroupPermission $ * api reasonable. You can provide public methods for those you * actually need in PermissionGroup. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildPermissionGroupPermission[] List of ChildPermissionGroupPermission objects + * @phpstan-return ObjectCollection&\Traversable List of ChildPermissionGroupPermission objects */ - public function getPermissionGroupPermissionsJoinPermission(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getPermissionGroupPermissionsJoinPermission(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildPermissionGroupPermissionQuery::create(null, $criteria); $query->joinWith('Permission', $joinBehavior); @@ -1537,6 +1579,8 @@ public function getPermissionGroupPermissionsJoinPermission(Criteria $criteria = * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1550,6 +1594,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1558,9 +1604,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collPermissionGroupPermissions) { @@ -1571,6 +1618,7 @@ public function clearAllReferences($deep = false) } // if ($deep) $this->collPermissionGroupPermissions = null; + return $this; } /** @@ -1588,7 +1636,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildPermissionGroup The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -1599,99 +1647,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1701,7 +1729,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1721,17 +1749,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/PermissionGroupPermission.php b/generated-classes/TechWilk/Rota/Base/PermissionGroupPermission.php index f8647edc..3130c0fb 100644 --- a/generated-classes/TechWilk/Rota/Base/PermissionGroupPermission.php +++ b/generated-classes/TechWilk/Rota/Base/PermissionGroupPermission.php @@ -33,19 +33,21 @@ abstract class PermissionGroupPermission implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -54,14 +56,14 @@ abstract class PermissionGroupPermission implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -100,7 +102,7 @@ abstract class PermissionGroupPermission implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -110,7 +112,7 @@ abstract class PermissionGroupPermission implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->permissionid = 0; $this->permissiongroupid = 0; @@ -128,9 +130,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -138,10 +140,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -150,7 +152,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -160,9 +162,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -171,45 +173,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -218,10 +218,10 @@ public function resetModified($col = null) * obj is an instance of PermissionGroupPermission, delegates to * equals(PermissionGroupPermission). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -243,7 +243,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -251,10 +251,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -262,15 +262,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -279,12 +279,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|PermissionGroupPermission The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -294,13 +294,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -311,24 +311,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -336,7 +339,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -376,8 +379,8 @@ public function getPermissionId() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\PermissionGroupPermission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -391,13 +394,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [permissionid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\PermissionGroupPermission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -415,13 +418,13 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Set the value of [permissiongroupid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\PermissionGroupPermission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setPermissionId($v) { @@ -439,7 +442,7 @@ public function setPermissionId($v) } return $this; - } // setPermissionId() + } /** * Indicates whether the columns in this object are only set to default values. @@ -447,21 +450,21 @@ public function setPermissionId($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->permissionid !== 0) { - return false; - } + if ($this->permissionid !== 0) { + return false; + } - if ($this->permissiongroupid !== 0) { - return false; - } + if ($this->permissiongroupid !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -471,19 +474,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : PermissionGroupPermissionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -492,8 +496,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : PermissionGroupPermissionTableMap::translateFieldName('PermissionId', TableMap::TYPE_PHPNAME, $indexType)]; $this->permissiongroupid = (null !== $col) ? (int) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -501,6 +505,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 3; // 3 = PermissionGroupPermissionTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\PermissionGroupPermission'), 0, $e); } @@ -517,9 +522,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aPermission !== null && $this->permissionid !== $this->aPermission->getId()) { $this->aPermission = null; @@ -527,19 +533,19 @@ public function ensureConsistency() if ($this->aPermissionGroup !== null && $this->permissiongroupid !== $this->aPermissionGroup->getId()) { $this->aPermissionGroup = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -574,13 +580,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see PermissionGroupPermission::setDeleted() * @see PermissionGroupPermission::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -610,12 +616,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -660,12 +666,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -702,22 +708,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[PermissionGroupPermissionTableMap::COL_ID] = true; @@ -748,12 +755,15 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'permissionId': $stmt->bindValue($identifier, $this->permissionid, PDO::PARAM_INT); + break; case 'permissionGroupId': $stmt->bindValue($identifier, $this->permissiongroupid, PDO::PARAM_INT); + break; } } @@ -776,12 +786,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -792,14 +802,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = PermissionGroupPermissionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -811,24 +821,23 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getUserId(); - break; + case 2: return $this->getPermissionId(); - break; + default: return null; - break; } // switch() } @@ -838,27 +847,27 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['PermissionGroupPermission'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['PermissionGroupPermission'][$this->hashCode()] = true; $keys = PermissionGroupPermissionTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getPermissionId(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -866,6 +875,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aPermission) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'permission'; @@ -877,9 +887,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Permission'; } - $result[$key] = $this->aPermission->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aPermission->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aPermissionGroup) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'permissionGroup'; @@ -891,7 +902,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'PermissionGroup'; } - $result[$key] = $this->aPermissionGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aPermissionGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -901,30 +912,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\PermissionGroupPermission + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = PermissionGroupPermissionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\PermissionGroupPermission + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -954,11 +967,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = PermissionGroupPermissionTableMap::getFieldNames($keyType); @@ -971,6 +984,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[2], $arr)) { $this->setPermissionId($arr[$keys[2]]); } + + return $this; } /** @@ -990,9 +1005,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\PermissionGroupPermission The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1006,9 +1021,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(PermissionGroupPermissionTableMap::DATABASE_NAME); @@ -1029,13 +1044,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildPermissionGroupPermissionQuery::create(); $criteria->add(PermissionGroupPermissionTableMap::COL_ID, $this->id); @@ -1047,7 +1062,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1077,19 +1092,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1100,18 +1116,19 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\PermissionGroupPermission (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\PermissionGroupPermission (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setUserId($this->getUserId()); $copyObj->setPermissionId($this->getPermissionId()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1123,11 +1140,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\PermissionGroupPermission Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1140,9 +1157,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildPermission object. * - * @param ChildPermission $v - * @return $this|\TechWilk\Rota\PermissionGroupPermission The current object (for fluent API support) - * @throws PropelException + * @param ChildPermission $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setPermission(ChildPermission $v = null) { @@ -1168,11 +1185,11 @@ public function setPermission(ChildPermission $v = null) /** * Get the associated ChildPermission object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildPermission The associated ChildPermission object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getPermission(ConnectionInterface $con = null) + public function getPermission(?ConnectionInterface $con = null) { if ($this->aPermission === null && ($this->permissionid != 0)) { $this->aPermission = ChildPermissionQuery::create()->findPk($this->permissionid, $con); @@ -1191,9 +1208,9 @@ public function getPermission(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildPermissionGroup object. * - * @param ChildPermissionGroup $v - * @return $this|\TechWilk\Rota\PermissionGroupPermission The current object (for fluent API support) - * @throws PropelException + * @param ChildPermissionGroup $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setPermissionGroup(ChildPermissionGroup $v = null) { @@ -1219,11 +1236,11 @@ public function setPermissionGroup(ChildPermissionGroup $v = null) /** * Get the associated ChildPermissionGroup object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildPermissionGroup The associated ChildPermissionGroup object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getPermissionGroup(ConnectionInterface $con = null) + public function getPermissionGroup(?ConnectionInterface $con = null) { if ($this->aPermissionGroup === null && ($this->permissiongroupid != 0)) { $this->aPermissionGroup = ChildPermissionGroupQuery::create()->findPk($this->permissiongroupid, $con); @@ -1243,6 +1260,8 @@ public function getPermissionGroup(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1261,6 +1280,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1269,15 +1290,17 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aPermission = null; $this->aPermissionGroup = null; + return $this; } /** @@ -1292,99 +1315,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1394,7 +1397,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1414,17 +1417,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/PermissionGroupPermissionQuery.php b/generated-classes/TechWilk/Rota/Base/PermissionGroupPermissionQuery.php index 6431a89e..bbad6483 100644 --- a/generated-classes/TechWilk/Rota/Base/PermissionGroupPermissionQuery.php +++ b/generated-classes/TechWilk/Rota/Base/PermissionGroupPermissionQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\PermissionGroupPermissionTableMap; /** - * Base class that represents a query for the 'permissionGroupPermissions' table. - * - * + * Base class that represents a query for the `permissionGroupPermissions` table. * * @method ChildPermissionGroupPermissionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildPermissionGroupPermissionQuery orderByUserId($order = Criteria::ASC) Order by the permissionId column @@ -58,26 +57,32 @@ * * @method \TechWilk\Rota\PermissionQuery|\TechWilk\Rota\PermissionGroupQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildPermissionGroupPermission findOne(ConnectionInterface $con = null) Return the first ChildPermissionGroupPermission matching the query - * @method ChildPermissionGroupPermission findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPermissionGroupPermission matching the query, or a new ChildPermissionGroupPermission object populated from the query conditions when no match is found + * @method ChildPermissionGroupPermission|null findOne(?ConnectionInterface $con = null) Return the first ChildPermissionGroupPermission matching the query + * @method ChildPermissionGroupPermission findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildPermissionGroupPermission matching the query, or a new ChildPermissionGroupPermission object populated from the query conditions when no match is found * - * @method ChildPermissionGroupPermission findOneById(int $id) Return the first ChildPermissionGroupPermission filtered by the id column - * @method ChildPermissionGroupPermission findOneByUserId(int $permissionId) Return the first ChildPermissionGroupPermission filtered by the permissionId column - * @method ChildPermissionGroupPermission findOneByPermissionId(int $permissionGroupId) Return the first ChildPermissionGroupPermission filtered by the permissionGroupId column * - - * @method ChildPermissionGroupPermission requirePk($key, ConnectionInterface $con = null) Return the ChildPermissionGroupPermission by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildPermissionGroupPermission requireOne(ConnectionInterface $con = null) Return the first ChildPermissionGroupPermission matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPermissionGroupPermission|null findOneById(int $id) Return the first ChildPermissionGroupPermission filtered by the id column + * @method ChildPermissionGroupPermission|null findOneByUserId(int $permissionId) Return the first ChildPermissionGroupPermission filtered by the permissionId column + * @method ChildPermissionGroupPermission|null findOneByPermissionId(int $permissionGroupId) Return the first ChildPermissionGroupPermission filtered by the permissionGroupId column + * + * @method ChildPermissionGroupPermission requirePk($key, ?ConnectionInterface $con = null) Return the ChildPermissionGroupPermission by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPermissionGroupPermission requireOne(?ConnectionInterface $con = null) Return the first ChildPermissionGroupPermission matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildPermissionGroupPermission requireOneById(int $id) Return the first ChildPermissionGroupPermission filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermissionGroupPermission requireOneByUserId(int $permissionId) Return the first ChildPermissionGroupPermission filtered by the permissionId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermissionGroupPermission requireOneByPermissionId(int $permissionGroupId) Return the first ChildPermissionGroupPermission filtered by the permissionGroupId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildPermissionGroupPermission[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildPermissionGroupPermission objects based on current ModelCriteria - * @method ChildPermissionGroupPermission[]|ObjectCollection findById(int $id) Return ChildPermissionGroupPermission objects filtered by the id column - * @method ChildPermissionGroupPermission[]|ObjectCollection findByUserId(int $permissionId) Return ChildPermissionGroupPermission objects filtered by the permissionId column - * @method ChildPermissionGroupPermission[]|ObjectCollection findByPermissionId(int $permissionGroupId) Return ChildPermissionGroupPermission objects filtered by the permissionGroupId column - * @method ChildPermissionGroupPermission[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildPermissionGroupPermission[]|Collection find(?ConnectionInterface $con = null) Return ChildPermissionGroupPermission objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildPermissionGroupPermission objects based on current ModelCriteria * + * @method ChildPermissionGroupPermission[]|Collection findById(int|array $id) Return ChildPermissionGroupPermission objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildPermissionGroupPermission objects filtered by the id column + * @method ChildPermissionGroupPermission[]|Collection findByUserId(int|array $permissionId) Return ChildPermissionGroupPermission objects filtered by the permissionId column + * @psalm-method Collection&\Traversable findByUserId(int|array $permissionId) Return ChildPermissionGroupPermission objects filtered by the permissionId column + * @method ChildPermissionGroupPermission[]|Collection findByPermissionId(int|array $permissionGroupId) Return ChildPermissionGroupPermission objects filtered by the permissionGroupId column + * @psalm-method Collection&\Traversable findByPermissionId(int|array $permissionGroupId) Return ChildPermissionGroupPermission objects filtered by the permissionGroupId column + * + * @method ChildPermissionGroupPermission[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class PermissionGroupPermissionQuery extends ModelCriteria { @@ -86,9 +91,9 @@ abstract class PermissionGroupPermissionQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\PermissionGroupPermissionQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\PermissionGroupPermission', $modelAlias = null) { @@ -98,12 +103,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildPermissionGroupPermissionQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildPermissionGroupPermissionQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildPermissionGroupPermissionQuery) { return $criteria; @@ -133,7 +138,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildPermissionGroupPermission|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -165,8 +170,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -198,8 +203,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildPermissionGroupPermission|array|mixed the result, formatted by the current formatter */ @@ -219,12 +224,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -241,25 +246,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -272,15 +283,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -300,7 +311,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -315,15 +328,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByPermission() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -343,7 +356,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_PERMISSIONID, $userId, $comparison); + $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_PERMISSIONID, $userId, $comparison); + + return $this; } /** @@ -358,15 +373,15 @@ public function filterByUserId($userId = null, $comparison = null) * * @see filterByPermissionGroup() * - * @param mixed $permissionId The value to use as filter. + * @param mixed $permissionId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermissionId($permissionId = null, $comparison = null) + public function filterByPermissionId($permissionId = null, ?string $comparison = null) { if (is_array($permissionId)) { $useMinMax = false; @@ -386,20 +401,22 @@ public function filterByPermissionId($permissionId = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID, $permissionId, $comparison); + $this->addUsingAlias(PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID, $permissionId, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Permission object * * @param \TechWilk\Rota\Permission|ObjectCollection $permission The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermission($permission, $comparison = null) + public function filterByPermission($permission, ?string $comparison = null) { if ($permission instanceof \TechWilk\Rota\Permission) { return $this @@ -409,8 +426,10 @@ public function filterByPermission($permission, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(PermissionGroupPermissionTableMap::COL_PERMISSIONID, $permission->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByPermission() only accepts arguments of type \TechWilk\Rota\Permission or Collection'); } @@ -419,12 +438,12 @@ public function filterByPermission($permission, $comparison = null) /** * Adds a JOIN clause to the query using the Permission relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinPermission($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinPermission(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Permission'); @@ -453,9 +472,9 @@ public function joinPermission($relationAlias = null, $joinType = Criteria::INNE * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\PermissionQuery A secondary query class using the current class as primary query */ @@ -466,17 +485,113 @@ public function usePermissionQuery($relationAlias = null, $joinType = Criteria:: ->useQuery($relationAlias ? $relationAlias : 'Permission', '\TechWilk\Rota\PermissionQuery'); } + /** + * Use the Permission relation Permission object + * + * @param callable(\TechWilk\Rota\PermissionQuery):\TechWilk\Rota\PermissionQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withPermissionQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->usePermissionQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Permission table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the EXISTS statement + */ + public function usePermissionExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useExistsQuery('Permission', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Permission table for a NOT EXISTS query. + * + * @see usePermissionExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the NOT EXISTS statement + */ + public function usePermissionNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useExistsQuery('Permission', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Permission table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the IN statement + */ + public function useInPermissionQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useInQuery('Permission', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Permission table for a NOT IN query. + * + * @see usePermissionInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the NOT IN statement + */ + public function useNotInPermissionQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useInQuery('Permission', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\PermissionGroup object * * @param \TechWilk\Rota\PermissionGroup|ObjectCollection $permissionGroup The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermissionGroup($permissionGroup, $comparison = null) + public function filterByPermissionGroup($permissionGroup, ?string $comparison = null) { if ($permissionGroup instanceof \TechWilk\Rota\PermissionGroup) { return $this @@ -486,8 +601,10 @@ public function filterByPermissionGroup($permissionGroup, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID, $permissionGroup->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByPermissionGroup() only accepts arguments of type \TechWilk\Rota\PermissionGroup or Collection'); } @@ -496,12 +613,12 @@ public function filterByPermissionGroup($permissionGroup, $comparison = null) /** * Adds a JOIN clause to the query using the PermissionGroup relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinPermissionGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinPermissionGroup(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('PermissionGroup'); @@ -530,9 +647,9 @@ public function joinPermissionGroup($relationAlias = null, $joinType = Criteria: * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\PermissionGroupQuery A secondary query class using the current class as primary query */ @@ -543,12 +660,108 @@ public function usePermissionGroupQuery($relationAlias = null, $joinType = Crite ->useQuery($relationAlias ? $relationAlias : 'PermissionGroup', '\TechWilk\Rota\PermissionGroupQuery'); } + /** + * Use the PermissionGroup relation PermissionGroup object + * + * @param callable(\TechWilk\Rota\PermissionGroupQuery):\TechWilk\Rota\PermissionGroupQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withPermissionGroupQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->usePermissionGroupQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to PermissionGroup table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\PermissionGroupQuery The inner query object of the EXISTS statement + */ + public function usePermissionGroupExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\PermissionGroupQuery */ + $q = $this->useExistsQuery('PermissionGroup', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to PermissionGroup table for a NOT EXISTS query. + * + * @see usePermissionGroupExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionGroupQuery The inner query object of the NOT EXISTS statement + */ + public function usePermissionGroupNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionGroupQuery */ + $q = $this->useExistsQuery('PermissionGroup', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to PermissionGroup table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\PermissionGroupQuery The inner query object of the IN statement + */ + public function useInPermissionGroupQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\PermissionGroupQuery */ + $q = $this->useInQuery('PermissionGroup', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to PermissionGroup table for a NOT IN query. + * + * @see usePermissionGroupInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionGroupQuery The inner query object of the NOT IN statement + */ + public function useNotInPermissionGroupQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionGroupQuery */ + $q = $this->useInQuery('PermissionGroup', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildPermissionGroupPermission $permissionGroupPermission Object to remove from the list of results + * @param ChildPermissionGroupPermission $permissionGroupPermission Object to remove from the list of results * - * @return $this|ChildPermissionGroupPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($permissionGroupPermission = null) { @@ -565,7 +778,7 @@ public function prune($permissionGroupPermission = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupPermissionTableMap::DATABASE_NAME); @@ -590,12 +803,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupPermissionTableMap::DATABASE_NAME); @@ -619,4 +832,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // PermissionGroupPermissionQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/PermissionGroupQuery.php b/generated-classes/TechWilk/Rota/Base/PermissionGroupQuery.php index d63f805f..7bf855a3 100644 --- a/generated-classes/TechWilk/Rota/Base/PermissionGroupQuery.php +++ b/generated-classes/TechWilk/Rota/Base/PermissionGroupQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\PermissionGroupTableMap; /** - * Base class that represents a query for the 'permissionGroups' table. - * - * + * Base class that represents a query for the `permissionGroups` table. * * @method ChildPermissionGroupQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildPermissionGroupQuery orderByName($order = Criteria::ASC) Order by the name column @@ -52,17 +51,17 @@ * * @method \TechWilk\Rota\PermissionGroupPermissionQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildPermissionGroup findOne(ConnectionInterface $con = null) Return the first ChildPermissionGroup matching the query - * @method ChildPermissionGroup findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPermissionGroup matching the query, or a new ChildPermissionGroup object populated from the query conditions when no match is found + * @method ChildPermissionGroup|null findOne(?ConnectionInterface $con = null) Return the first ChildPermissionGroup matching the query + * @method ChildPermissionGroup findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildPermissionGroup matching the query, or a new ChildPermissionGroup object populated from the query conditions when no match is found + * + * @method ChildPermissionGroup|null findOneById(int $id) Return the first ChildPermissionGroup filtered by the id column + * @method ChildPermissionGroup|null findOneByName(string $name) Return the first ChildPermissionGroup filtered by the name column + * @method ChildPermissionGroup|null findOneByDescription(string $description) Return the first ChildPermissionGroup filtered by the description column + * @method ChildPermissionGroup|null findOneByCreated(string $created) Return the first ChildPermissionGroup filtered by the created column + * @method ChildPermissionGroup|null findOneByUpdated(string $updated) Return the first ChildPermissionGroup filtered by the updated column * - * @method ChildPermissionGroup findOneById(int $id) Return the first ChildPermissionGroup filtered by the id column - * @method ChildPermissionGroup findOneByName(string $name) Return the first ChildPermissionGroup filtered by the name column - * @method ChildPermissionGroup findOneByDescription(string $description) Return the first ChildPermissionGroup filtered by the description column - * @method ChildPermissionGroup findOneByCreated(string $created) Return the first ChildPermissionGroup filtered by the created column - * @method ChildPermissionGroup findOneByUpdated(string $updated) Return the first ChildPermissionGroup filtered by the updated column * - - * @method ChildPermissionGroup requirePk($key, ConnectionInterface $con = null) Return the ChildPermissionGroup by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildPermissionGroup requireOne(ConnectionInterface $con = null) Return the first ChildPermissionGroup matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPermissionGroup requirePk($key, ?ConnectionInterface $con = null) Return the ChildPermissionGroup by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPermissionGroup requireOne(?ConnectionInterface $con = null) Return the first ChildPermissionGroup matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildPermissionGroup requireOneById(int $id) Return the first ChildPermissionGroup filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermissionGroup requireOneByName(string $name) Return the first ChildPermissionGroup filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -70,14 +69,22 @@ * @method ChildPermissionGroup requireOneByCreated(string $created) Return the first ChildPermissionGroup filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermissionGroup requireOneByUpdated(string $updated) Return the first ChildPermissionGroup filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildPermissionGroup[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildPermissionGroup objects based on current ModelCriteria - * @method ChildPermissionGroup[]|ObjectCollection findById(int $id) Return ChildPermissionGroup objects filtered by the id column - * @method ChildPermissionGroup[]|ObjectCollection findByName(string $name) Return ChildPermissionGroup objects filtered by the name column - * @method ChildPermissionGroup[]|ObjectCollection findByDescription(string $description) Return ChildPermissionGroup objects filtered by the description column - * @method ChildPermissionGroup[]|ObjectCollection findByCreated(string $created) Return ChildPermissionGroup objects filtered by the created column - * @method ChildPermissionGroup[]|ObjectCollection findByUpdated(string $updated) Return ChildPermissionGroup objects filtered by the updated column - * @method ChildPermissionGroup[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildPermissionGroup[]|Collection find(?ConnectionInterface $con = null) Return ChildPermissionGroup objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildPermissionGroup objects based on current ModelCriteria * + * @method ChildPermissionGroup[]|Collection findById(int|array $id) Return ChildPermissionGroup objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildPermissionGroup objects filtered by the id column + * @method ChildPermissionGroup[]|Collection findByName(string|array $name) Return ChildPermissionGroup objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildPermissionGroup objects filtered by the name column + * @method ChildPermissionGroup[]|Collection findByDescription(string|array $description) Return ChildPermissionGroup objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildPermissionGroup objects filtered by the description column + * @method ChildPermissionGroup[]|Collection findByCreated(string|array $created) Return ChildPermissionGroup objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildPermissionGroup objects filtered by the created column + * @method ChildPermissionGroup[]|Collection findByUpdated(string|array $updated) Return ChildPermissionGroup objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildPermissionGroup objects filtered by the updated column + * + * @method ChildPermissionGroup[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class PermissionGroupQuery extends ModelCriteria { @@ -86,9 +93,9 @@ abstract class PermissionGroupQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\PermissionGroupQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\PermissionGroup', $modelAlias = null) { @@ -98,12 +105,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildPermissionGroupQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildPermissionGroupQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildPermissionGroupQuery) { return $criteria; @@ -133,7 +140,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildPermissionGroup|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -165,8 +172,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -198,8 +205,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildPermissionGroup|array|mixed the result, formatted by the current formatter */ @@ -219,12 +226,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -241,25 +248,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(PermissionGroupTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(PermissionGroupTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(PermissionGroupTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(PermissionGroupTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -272,15 +285,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -300,7 +313,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(PermissionGroupTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -310,14 +325,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -325,7 +341,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(PermissionGroupTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -335,14 +353,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -350,7 +369,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(PermissionGroupTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -363,17 +384,17 @@ public function filterByDescription($description = null, $comparison = null) * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -393,7 +414,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(PermissionGroupTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -406,17 +429,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -436,27 +459,33 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(PermissionGroupTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(PermissionGroupTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\PermissionGroupPermission object * * @param \TechWilk\Rota\PermissionGroupPermission|ObjectCollection $permissionGroupPermission the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermissionGroupPermission($permissionGroupPermission, $comparison = null) + public function filterByPermissionGroupPermission($permissionGroupPermission, ?string $comparison = null) { if ($permissionGroupPermission instanceof \TechWilk\Rota\PermissionGroupPermission) { - return $this + $this ->addUsingAlias(PermissionGroupTableMap::COL_ID, $permissionGroupPermission->getPermissionId(), $comparison); + + return $this; } elseif ($permissionGroupPermission instanceof ObjectCollection) { - return $this + $this ->usePermissionGroupPermissionQuery() ->filterByPrimaryKeys($permissionGroupPermission->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByPermissionGroupPermission() only accepts arguments of type \TechWilk\Rota\PermissionGroupPermission or Collection'); } @@ -465,12 +494,12 @@ public function filterByPermissionGroupPermission($permissionGroupPermission, $c /** * Adds a JOIN clause to the query using the PermissionGroupPermission relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinPermissionGroupPermission($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinPermissionGroupPermission(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('PermissionGroupPermission'); @@ -499,9 +528,9 @@ public function joinPermissionGroupPermission($relationAlias = null, $joinType = * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\PermissionGroupPermissionQuery A secondary query class using the current class as primary query */ @@ -512,12 +541,108 @@ public function usePermissionGroupPermissionQuery($relationAlias = null, $joinTy ->useQuery($relationAlias ? $relationAlias : 'PermissionGroupPermission', '\TechWilk\Rota\PermissionGroupPermissionQuery'); } + /** + * Use the PermissionGroupPermission relation PermissionGroupPermission object + * + * @param callable(\TechWilk\Rota\PermissionGroupPermissionQuery):\TechWilk\Rota\PermissionGroupPermissionQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withPermissionGroupPermissionQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->usePermissionGroupPermissionQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to PermissionGroupPermission table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the EXISTS statement + */ + public function usePermissionGroupPermissionExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useExistsQuery('PermissionGroupPermission', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to PermissionGroupPermission table for a NOT EXISTS query. + * + * @see usePermissionGroupPermissionExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the NOT EXISTS statement + */ + public function usePermissionGroupPermissionNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useExistsQuery('PermissionGroupPermission', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to PermissionGroupPermission table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the IN statement + */ + public function useInPermissionGroupPermissionQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useInQuery('PermissionGroupPermission', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to PermissionGroupPermission table for a NOT IN query. + * + * @see usePermissionGroupPermissionInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the NOT IN statement + */ + public function useNotInPermissionGroupPermissionQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useInQuery('PermissionGroupPermission', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildPermissionGroup $permissionGroup Object to remove from the list of results + * @param ChildPermissionGroup $permissionGroup Object to remove from the list of results * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($permissionGroup = null) { @@ -534,7 +659,7 @@ public function prune($permissionGroup = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupTableMap::DATABASE_NAME); @@ -559,12 +684,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupTableMap::DATABASE_NAME); @@ -594,64 +719,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(PermissionGroupTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(PermissionGroupTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(PermissionGroupTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(PermissionGroupTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(PermissionGroupTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(PermissionGroupTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(PermissionGroupTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(PermissionGroupTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(PermissionGroupTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(PermissionGroupTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildPermissionGroupQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(PermissionGroupTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(PermissionGroupTableMap::COL_CREATED); + + return $this; } -} // PermissionGroupQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/PermissionQuery.php b/generated-classes/TechWilk/Rota/Base/PermissionQuery.php index 2f8b7f5a..18a70d45 100644 --- a/generated-classes/TechWilk/Rota/Base/PermissionQuery.php +++ b/generated-classes/TechWilk/Rota/Base/PermissionQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\PermissionTableMap; /** - * Base class that represents a query for the 'permissions' table. - * - * + * Base class that represents a query for the `permissions` table. * * @method ChildPermissionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildPermissionQuery orderByName($order = Criteria::ASC) Order by the name column @@ -60,29 +59,36 @@ * * @method \TechWilk\Rota\UserPermissionQuery|\TechWilk\Rota\PermissionGroupPermissionQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildPermission findOne(ConnectionInterface $con = null) Return the first ChildPermission matching the query - * @method ChildPermission findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPermission matching the query, or a new ChildPermission object populated from the query conditions when no match is found + * @method ChildPermission|null findOne(?ConnectionInterface $con = null) Return the first ChildPermission matching the query + * @method ChildPermission findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildPermission matching the query, or a new ChildPermission object populated from the query conditions when no match is found * - * @method ChildPermission findOneById(int $id) Return the first ChildPermission filtered by the id column - * @method ChildPermission findOneByName(string $name) Return the first ChildPermission filtered by the name column - * @method ChildPermission findOneByDescription(string $description) Return the first ChildPermission filtered by the description column - * @method ChildPermission findOneBySlug(string $slug) Return the first ChildPermission filtered by the slug column * - - * @method ChildPermission requirePk($key, ConnectionInterface $con = null) Return the ChildPermission by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildPermission requireOne(ConnectionInterface $con = null) Return the first ChildPermission matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPermission|null findOneById(int $id) Return the first ChildPermission filtered by the id column + * @method ChildPermission|null findOneByName(string $name) Return the first ChildPermission filtered by the name column + * @method ChildPermission|null findOneByDescription(string $description) Return the first ChildPermission filtered by the description column + * @method ChildPermission|null findOneBySlug(string $slug) Return the first ChildPermission filtered by the slug column + * + * @method ChildPermission requirePk($key, ?ConnectionInterface $con = null) Return the ChildPermission by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildPermission requireOne(?ConnectionInterface $con = null) Return the first ChildPermission matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildPermission requireOneById(int $id) Return the first ChildPermission filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermission requireOneByName(string $name) Return the first ChildPermission filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermission requireOneByDescription(string $description) Return the first ChildPermission filtered by the description column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildPermission requireOneBySlug(string $slug) Return the first ChildPermission filtered by the slug column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildPermission[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildPermission objects based on current ModelCriteria - * @method ChildPermission[]|ObjectCollection findById(int $id) Return ChildPermission objects filtered by the id column - * @method ChildPermission[]|ObjectCollection findByName(string $name) Return ChildPermission objects filtered by the name column - * @method ChildPermission[]|ObjectCollection findByDescription(string $description) Return ChildPermission objects filtered by the description column - * @method ChildPermission[]|ObjectCollection findBySlug(string $slug) Return ChildPermission objects filtered by the slug column - * @method ChildPermission[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildPermission[]|Collection find(?ConnectionInterface $con = null) Return ChildPermission objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildPermission objects based on current ModelCriteria * + * @method ChildPermission[]|Collection findById(int|array $id) Return ChildPermission objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildPermission objects filtered by the id column + * @method ChildPermission[]|Collection findByName(string|array $name) Return ChildPermission objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildPermission objects filtered by the name column + * @method ChildPermission[]|Collection findByDescription(string|array $description) Return ChildPermission objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildPermission objects filtered by the description column + * @method ChildPermission[]|Collection findBySlug(string|array $slug) Return ChildPermission objects filtered by the slug column + * @psalm-method Collection&\Traversable findBySlug(string|array $slug) Return ChildPermission objects filtered by the slug column + * + * @method ChildPermission[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class PermissionQuery extends ModelCriteria { @@ -91,9 +97,9 @@ abstract class PermissionQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\PermissionQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Permission', $modelAlias = null) { @@ -103,12 +109,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildPermissionQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildPermissionQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildPermissionQuery) { return $criteria; @@ -138,7 +144,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildPermission|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -170,8 +176,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -203,8 +209,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildPermission|array|mixed the result, formatted by the current formatter */ @@ -224,12 +230,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -246,25 +252,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(PermissionTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(PermissionTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(PermissionTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(PermissionTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -277,15 +289,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -305,7 +317,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(PermissionTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(PermissionTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -315,14 +329,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -330,7 +345,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(PermissionTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(PermissionTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -340,14 +357,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -355,7 +373,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(PermissionTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(PermissionTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -365,14 +385,15 @@ public function filterByDescription($description = null, $comparison = null) * * $query->filterBySlug('fooValue'); // WHERE slug = 'fooValue' * $query->filterBySlug('%fooValue%', Criteria::LIKE); // WHERE slug LIKE '%fooValue%' + * $query->filterBySlug(['foo', 'bar']); // WHERE slug IN ('foo', 'bar') * * - * @param string $slug The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $slug The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySlug($slug = null, $comparison = null) + public function filterBySlug($slug = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($slug)) { @@ -380,27 +401,33 @@ public function filterBySlug($slug = null, $comparison = null) } } - return $this->addUsingAlias(PermissionTableMap::COL_SLUG, $slug, $comparison); + $this->addUsingAlias(PermissionTableMap::COL_SLUG, $slug, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\UserPermission object * * @param \TechWilk\Rota\UserPermission|ObjectCollection $userPermission the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserPermission($userPermission, $comparison = null) + public function filterByUserPermission($userPermission, ?string $comparison = null) { if ($userPermission instanceof \TechWilk\Rota\UserPermission) { - return $this + $this ->addUsingAlias(PermissionTableMap::COL_ID, $userPermission->getPermissionId(), $comparison); + + return $this; } elseif ($userPermission instanceof ObjectCollection) { - return $this + $this ->useUserPermissionQuery() ->filterByPrimaryKeys($userPermission->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByUserPermission() only accepts arguments of type \TechWilk\Rota\UserPermission or Collection'); } @@ -409,12 +436,12 @@ public function filterByUserPermission($userPermission, $comparison = null) /** * Adds a JOIN clause to the query using the UserPermission relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUserPermission($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUserPermission(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('UserPermission'); @@ -443,9 +470,9 @@ public function joinUserPermission($relationAlias = null, $joinType = Criteria:: * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserPermissionQuery A secondary query class using the current class as primary query */ @@ -456,24 +483,124 @@ public function useUserPermissionQuery($relationAlias = null, $joinType = Criter ->useQuery($relationAlias ? $relationAlias : 'UserPermission', '\TechWilk\Rota\UserPermissionQuery'); } + /** + * Use the UserPermission relation UserPermission object + * + * @param callable(\TechWilk\Rota\UserPermissionQuery):\TechWilk\Rota\UserPermissionQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserPermissionQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserPermissionQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to UserPermission table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the EXISTS statement + */ + public function useUserPermissionExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useExistsQuery('UserPermission', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to UserPermission table for a NOT EXISTS query. + * + * @see useUserPermissionExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the NOT EXISTS statement + */ + public function useUserPermissionNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useExistsQuery('UserPermission', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to UserPermission table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the IN statement + */ + public function useInUserPermissionQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useInQuery('UserPermission', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to UserPermission table for a NOT IN query. + * + * @see useUserPermissionInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the NOT IN statement + */ + public function useNotInUserPermissionQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useInQuery('UserPermission', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\PermissionGroupPermission object * * @param \TechWilk\Rota\PermissionGroupPermission|ObjectCollection $permissionGroupPermission the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermissionGroupPermission($permissionGroupPermission, $comparison = null) + public function filterByPermissionGroupPermission($permissionGroupPermission, ?string $comparison = null) { if ($permissionGroupPermission instanceof \TechWilk\Rota\PermissionGroupPermission) { - return $this + $this ->addUsingAlias(PermissionTableMap::COL_ID, $permissionGroupPermission->getUserId(), $comparison); + + return $this; } elseif ($permissionGroupPermission instanceof ObjectCollection) { - return $this + $this ->usePermissionGroupPermissionQuery() ->filterByPrimaryKeys($permissionGroupPermission->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByPermissionGroupPermission() only accepts arguments of type \TechWilk\Rota\PermissionGroupPermission or Collection'); } @@ -482,12 +609,12 @@ public function filterByPermissionGroupPermission($permissionGroupPermission, $c /** * Adds a JOIN clause to the query using the PermissionGroupPermission relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinPermissionGroupPermission($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinPermissionGroupPermission(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('PermissionGroupPermission'); @@ -516,9 +643,9 @@ public function joinPermissionGroupPermission($relationAlias = null, $joinType = * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\PermissionGroupPermissionQuery A secondary query class using the current class as primary query */ @@ -529,12 +656,108 @@ public function usePermissionGroupPermissionQuery($relationAlias = null, $joinTy ->useQuery($relationAlias ? $relationAlias : 'PermissionGroupPermission', '\TechWilk\Rota\PermissionGroupPermissionQuery'); } + /** + * Use the PermissionGroupPermission relation PermissionGroupPermission object + * + * @param callable(\TechWilk\Rota\PermissionGroupPermissionQuery):\TechWilk\Rota\PermissionGroupPermissionQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withPermissionGroupPermissionQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->usePermissionGroupPermissionQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to PermissionGroupPermission table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the EXISTS statement + */ + public function usePermissionGroupPermissionExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useExistsQuery('PermissionGroupPermission', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to PermissionGroupPermission table for a NOT EXISTS query. + * + * @see usePermissionGroupPermissionExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the NOT EXISTS statement + */ + public function usePermissionGroupPermissionNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useExistsQuery('PermissionGroupPermission', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to PermissionGroupPermission table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the IN statement + */ + public function useInPermissionGroupPermissionQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useInQuery('PermissionGroupPermission', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to PermissionGroupPermission table for a NOT IN query. + * + * @see usePermissionGroupPermissionInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionGroupPermissionQuery The inner query object of the NOT IN statement + */ + public function useNotInPermissionGroupPermissionQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionGroupPermissionQuery */ + $q = $this->useInQuery('PermissionGroupPermission', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildPermission $permission Object to remove from the list of results + * @param ChildPermission $permission Object to remove from the list of results * - * @return $this|ChildPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($permission = null) { @@ -551,7 +774,7 @@ public function prune($permission = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionTableMap::DATABASE_NAME); @@ -576,12 +799,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionTableMap::DATABASE_NAME); @@ -605,4 +828,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // PermissionQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Role.php b/generated-classes/TechWilk/Rota/Base/Role.php index 021791d1..0430b200 100644 --- a/generated-classes/TechWilk/Rota/Base/Role.php +++ b/generated-classes/TechWilk/Rota/Base/Role.php @@ -36,19 +36,21 @@ abstract class Role implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\RoleTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\RoleTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -57,14 +59,14 @@ abstract class Role implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -107,7 +109,7 @@ abstract class Role implements ActiveRecordInterface /** * The value for the allowroleswaps field. * - * @var boolean + * @var boolean|null */ protected $allowroleswaps; @@ -118,6 +120,7 @@ abstract class Role implements ActiveRecordInterface /** * @var ObjectCollection|ChildUserRole[] Collection to store aggregation of ChildUserRole objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildUserRole objects. */ protected $collUserRoles; protected $collUserRolesPartial; @@ -126,13 +129,14 @@ abstract class Role implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildUserRole[] + * @phpstan-var ObjectCollection&\Traversable */ protected $userRolesScheduledForDeletion = null; @@ -142,7 +146,7 @@ abstract class Role implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->groupid = 0; $this->name = ''; @@ -161,9 +165,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -171,10 +175,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -183,7 +187,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -193,9 +197,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -204,45 +208,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -251,10 +253,10 @@ public function resetModified($col = null) * obj is an instance of Role, delegates to * equals(Role). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -276,7 +278,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -284,10 +286,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -295,15 +297,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -312,12 +314,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Role The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -327,13 +329,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -344,24 +346,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -369,7 +374,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -429,7 +434,7 @@ public function getRehersalId() /** * Get the [allowroleswaps] column value. * - * @return boolean + * @return boolean|null */ public function getAllowRoleSwaps() { @@ -439,7 +444,7 @@ public function getAllowRoleSwaps() /** * Get the [allowroleswaps] column value. * - * @return boolean + * @return boolean|null */ public function isAllowRoleSwaps() { @@ -449,8 +454,8 @@ public function isAllowRoleSwaps() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -464,13 +469,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [groupid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setGroupId($v) { @@ -488,13 +493,13 @@ public function setGroupId($v) } return $this; - } // setGroupId() + } /** * Set the value of [name] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setName($v) { @@ -508,13 +513,13 @@ public function setName($v) } return $this; - } // setName() + } /** * Set the value of [description] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDescription($v) { @@ -528,13 +533,13 @@ public function setDescription($v) } return $this; - } // setDescription() + } /** * Set the value of [rehersalid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setRehersalId($v) { @@ -548,7 +553,7 @@ public function setRehersalId($v) } return $this; - } // setRehersalId() + } /** * Sets the value of the [allowroleswaps] column. @@ -557,8 +562,8 @@ public function setRehersalId($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param bool|integer|string|null $v The new value + * @return $this The current object (for fluent API support) */ public function setAllowRoleSwaps($v) { @@ -576,7 +581,7 @@ public function setAllowRoleSwaps($v) } return $this; - } // setAllowRoleSwaps() + } /** * Indicates whether the columns in this object are only set to default values. @@ -584,25 +589,25 @@ public function setAllowRoleSwaps($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->groupid !== 0) { - return false; - } + if ($this->groupid !== 0) { + return false; + } - if ($this->name !== '') { - return false; - } + if ($this->name !== '') { + return false; + } - if ($this->rehersalid !== 0) { - return false; - } + if ($this->rehersalid !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -612,19 +617,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : RoleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -642,8 +648,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : RoleTableMap::translateFieldName('AllowRoleSwaps', TableMap::TYPE_PHPNAME, $indexType)]; $this->allowroleswaps = (null !== $col) ? (boolean) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -651,6 +657,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 6; // 6 = RoleTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Role'), 0, $e); } @@ -667,26 +674,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aGroup !== null && $this->groupid !== $this->aGroup->getId()) { $this->aGroup = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -715,19 +723,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->aGroup = null; $this->collUserRoles = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Role::setDeleted() * @see Role::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -757,12 +766,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -807,12 +816,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -859,22 +868,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[RoleTableMap::COL_ID] = true; @@ -914,21 +924,27 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'groupId': $stmt->bindValue($identifier, $this->groupid, PDO::PARAM_INT); + break; case 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; case 'rehersalId': $stmt->bindValue($identifier, $this->rehersalid, PDO::PARAM_INT); + break; case 'allowRoleSwaps': $stmt->bindValue($identifier, (int) $this->allowroleswaps, PDO::PARAM_INT); + break; } } @@ -951,12 +967,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -967,14 +983,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = RoleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -986,33 +1002,32 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getGroupId(); - break; + case 2: return $this->getName(); - break; + case 3: return $this->getDescription(); - break; + case 4: return $this->getRehersalId(); - break; + case 5: return $this->getAllowRoleSwaps(); - break; + default: return null; - break; } // switch() } @@ -1022,30 +1037,30 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Role'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Role'][$this->hashCode()] = true; $keys = RoleTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getGroupId(), $keys[2] => $this->getName(), $keys[3] => $this->getDescription(), $keys[4] => $this->getRehersalId(), $keys[5] => $this->getAllowRoleSwaps(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -1053,6 +1068,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aGroup) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'group'; @@ -1064,9 +1080,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Group'; } - $result[$key] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collUserRoles) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userRoles'; @@ -1088,30 +1105,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Role + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = RoleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Role + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1150,11 +1169,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = RoleTableMap::getFieldNames($keyType); @@ -1176,6 +1195,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[5], $arr)) { $this->setAllowRoleSwaps($arr[$keys[5]]); } + + return $this; } /** @@ -1195,9 +1216,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Role The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1211,9 +1232,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(RoleTableMap::DATABASE_NAME); @@ -1243,13 +1264,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildRoleQuery::create(); $criteria->add(RoleTableMap::COL_ID, $this->id); @@ -1261,7 +1282,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1291,19 +1312,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1314,12 +1336,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Role (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Role (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setGroupId($this->getGroupId()); $copyObj->setName($this->getName()); @@ -1337,11 +1360,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addUserRole($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1353,11 +1377,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Role Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1370,9 +1394,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildGroup object. * - * @param ChildGroup $v - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) - * @throws PropelException + * @param ChildGroup $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setGroup(ChildGroup $v = null) { @@ -1398,11 +1422,11 @@ public function setGroup(ChildGroup $v = null) /** * Get the associated ChildGroup object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildGroup The associated ChildGroup object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getGroup(ConnectionInterface $con = null) + public function getGroup(?ConnectionInterface $con = null) { if ($this->aGroup === null && ($this->groupid != 0)) { $this->aGroup = ChildGroupQuery::create()->findPk($this->groupid, $con); @@ -1424,12 +1448,12 @@ public function getGroup(ConnectionInterface $con = null) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('UserRole' == $relationName) { + if ('UserRole' === $relationName) { $this->initUserRoles(); return; } @@ -1441,18 +1465,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addUserRoles() + * @return $this + * @see addUserRoles() */ public function clearUserRoles() { $this->collUserRoles = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collUserRoles collection loaded partially. + * + * @return void */ - public function resetPartialUserRoles($v = true) + public function resetPartialUserRoles($v = true): void { $this->collUserRolesPartial = $v; } @@ -1464,12 +1492,12 @@ public function resetPartialUserRoles($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initUserRoles($overrideExisting = true) + public function initUserRoles(bool $overrideExisting = true): void { if (null !== $this->collUserRoles && !$overrideExisting) { return; @@ -1490,18 +1518,28 @@ public function initUserRoles($overrideExisting = true) * If this ChildRole is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildUserRole[] List of ChildUserRole objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildUserRole objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUserRoles(Criteria $criteria = null, ConnectionInterface $con = null) + public function getUserRoles(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collUserRolesPartial && !$this->isNew(); - if (null === $this->collUserRoles || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collUserRoles) { + if (null === $this->collUserRoles || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initUserRoles(); + if (null === $this->collUserRoles) { + $this->initUserRoles(); + } else { + $collectionClassName = UserRoleTableMap::getTableMap()->getCollectionClassName(); + + $collUserRoles = new $collectionClassName; + $collUserRoles->setModel('\TechWilk\Rota\UserRole'); + + return $collUserRoles; + } } else { $collUserRoles = ChildUserRoleQuery::create(null, $criteria) ->filterByRole($this) @@ -1545,11 +1583,11 @@ public function getUserRoles(Criteria $criteria = null, ConnectionInterface $con * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $userRoles A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildRole The current object (for fluent API support) + * @param Collection $userRoles A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setUserRoles(Collection $userRoles, ConnectionInterface $con = null) + public function setUserRoles(Collection $userRoles, ?ConnectionInterface $con = null) { /** @var ChildUserRole[] $userRolesToDelete */ $userRolesToDelete = $this->getUserRoles(new Criteria(), $con)->diff($userRoles); @@ -1575,13 +1613,13 @@ public function setUserRoles(Collection $userRoles, ConnectionInterface $con = n /** * Returns the number of related UserRole objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related UserRole objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related UserRole objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countUserRoles(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countUserRoles(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collUserRolesPartial && !$this->isNew(); if (null === $this->collUserRoles || null !== $criteria || $partial) { @@ -1610,8 +1648,8 @@ public function countUserRoles(Criteria $criteria = null, $distinct = false, Con * Method called to associate a ChildUserRole object to this object * through the ChildUserRole foreign key attribute. * - * @param ChildUserRole $l ChildUserRole - * @return $this|\TechWilk\Rota\Role The current object (for fluent API support) + * @param ChildUserRole $l ChildUserRole + * @return $this The current object (for fluent API support) */ public function addUserRole(ChildUserRole $l) { @@ -1634,15 +1672,15 @@ public function addUserRole(ChildUserRole $l) /** * @param ChildUserRole $userRole The ChildUserRole object to add. */ - protected function doAddUserRole(ChildUserRole $userRole) + protected function doAddUserRole(ChildUserRole $userRole): void { $this->collUserRoles[]= $userRole; $userRole->setRole($this); } /** - * @param ChildUserRole $userRole The ChildUserRole object to remove. - * @return $this|ChildRole The current object (for fluent API support) + * @param ChildUserRole $userRole The ChildUserRole object to remove. + * @return $this The current object (for fluent API support) */ public function removeUserRole(ChildUserRole $userRole) { @@ -1672,12 +1710,13 @@ public function removeUserRole(ChildUserRole $userRole) * api reasonable. You can provide public methods for those you * actually need in Role. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildUserRole[] List of ChildUserRole objects + * @phpstan-return ObjectCollection&\Traversable List of ChildUserRole objects */ - public function getUserRolesJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getUserRolesJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildUserRoleQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -1689,6 +1728,8 @@ public function getUserRolesJoinUser(Criteria $criteria = null, ConnectionInterf * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1707,6 +1748,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1715,9 +1758,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collUserRoles) { @@ -1729,6 +1773,7 @@ public function clearAllReferences($deep = false) $this->collUserRoles = null; $this->aGroup = null; + return $this; } /** @@ -1743,99 +1788,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1845,7 +1870,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1865,17 +1890,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/RoleQuery.php b/generated-classes/TechWilk/Rota/Base/RoleQuery.php index 432c73ba..e43ad0b0 100644 --- a/generated-classes/TechWilk/Rota/Base/RoleQuery.php +++ b/generated-classes/TechWilk/Rota/Base/RoleQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\RoleTableMap; /** - * Base class that represents a query for the 'roles' table. - * - * + * Base class that represents a query for the `roles` table. * * @method ChildRoleQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildRoleQuery orderByGroupId($order = Criteria::ASC) Order by the groupId column @@ -64,18 +63,18 @@ * * @method \TechWilk\Rota\GroupQuery|\TechWilk\Rota\UserRoleQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildRole findOne(ConnectionInterface $con = null) Return the first ChildRole matching the query - * @method ChildRole findOneOrCreate(ConnectionInterface $con = null) Return the first ChildRole matching the query, or a new ChildRole object populated from the query conditions when no match is found + * @method ChildRole|null findOne(?ConnectionInterface $con = null) Return the first ChildRole matching the query + * @method ChildRole findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildRole matching the query, or a new ChildRole object populated from the query conditions when no match is found * - * @method ChildRole findOneById(int $id) Return the first ChildRole filtered by the id column - * @method ChildRole findOneByGroupId(int $groupId) Return the first ChildRole filtered by the groupId column - * @method ChildRole findOneByName(string $name) Return the first ChildRole filtered by the name column - * @method ChildRole findOneByDescription(string $description) Return the first ChildRole filtered by the description column - * @method ChildRole findOneByRehersalId(int $rehersalId) Return the first ChildRole filtered by the rehersalId column - * @method ChildRole findOneByAllowRoleSwaps(boolean $allowRoleSwaps) Return the first ChildRole filtered by the allowRoleSwaps column * - - * @method ChildRole requirePk($key, ConnectionInterface $con = null) Return the ChildRole by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildRole requireOne(ConnectionInterface $con = null) Return the first ChildRole matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildRole|null findOneById(int $id) Return the first ChildRole filtered by the id column + * @method ChildRole|null findOneByGroupId(int $groupId) Return the first ChildRole filtered by the groupId column + * @method ChildRole|null findOneByName(string $name) Return the first ChildRole filtered by the name column + * @method ChildRole|null findOneByDescription(string $description) Return the first ChildRole filtered by the description column + * @method ChildRole|null findOneByRehersalId(int $rehersalId) Return the first ChildRole filtered by the rehersalId column + * @method ChildRole|null findOneByAllowRoleSwaps(boolean $allowRoleSwaps) Return the first ChildRole filtered by the allowRoleSwaps column + * + * @method ChildRole requirePk($key, ?ConnectionInterface $con = null) Return the ChildRole by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildRole requireOne(?ConnectionInterface $con = null) Return the first ChildRole matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildRole requireOneById(int $id) Return the first ChildRole filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildRole requireOneByGroupId(int $groupId) Return the first ChildRole filtered by the groupId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -84,15 +83,24 @@ * @method ChildRole requireOneByRehersalId(int $rehersalId) Return the first ChildRole filtered by the rehersalId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildRole requireOneByAllowRoleSwaps(boolean $allowRoleSwaps) Return the first ChildRole filtered by the allowRoleSwaps column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildRole[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildRole objects based on current ModelCriteria - * @method ChildRole[]|ObjectCollection findById(int $id) Return ChildRole objects filtered by the id column - * @method ChildRole[]|ObjectCollection findByGroupId(int $groupId) Return ChildRole objects filtered by the groupId column - * @method ChildRole[]|ObjectCollection findByName(string $name) Return ChildRole objects filtered by the name column - * @method ChildRole[]|ObjectCollection findByDescription(string $description) Return ChildRole objects filtered by the description column - * @method ChildRole[]|ObjectCollection findByRehersalId(int $rehersalId) Return ChildRole objects filtered by the rehersalId column - * @method ChildRole[]|ObjectCollection findByAllowRoleSwaps(boolean $allowRoleSwaps) Return ChildRole objects filtered by the allowRoleSwaps column - * @method ChildRole[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildRole[]|Collection find(?ConnectionInterface $con = null) Return ChildRole objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildRole objects based on current ModelCriteria + * + * @method ChildRole[]|Collection findById(int|array $id) Return ChildRole objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildRole objects filtered by the id column + * @method ChildRole[]|Collection findByGroupId(int|array $groupId) Return ChildRole objects filtered by the groupId column + * @psalm-method Collection&\Traversable findByGroupId(int|array $groupId) Return ChildRole objects filtered by the groupId column + * @method ChildRole[]|Collection findByName(string|array $name) Return ChildRole objects filtered by the name column + * @psalm-method Collection&\Traversable findByName(string|array $name) Return ChildRole objects filtered by the name column + * @method ChildRole[]|Collection findByDescription(string|array $description) Return ChildRole objects filtered by the description column + * @psalm-method Collection&\Traversable findByDescription(string|array $description) Return ChildRole objects filtered by the description column + * @method ChildRole[]|Collection findByRehersalId(int|array $rehersalId) Return ChildRole objects filtered by the rehersalId column + * @psalm-method Collection&\Traversable findByRehersalId(int|array $rehersalId) Return ChildRole objects filtered by the rehersalId column + * @method ChildRole[]|Collection findByAllowRoleSwaps(boolean|array $allowRoleSwaps) Return ChildRole objects filtered by the allowRoleSwaps column + * @psalm-method Collection&\Traversable findByAllowRoleSwaps(boolean|array $allowRoleSwaps) Return ChildRole objects filtered by the allowRoleSwaps column * + * @method ChildRole[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class RoleQuery extends ModelCriteria { @@ -101,9 +109,9 @@ abstract class RoleQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\RoleQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Role', $modelAlias = null) { @@ -113,12 +121,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildRoleQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildRoleQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildRoleQuery) { return $criteria; @@ -148,7 +156,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildRole|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -180,8 +188,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -213,8 +221,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildRole|array|mixed the result, formatted by the current formatter */ @@ -234,12 +242,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -256,25 +264,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(RoleTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(RoleTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(RoleTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(RoleTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -287,15 +301,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -315,7 +329,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(RoleTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(RoleTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -330,15 +346,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByGroup() * - * @param mixed $groupId The value to use as filter. + * @param mixed $groupId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByGroupId($groupId = null, $comparison = null) + public function filterByGroupId($groupId = null, ?string $comparison = null) { if (is_array($groupId)) { $useMinMax = false; @@ -358,7 +374,9 @@ public function filterByGroupId($groupId = null, $comparison = null) } } - return $this->addUsingAlias(RoleTableMap::COL_GROUPID, $groupId, $comparison); + $this->addUsingAlias(RoleTableMap::COL_GROUPID, $groupId, $comparison); + + return $this; } /** @@ -368,14 +386,15 @@ public function filterByGroupId($groupId = null, $comparison = null) * * $query->filterByName('fooValue'); // WHERE name = 'fooValue' * $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' + * $query->filterByName(['foo', 'bar']); // WHERE name IN ('foo', 'bar') * * - * @param string $name The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $name The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByName($name = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($name)) { @@ -383,7 +402,9 @@ public function filterByName($name = null, $comparison = null) } } - return $this->addUsingAlias(RoleTableMap::COL_NAME, $name, $comparison); + $this->addUsingAlias(RoleTableMap::COL_NAME, $name, $comparison); + + return $this; } /** @@ -393,14 +414,15 @@ public function filterByName($name = null, $comparison = null) * * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' * $query->filterByDescription('%fooValue%', Criteria::LIKE); // WHERE description LIKE '%fooValue%' + * $query->filterByDescription(['foo', 'bar']); // WHERE description IN ('foo', 'bar') * * - * @param string $description The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $description The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterByDescription($description = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($description)) { @@ -408,7 +430,9 @@ public function filterByDescription($description = null, $comparison = null) } } - return $this->addUsingAlias(RoleTableMap::COL_DESCRIPTION, $description, $comparison); + $this->addUsingAlias(RoleTableMap::COL_DESCRIPTION, $description, $comparison); + + return $this; } /** @@ -421,15 +445,15 @@ public function filterByDescription($description = null, $comparison = null) * $query->filterByRehersalId(array('min' => 12)); // WHERE rehersalId > 12 * * - * @param mixed $rehersalId The value to use as filter. + * @param mixed $rehersalId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRehersalId($rehersalId = null, $comparison = null) + public function filterByRehersalId($rehersalId = null, ?string $comparison = null) { if (is_array($rehersalId)) { $useMinMax = false; @@ -449,7 +473,9 @@ public function filterByRehersalId($rehersalId = null, $comparison = null) } } - return $this->addUsingAlias(RoleTableMap::COL_REHERSALID, $rehersalId, $comparison); + $this->addUsingAlias(RoleTableMap::COL_REHERSALID, $rehersalId, $comparison); + + return $this; } /** @@ -461,35 +487,37 @@ public function filterByRehersalId($rehersalId = null, $comparison = null) * $query->filterByAllowRoleSwaps('yes'); // WHERE allowRoleSwaps = true * * - * @param boolean|string $allowRoleSwaps The value to use as filter. + * @param bool|string $allowRoleSwaps The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAllowRoleSwaps($allowRoleSwaps = null, $comparison = null) + public function filterByAllowRoleSwaps($allowRoleSwaps = null, ?string $comparison = null) { if (is_string($allowRoleSwaps)) { - $allowRoleSwaps = in_array(strtolower($allowRoleSwaps), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $allowRoleSwaps = in_array(strtolower($allowRoleSwaps), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(RoleTableMap::COL_ALLOWROLESWAPS, $allowRoleSwaps, $comparison); + $this->addUsingAlias(RoleTableMap::COL_ALLOWROLESWAPS, $allowRoleSwaps, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\Group object * * @param \TechWilk\Rota\Group|ObjectCollection $group The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByGroup($group, $comparison = null) + public function filterByGroup($group, ?string $comparison = null) { if ($group instanceof \TechWilk\Rota\Group) { return $this @@ -499,8 +527,10 @@ public function filterByGroup($group, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(RoleTableMap::COL_GROUPID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByGroup() only accepts arguments of type \TechWilk\Rota\Group or Collection'); } @@ -509,12 +539,12 @@ public function filterByGroup($group, $comparison = null) /** * Adds a JOIN clause to the query using the Group relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinGroup(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Group'); @@ -543,9 +573,9 @@ public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\GroupQuery A secondary query class using the current class as primary query */ @@ -556,24 +586,124 @@ public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Group', '\TechWilk\Rota\GroupQuery'); } + /** + * Use the Group relation Group object + * + * @param callable(\TechWilk\Rota\GroupQuery):\TechWilk\Rota\GroupQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withGroupQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useGroupQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Group table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\GroupQuery The inner query object of the EXISTS statement + */ + public function useGroupExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\GroupQuery */ + $q = $this->useExistsQuery('Group', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Group table for a NOT EXISTS query. + * + * @see useGroupExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\GroupQuery The inner query object of the NOT EXISTS statement + */ + public function useGroupNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\GroupQuery */ + $q = $this->useExistsQuery('Group', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Group table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\GroupQuery The inner query object of the IN statement + */ + public function useInGroupQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\GroupQuery */ + $q = $this->useInQuery('Group', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Group table for a NOT IN query. + * + * @see useGroupInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\GroupQuery The inner query object of the NOT IN statement + */ + public function useNotInGroupQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\GroupQuery */ + $q = $this->useInQuery('Group', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\UserRole object * * @param \TechWilk\Rota\UserRole|ObjectCollection $userRole the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserRole($userRole, $comparison = null) + public function filterByUserRole($userRole, ?string $comparison = null) { if ($userRole instanceof \TechWilk\Rota\UserRole) { - return $this + $this ->addUsingAlias(RoleTableMap::COL_ID, $userRole->getRoleId(), $comparison); + + return $this; } elseif ($userRole instanceof ObjectCollection) { - return $this + $this ->useUserRoleQuery() ->filterByPrimaryKeys($userRole->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByUserRole() only accepts arguments of type \TechWilk\Rota\UserRole or Collection'); } @@ -582,12 +712,12 @@ public function filterByUserRole($userRole, $comparison = null) /** * Adds a JOIN clause to the query using the UserRole relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUserRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUserRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('UserRole'); @@ -616,9 +746,9 @@ public function joinUserRole($relationAlias = null, $joinType = Criteria::INNER_ * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserRoleQuery A secondary query class using the current class as primary query */ @@ -629,12 +759,108 @@ public function useUserRoleQuery($relationAlias = null, $joinType = Criteria::IN ->useQuery($relationAlias ? $relationAlias : 'UserRole', '\TechWilk\Rota\UserRoleQuery'); } + /** + * Use the UserRole relation UserRole object + * + * @param callable(\TechWilk\Rota\UserRoleQuery):\TechWilk\Rota\UserRoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to UserRole table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the EXISTS statement + */ + public function useUserRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('UserRole', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to UserRole table for a NOT EXISTS query. + * + * @see useUserRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT EXISTS statement + */ + public function useUserRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('UserRole', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to UserRole table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the IN statement + */ + public function useInUserRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('UserRole', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to UserRole table for a NOT IN query. + * + * @see useUserRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT IN statement + */ + public function useNotInUserRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('UserRole', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildRole $role Object to remove from the list of results + * @param ChildRole $role Object to remove from the list of results * - * @return $this|ChildRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($role = null) { @@ -651,7 +877,7 @@ public function prune($role = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME); @@ -676,12 +902,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME); @@ -705,4 +931,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // RoleQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Settings.php b/generated-classes/TechWilk/Rota/Base/Settings.php index ed9229c3..fac983c8 100644 --- a/generated-classes/TechWilk/Rota/Base/Settings.php +++ b/generated-classes/TechWilk/Rota/Base/Settings.php @@ -29,19 +29,21 @@ abstract class Settings implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\SettingsTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\SettingsTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -50,14 +52,14 @@ abstract class Settings implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the siteurl field. @@ -76,154 +78,154 @@ abstract class Settings implements ActiveRecordInterface /** * The value for the notificationemail field. * - * @var string + * @var string|null */ protected $notificationemail; /** * The value for the adminemailaddress field. * - * @var string + * @var string|null */ protected $adminemailaddress; /** * The value for the norehearsalemail field. * - * @var string + * @var string|null */ protected $norehearsalemail; /** * The value for the yesrehearsal field. * - * @var string + * @var string|null */ protected $yesrehearsal; /** * The value for the newusermessage field. * - * @var string + * @var string|null */ protected $newusermessage; /** * The value for the version field. * - * @var string + * @var string|null */ protected $version; /** * The value for the lang_locale field. * - * @var string + * @var string|null */ protected $lang_locale; /** * The value for the event_sorting_latest field. * - * @var int + * @var int|null */ protected $event_sorting_latest; /** * The value for the snapshot_show_two_month field. * - * @var int + * @var int|null */ protected $snapshot_show_two_month; /** * The value for the snapshot_reduce_skills_by_group field. * - * @var int + * @var int|null */ protected $snapshot_reduce_skills_by_group; /** * The value for the logged_in_show_snapshot_button field. * - * @var int + * @var int|null */ protected $logged_in_show_snapshot_button; /** * The value for the time_format_long field. * - * @var string + * @var string|null */ protected $time_format_long; /** * The value for the time_format_normal field. * - * @var string + * @var string|null */ protected $time_format_normal; /** * The value for the time_format_short field. * - * @var string + * @var string|null */ protected $time_format_short; /** * The value for the time_only_format field. * - * @var string + * @var string|null */ protected $time_only_format; /** * The value for the date_only_format field. * - * @var string + * @var string|null */ protected $date_only_format; /** * The value for the day_only_format field. * - * @var string + * @var string|null */ protected $day_only_format; /** * The value for the users_start_with_myevents field. * - * @var int + * @var int|null */ protected $users_start_with_myevents; /** * The value for the time_zone field. * - * @var string + * @var string|null */ protected $time_zone; /** * The value for the google_group_calendar field. * - * @var string + * @var string|null */ protected $google_group_calendar; /** * The value for the overviewemail field. * - * @var string + * @var string|null */ protected $overviewemail; /** * The value for the group_sorting_name field. * - * @var int + * @var int|null */ protected $group_sorting_name; @@ -231,7 +233,7 @@ abstract class Settings implements ActiveRecordInterface * The value for the debug_mode field. * * Note: this column has a database default value of: 0 - * @var int + * @var int|null */ protected $debug_mode; @@ -239,7 +241,7 @@ abstract class Settings implements ActiveRecordInterface * The value for the days_to_alert field. * * Note: this column has a database default value of: 5 - * @var int + * @var int|null */ protected $days_to_alert; @@ -247,7 +249,7 @@ abstract class Settings implements ActiveRecordInterface * The value for the token field. * * Note: this column has a database default value of: '' - * @var string + * @var string|null */ protected $token; @@ -255,7 +257,7 @@ abstract class Settings implements ActiveRecordInterface * The value for the skin field. * * Note: this column has a database default value of: '' - * @var string + * @var string|null */ protected $skin; @@ -263,7 +265,7 @@ abstract class Settings implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -273,7 +275,7 @@ abstract class Settings implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->debug_mode = 0; $this->days_to_alert = 5; @@ -293,9 +295,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -303,10 +305,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -315,7 +317,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -325,9 +327,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -336,45 +338,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -383,10 +383,10 @@ public function resetModified($col = null) * obj is an instance of Settings, delegates to * equals(Settings). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -408,7 +408,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -416,10 +416,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -427,15 +427,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -444,12 +444,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Settings The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -459,13 +459,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -476,24 +476,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -501,7 +504,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -531,7 +534,7 @@ public function getOwner() /** * Get the [notificationemail] column value. * - * @return string + * @return string|null */ public function getNotificationEmail() { @@ -541,7 +544,7 @@ public function getNotificationEmail() /** * Get the [adminemailaddress] column value. * - * @return string + * @return string|null */ public function getAdminEmailAddress() { @@ -551,7 +554,7 @@ public function getAdminEmailAddress() /** * Get the [norehearsalemail] column value. * - * @return string + * @return string|null */ public function getNoRehearsalEmail() { @@ -561,7 +564,7 @@ public function getNoRehearsalEmail() /** * Get the [yesrehearsal] column value. * - * @return string + * @return string|null */ public function getYesRehearsal() { @@ -571,7 +574,7 @@ public function getYesRehearsal() /** * Get the [newusermessage] column value. * - * @return string + * @return string|null */ public function getNewUserMessage() { @@ -581,7 +584,7 @@ public function getNewUserMessage() /** * Get the [version] column value. * - * @return string + * @return string|null */ public function getVersion() { @@ -591,7 +594,7 @@ public function getVersion() /** * Get the [lang_locale] column value. * - * @return string + * @return string|null */ public function getLangLocale() { @@ -601,7 +604,7 @@ public function getLangLocale() /** * Get the [event_sorting_latest] column value. * - * @return int + * @return int|null */ public function getEventSortingLatest() { @@ -611,7 +614,7 @@ public function getEventSortingLatest() /** * Get the [snapshot_show_two_month] column value. * - * @return int + * @return int|null */ public function getSnapshotShowTwoMonth() { @@ -621,7 +624,7 @@ public function getSnapshotShowTwoMonth() /** * Get the [snapshot_reduce_skills_by_group] column value. * - * @return int + * @return int|null */ public function getSnapshotReduceSkillsByGroup() { @@ -631,7 +634,7 @@ public function getSnapshotReduceSkillsByGroup() /** * Get the [logged_in_show_snapshot_button] column value. * - * @return int + * @return int|null */ public function getLoggedInShowSnapshotButton() { @@ -641,7 +644,7 @@ public function getLoggedInShowSnapshotButton() /** * Get the [time_format_long] column value. * - * @return string + * @return string|null */ public function getTimeFormatLong() { @@ -651,7 +654,7 @@ public function getTimeFormatLong() /** * Get the [time_format_normal] column value. * - * @return string + * @return string|null */ public function getTimeFormatNormal() { @@ -661,7 +664,7 @@ public function getTimeFormatNormal() /** * Get the [time_format_short] column value. * - * @return string + * @return string|null */ public function getTimeFormatShort() { @@ -671,7 +674,7 @@ public function getTimeFormatShort() /** * Get the [time_only_format] column value. * - * @return string + * @return string|null */ public function getTimeOnlyFormat() { @@ -681,7 +684,7 @@ public function getTimeOnlyFormat() /** * Get the [date_only_format] column value. * - * @return string + * @return string|null */ public function getDateOnlyFormat() { @@ -691,7 +694,7 @@ public function getDateOnlyFormat() /** * Get the [day_only_format] column value. * - * @return string + * @return string|null */ public function getDayOnlyFormat() { @@ -701,7 +704,7 @@ public function getDayOnlyFormat() /** * Get the [users_start_with_myevents] column value. * - * @return int + * @return int|null */ public function getUsersStartWithMyEvents() { @@ -711,7 +714,7 @@ public function getUsersStartWithMyEvents() /** * Get the [time_zone] column value. * - * @return string + * @return string|null */ public function getTimeZone() { @@ -721,7 +724,7 @@ public function getTimeZone() /** * Get the [google_group_calendar] column value. * - * @return string + * @return string|null */ public function getGoogleGroupCalendar() { @@ -731,7 +734,7 @@ public function getGoogleGroupCalendar() /** * Get the [overviewemail] column value. * - * @return string + * @return string|null */ public function getOverviewEmail() { @@ -741,7 +744,7 @@ public function getOverviewEmail() /** * Get the [group_sorting_name] column value. * - * @return int + * @return int|null */ public function getGroupSortingName() { @@ -751,7 +754,7 @@ public function getGroupSortingName() /** * Get the [debug_mode] column value. * - * @return int + * @return int|null */ public function getDebugMode() { @@ -761,7 +764,7 @@ public function getDebugMode() /** * Get the [days_to_alert] column value. * - * @return int + * @return int|null */ public function getDaysToAlert() { @@ -771,7 +774,7 @@ public function getDaysToAlert() /** * Get the [token] column value. * - * @return string + * @return string|null */ public function getToken() { @@ -781,7 +784,7 @@ public function getToken() /** * Get the [skin] column value. * - * @return string + * @return string|null */ public function getSkin() { @@ -791,8 +794,8 @@ public function getSkin() /** * Set the value of [siteurl] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setSiteUrl($v) { @@ -806,13 +809,13 @@ public function setSiteUrl($v) } return $this; - } // setSiteUrl() + } /** * Set the value of [owner] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setOwner($v) { @@ -826,13 +829,13 @@ public function setOwner($v) } return $this; - } // setOwner() + } /** * Set the value of [notificationemail] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setNotificationEmail($v) { @@ -846,13 +849,13 @@ public function setNotificationEmail($v) } return $this; - } // setNotificationEmail() + } /** * Set the value of [adminemailaddress] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setAdminEmailAddress($v) { @@ -866,13 +869,13 @@ public function setAdminEmailAddress($v) } return $this; - } // setAdminEmailAddress() + } /** * Set the value of [norehearsalemail] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setNoRehearsalEmail($v) { @@ -886,13 +889,13 @@ public function setNoRehearsalEmail($v) } return $this; - } // setNoRehearsalEmail() + } /** * Set the value of [yesrehearsal] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setYesRehearsal($v) { @@ -906,13 +909,13 @@ public function setYesRehearsal($v) } return $this; - } // setYesRehearsal() + } /** * Set the value of [newusermessage] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setNewUserMessage($v) { @@ -926,13 +929,13 @@ public function setNewUserMessage($v) } return $this; - } // setNewUserMessage() + } /** * Set the value of [version] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setVersion($v) { @@ -946,13 +949,13 @@ public function setVersion($v) } return $this; - } // setVersion() + } /** * Set the value of [lang_locale] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setLangLocale($v) { @@ -966,13 +969,13 @@ public function setLangLocale($v) } return $this; - } // setLangLocale() + } /** * Set the value of [event_sorting_latest] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setEventSortingLatest($v) { @@ -986,13 +989,13 @@ public function setEventSortingLatest($v) } return $this; - } // setEventSortingLatest() + } /** * Set the value of [snapshot_show_two_month] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setSnapshotShowTwoMonth($v) { @@ -1006,13 +1009,13 @@ public function setSnapshotShowTwoMonth($v) } return $this; - } // setSnapshotShowTwoMonth() + } /** * Set the value of [snapshot_reduce_skills_by_group] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setSnapshotReduceSkillsByGroup($v) { @@ -1026,13 +1029,13 @@ public function setSnapshotReduceSkillsByGroup($v) } return $this; - } // setSnapshotReduceSkillsByGroup() + } /** * Set the value of [logged_in_show_snapshot_button] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setLoggedInShowSnapshotButton($v) { @@ -1046,13 +1049,13 @@ public function setLoggedInShowSnapshotButton($v) } return $this; - } // setLoggedInShowSnapshotButton() + } /** * Set the value of [time_format_long] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setTimeFormatLong($v) { @@ -1066,13 +1069,13 @@ public function setTimeFormatLong($v) } return $this; - } // setTimeFormatLong() + } /** * Set the value of [time_format_normal] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setTimeFormatNormal($v) { @@ -1086,13 +1089,13 @@ public function setTimeFormatNormal($v) } return $this; - } // setTimeFormatNormal() + } /** * Set the value of [time_format_short] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setTimeFormatShort($v) { @@ -1106,13 +1109,13 @@ public function setTimeFormatShort($v) } return $this; - } // setTimeFormatShort() + } /** * Set the value of [time_only_format] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setTimeOnlyFormat($v) { @@ -1126,13 +1129,13 @@ public function setTimeOnlyFormat($v) } return $this; - } // setTimeOnlyFormat() + } /** * Set the value of [date_only_format] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setDateOnlyFormat($v) { @@ -1146,13 +1149,13 @@ public function setDateOnlyFormat($v) } return $this; - } // setDateOnlyFormat() + } /** * Set the value of [day_only_format] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setDayOnlyFormat($v) { @@ -1166,13 +1169,13 @@ public function setDayOnlyFormat($v) } return $this; - } // setDayOnlyFormat() + } /** * Set the value of [users_start_with_myevents] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setUsersStartWithMyEvents($v) { @@ -1186,13 +1189,13 @@ public function setUsersStartWithMyEvents($v) } return $this; - } // setUsersStartWithMyEvents() + } /** * Set the value of [time_zone] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setTimeZone($v) { @@ -1206,13 +1209,13 @@ public function setTimeZone($v) } return $this; - } // setTimeZone() + } /** * Set the value of [google_group_calendar] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setGoogleGroupCalendar($v) { @@ -1226,13 +1229,13 @@ public function setGoogleGroupCalendar($v) } return $this; - } // setGoogleGroupCalendar() + } /** * Set the value of [overviewemail] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setOverviewEmail($v) { @@ -1246,13 +1249,13 @@ public function setOverviewEmail($v) } return $this; - } // setOverviewEmail() + } /** * Set the value of [group_sorting_name] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setGroupSortingName($v) { @@ -1266,13 +1269,13 @@ public function setGroupSortingName($v) } return $this; - } // setGroupSortingName() + } /** * Set the value of [debug_mode] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setDebugMode($v) { @@ -1286,13 +1289,13 @@ public function setDebugMode($v) } return $this; - } // setDebugMode() + } /** * Set the value of [days_to_alert] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setDaysToAlert($v) { @@ -1306,13 +1309,13 @@ public function setDaysToAlert($v) } return $this; - } // setDaysToAlert() + } /** * Set the value of [token] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setToken($v) { @@ -1326,13 +1329,13 @@ public function setToken($v) } return $this; - } // setToken() + } /** * Set the value of [skin] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Settings The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setSkin($v) { @@ -1346,7 +1349,7 @@ public function setSkin($v) } return $this; - } // setSkin() + } /** * Indicates whether the columns in this object are only set to default values. @@ -1354,29 +1357,29 @@ public function setSkin($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->debug_mode !== 0) { - return false; - } + if ($this->debug_mode !== 0) { + return false; + } - if ($this->days_to_alert !== 5) { - return false; - } + if ($this->days_to_alert !== 5) { + return false; + } - if ($this->token !== '') { - return false; - } + if ($this->token !== '') { + return false; + } - if ($this->skin !== '') { - return false; - } + if ($this->skin !== '') { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -1386,19 +1389,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : SettingsTableMap::translateFieldName('SiteUrl', TableMap::TYPE_PHPNAME, $indexType)]; $this->siteurl = (null !== $col) ? (string) $col : null; @@ -1482,8 +1486,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 27 + $startcol : SettingsTableMap::translateFieldName('Skin', TableMap::TYPE_PHPNAME, $indexType)]; $this->skin = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -1491,6 +1495,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 28; // 28 = SettingsTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Settings'), 0, $e); } @@ -1507,23 +1512,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -1549,19 +1555,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate if ($deep) { // also de-associate any related objects? + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Settings::setDeleted() * @see Settings::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -1591,12 +1598,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -1641,12 +1648,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -1664,22 +1671,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; @@ -1781,87 +1789,115 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'siteurl': $stmt->bindValue($identifier, $this->siteurl, PDO::PARAM_STR); + break; case 'owner': $stmt->bindValue($identifier, $this->owner, PDO::PARAM_STR); + break; case 'notificationemail': $stmt->bindValue($identifier, $this->notificationemail, PDO::PARAM_STR); + break; case 'adminemailaddress': $stmt->bindValue($identifier, $this->adminemailaddress, PDO::PARAM_STR); + break; case 'norehearsalemail': $stmt->bindValue($identifier, $this->norehearsalemail, PDO::PARAM_STR); + break; case 'yesrehearsal': $stmt->bindValue($identifier, $this->yesrehearsal, PDO::PARAM_STR); + break; case 'newusermessage': $stmt->bindValue($identifier, $this->newusermessage, PDO::PARAM_STR); + break; case 'version': $stmt->bindValue($identifier, $this->version, PDO::PARAM_STR); + break; case 'lang_locale': $stmt->bindValue($identifier, $this->lang_locale, PDO::PARAM_STR); + break; case 'event_sorting_latest': $stmt->bindValue($identifier, $this->event_sorting_latest, PDO::PARAM_INT); + break; case 'snapshot_show_two_month': $stmt->bindValue($identifier, $this->snapshot_show_two_month, PDO::PARAM_INT); + break; case 'snapshot_reduce_skills_by_group': $stmt->bindValue($identifier, $this->snapshot_reduce_skills_by_group, PDO::PARAM_INT); + break; case 'logged_in_show_snapshot_button': $stmt->bindValue($identifier, $this->logged_in_show_snapshot_button, PDO::PARAM_INT); + break; case 'time_format_long': $stmt->bindValue($identifier, $this->time_format_long, PDO::PARAM_STR); + break; case 'time_format_normal': $stmt->bindValue($identifier, $this->time_format_normal, PDO::PARAM_STR); + break; case 'time_format_short': $stmt->bindValue($identifier, $this->time_format_short, PDO::PARAM_STR); + break; case 'time_only_format': $stmt->bindValue($identifier, $this->time_only_format, PDO::PARAM_STR); + break; case 'date_only_format': $stmt->bindValue($identifier, $this->date_only_format, PDO::PARAM_STR); + break; case 'day_only_format': $stmt->bindValue($identifier, $this->day_only_format, PDO::PARAM_STR); + break; case 'users_start_with_myevents': $stmt->bindValue($identifier, $this->users_start_with_myevents, PDO::PARAM_INT); + break; case 'time_zone': $stmt->bindValue($identifier, $this->time_zone, PDO::PARAM_STR); + break; case 'google_group_calendar': $stmt->bindValue($identifier, $this->google_group_calendar, PDO::PARAM_STR); + break; case 'overviewemail': $stmt->bindValue($identifier, $this->overviewemail, PDO::PARAM_STR); + break; case 'group_sorting_name': $stmt->bindValue($identifier, $this->group_sorting_name, PDO::PARAM_INT); + break; case 'debug_mode': $stmt->bindValue($identifier, $this->debug_mode, PDO::PARAM_INT); + break; case 'days_to_alert': $stmt->bindValue($identifier, $this->days_to_alert, PDO::PARAM_INT); + break; case 'token': $stmt->bindValue($identifier, $this->token, PDO::PARAM_STR); + break; case 'skin': $stmt->bindValue($identifier, $this->skin, PDO::PARAM_STR); + break; } } @@ -1877,12 +1913,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1893,14 +1929,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = SettingsTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1912,99 +1948,98 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getSiteUrl(); - break; + case 1: return $this->getOwner(); - break; + case 2: return $this->getNotificationEmail(); - break; + case 3: return $this->getAdminEmailAddress(); - break; + case 4: return $this->getNoRehearsalEmail(); - break; + case 5: return $this->getYesRehearsal(); - break; + case 6: return $this->getNewUserMessage(); - break; + case 7: return $this->getVersion(); - break; + case 8: return $this->getLangLocale(); - break; + case 9: return $this->getEventSortingLatest(); - break; + case 10: return $this->getSnapshotShowTwoMonth(); - break; + case 11: return $this->getSnapshotReduceSkillsByGroup(); - break; + case 12: return $this->getLoggedInShowSnapshotButton(); - break; + case 13: return $this->getTimeFormatLong(); - break; + case 14: return $this->getTimeFormatNormal(); - break; + case 15: return $this->getTimeFormatShort(); - break; + case 16: return $this->getTimeOnlyFormat(); - break; + case 17: return $this->getDateOnlyFormat(); - break; + case 18: return $this->getDayOnlyFormat(); - break; + case 19: return $this->getUsersStartWithMyEvents(); - break; + case 20: return $this->getTimeZone(); - break; + case 21: return $this->getGoogleGroupCalendar(); - break; + case 22: return $this->getOverviewEmail(); - break; + case 23: return $this->getGroupSortingName(); - break; + case 24: return $this->getDebugMode(); - break; + case 25: return $this->getDaysToAlert(); - break; + case 26: return $this->getToken(); - break; + case 27: return $this->getSkin(); - break; + default: return null; - break; } // switch() } @@ -2014,22 +2049,22 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array()) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = []): array { if (isset($alreadyDumpedObjects['Settings'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Settings'][$this->hashCode()] = true; $keys = SettingsTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getSiteUrl(), $keys[1] => $this->getOwner(), $keys[2] => $this->getNotificationEmail(), @@ -2058,7 +2093,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[25] => $this->getDaysToAlert(), $keys[26] => $this->getToken(), $keys[27] => $this->getSkin(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -2071,30 +2106,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Settings + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = SettingsTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Settings + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -2199,11 +2236,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = SettingsTableMap::getFieldNames($keyType); @@ -2291,6 +2328,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[27], $arr)) { $this->setSkin($arr[$keys[27]]); } + + return $this; } /** @@ -2310,9 +2349,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Settings The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -2326,9 +2365,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(SettingsTableMap::DATABASE_NAME); @@ -2424,13 +2463,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { throw new LogicException('The Settings object has no primary key'); @@ -2441,7 +2480,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -2469,27 +2508,14 @@ public function getPrimaryKey() return null; } - /** - * Dummy primary key setter. - * - * This function only exists to preserve backwards compatibility. It is no longer - * needed or required by the Persistent interface. It will be removed in next BC-breaking - * release of Propel. - * - * @deprecated - */ - public function setPrimaryKey($pk) - { - // do nothing, because this object doesn't have any primary keys - } - /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { - return ; + return false; } /** @@ -2498,12 +2524,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Settings (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Settings (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setSiteUrl($this->getSiteUrl()); $copyObj->setOwner($this->getOwner()); @@ -2546,11 +2573,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Settings Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -2564,6 +2591,8 @@ public function copy($deepCopy = false) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -2601,6 +2630,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -2609,12 +2640,15 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) + + return $this; } /** @@ -2629,99 +2663,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -2731,7 +2745,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -2751,17 +2765,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/SettingsQuery.php b/generated-classes/TechWilk/Rota/Base/SettingsQuery.php index 3a110211..cb193963 100644 --- a/generated-classes/TechWilk/Rota/Base/SettingsQuery.php +++ b/generated-classes/TechWilk/Rota/Base/SettingsQuery.php @@ -6,7 +6,7 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\Collection\ObjectCollection; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\LogicException; use Propel\Runtime\Exception\PropelException; @@ -15,9 +15,7 @@ use TechWilk\Rota\Map\SettingsTableMap; /** - * Base class that represents a query for the 'settings' table. - * - * + * Base class that represents a query for the `settings` table. * * @method ChildSettingsQuery orderBySiteUrl($order = Criteria::ASC) Order by the siteurl column * @method ChildSettingsQuery orderByOwner($order = Criteria::ASC) Order by the owner column @@ -85,40 +83,40 @@ * @method ChildSettingsQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query * @method ChildSettingsQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query * - * @method ChildSettings findOne(ConnectionInterface $con = null) Return the first ChildSettings matching the query - * @method ChildSettings findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSettings matching the query, or a new ChildSettings object populated from the query conditions when no match is found + * @method ChildSettings|null findOne(?ConnectionInterface $con = null) Return the first ChildSettings matching the query + * @method ChildSettings findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildSettings matching the query, or a new ChildSettings object populated from the query conditions when no match is found * - * @method ChildSettings findOneBySiteUrl(string $siteurl) Return the first ChildSettings filtered by the siteurl column - * @method ChildSettings findOneByOwner(string $owner) Return the first ChildSettings filtered by the owner column - * @method ChildSettings findOneByNotificationEmail(string $notificationemail) Return the first ChildSettings filtered by the notificationemail column - * @method ChildSettings findOneByAdminEmailAddress(string $adminemailaddress) Return the first ChildSettings filtered by the adminemailaddress column - * @method ChildSettings findOneByNoRehearsalEmail(string $norehearsalemail) Return the first ChildSettings filtered by the norehearsalemail column - * @method ChildSettings findOneByYesRehearsal(string $yesrehearsal) Return the first ChildSettings filtered by the yesrehearsal column - * @method ChildSettings findOneByNewUserMessage(string $newusermessage) Return the first ChildSettings filtered by the newusermessage column - * @method ChildSettings findOneByVersion(string $version) Return the first ChildSettings filtered by the version column - * @method ChildSettings findOneByLangLocale(string $lang_locale) Return the first ChildSettings filtered by the lang_locale column - * @method ChildSettings findOneByEventSortingLatest(int $event_sorting_latest) Return the first ChildSettings filtered by the event_sorting_latest column - * @method ChildSettings findOneBySnapshotShowTwoMonth(int $snapshot_show_two_month) Return the first ChildSettings filtered by the snapshot_show_two_month column - * @method ChildSettings findOneBySnapshotReduceSkillsByGroup(int $snapshot_reduce_skills_by_group) Return the first ChildSettings filtered by the snapshot_reduce_skills_by_group column - * @method ChildSettings findOneByLoggedInShowSnapshotButton(int $logged_in_show_snapshot_button) Return the first ChildSettings filtered by the logged_in_show_snapshot_button column - * @method ChildSettings findOneByTimeFormatLong(string $time_format_long) Return the first ChildSettings filtered by the time_format_long column - * @method ChildSettings findOneByTimeFormatNormal(string $time_format_normal) Return the first ChildSettings filtered by the time_format_normal column - * @method ChildSettings findOneByTimeFormatShort(string $time_format_short) Return the first ChildSettings filtered by the time_format_short column - * @method ChildSettings findOneByTimeOnlyFormat(string $time_only_format) Return the first ChildSettings filtered by the time_only_format column - * @method ChildSettings findOneByDateOnlyFormat(string $date_only_format) Return the first ChildSettings filtered by the date_only_format column - * @method ChildSettings findOneByDayOnlyFormat(string $day_only_format) Return the first ChildSettings filtered by the day_only_format column - * @method ChildSettings findOneByUsersStartWithMyEvents(int $users_start_with_myevents) Return the first ChildSettings filtered by the users_start_with_myevents column - * @method ChildSettings findOneByTimeZone(string $time_zone) Return the first ChildSettings filtered by the time_zone column - * @method ChildSettings findOneByGoogleGroupCalendar(string $google_group_calendar) Return the first ChildSettings filtered by the google_group_calendar column - * @method ChildSettings findOneByOverviewEmail(string $overviewemail) Return the first ChildSettings filtered by the overviewemail column - * @method ChildSettings findOneByGroupSortingName(int $group_sorting_name) Return the first ChildSettings filtered by the group_sorting_name column - * @method ChildSettings findOneByDebugMode(int $debug_mode) Return the first ChildSettings filtered by the debug_mode column - * @method ChildSettings findOneByDaysToAlert(int $days_to_alert) Return the first ChildSettings filtered by the days_to_alert column - * @method ChildSettings findOneByToken(string $token) Return the first ChildSettings filtered by the token column - * @method ChildSettings findOneBySkin(string $skin) Return the first ChildSettings filtered by the skin column * - - * @method ChildSettings requirePk($key, ConnectionInterface $con = null) Return the ChildSettings by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildSettings requireOne(ConnectionInterface $con = null) Return the first ChildSettings matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildSettings|null findOneBySiteUrl(string $siteurl) Return the first ChildSettings filtered by the siteurl column + * @method ChildSettings|null findOneByOwner(string $owner) Return the first ChildSettings filtered by the owner column + * @method ChildSettings|null findOneByNotificationEmail(string $notificationemail) Return the first ChildSettings filtered by the notificationemail column + * @method ChildSettings|null findOneByAdminEmailAddress(string $adminemailaddress) Return the first ChildSettings filtered by the adminemailaddress column + * @method ChildSettings|null findOneByNoRehearsalEmail(string $norehearsalemail) Return the first ChildSettings filtered by the norehearsalemail column + * @method ChildSettings|null findOneByYesRehearsal(string $yesrehearsal) Return the first ChildSettings filtered by the yesrehearsal column + * @method ChildSettings|null findOneByNewUserMessage(string $newusermessage) Return the first ChildSettings filtered by the newusermessage column + * @method ChildSettings|null findOneByVersion(string $version) Return the first ChildSettings filtered by the version column + * @method ChildSettings|null findOneByLangLocale(string $lang_locale) Return the first ChildSettings filtered by the lang_locale column + * @method ChildSettings|null findOneByEventSortingLatest(int $event_sorting_latest) Return the first ChildSettings filtered by the event_sorting_latest column + * @method ChildSettings|null findOneBySnapshotShowTwoMonth(int $snapshot_show_two_month) Return the first ChildSettings filtered by the snapshot_show_two_month column + * @method ChildSettings|null findOneBySnapshotReduceSkillsByGroup(int $snapshot_reduce_skills_by_group) Return the first ChildSettings filtered by the snapshot_reduce_skills_by_group column + * @method ChildSettings|null findOneByLoggedInShowSnapshotButton(int $logged_in_show_snapshot_button) Return the first ChildSettings filtered by the logged_in_show_snapshot_button column + * @method ChildSettings|null findOneByTimeFormatLong(string $time_format_long) Return the first ChildSettings filtered by the time_format_long column + * @method ChildSettings|null findOneByTimeFormatNormal(string $time_format_normal) Return the first ChildSettings filtered by the time_format_normal column + * @method ChildSettings|null findOneByTimeFormatShort(string $time_format_short) Return the first ChildSettings filtered by the time_format_short column + * @method ChildSettings|null findOneByTimeOnlyFormat(string $time_only_format) Return the first ChildSettings filtered by the time_only_format column + * @method ChildSettings|null findOneByDateOnlyFormat(string $date_only_format) Return the first ChildSettings filtered by the date_only_format column + * @method ChildSettings|null findOneByDayOnlyFormat(string $day_only_format) Return the first ChildSettings filtered by the day_only_format column + * @method ChildSettings|null findOneByUsersStartWithMyEvents(int $users_start_with_myevents) Return the first ChildSettings filtered by the users_start_with_myevents column + * @method ChildSettings|null findOneByTimeZone(string $time_zone) Return the first ChildSettings filtered by the time_zone column + * @method ChildSettings|null findOneByGoogleGroupCalendar(string $google_group_calendar) Return the first ChildSettings filtered by the google_group_calendar column + * @method ChildSettings|null findOneByOverviewEmail(string $overviewemail) Return the first ChildSettings filtered by the overviewemail column + * @method ChildSettings|null findOneByGroupSortingName(int $group_sorting_name) Return the first ChildSettings filtered by the group_sorting_name column + * @method ChildSettings|null findOneByDebugMode(int $debug_mode) Return the first ChildSettings filtered by the debug_mode column + * @method ChildSettings|null findOneByDaysToAlert(int $days_to_alert) Return the first ChildSettings filtered by the days_to_alert column + * @method ChildSettings|null findOneByToken(string $token) Return the first ChildSettings filtered by the token column + * @method ChildSettings|null findOneBySkin(string $skin) Return the first ChildSettings filtered by the skin column + * + * @method ChildSettings requirePk($key, ?ConnectionInterface $con = null) Return the ChildSettings by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildSettings requireOne(?ConnectionInterface $con = null) Return the first ChildSettings matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildSettings requireOneBySiteUrl(string $siteurl) Return the first ChildSettings filtered by the siteurl column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildSettings requireOneByOwner(string $owner) Return the first ChildSettings filtered by the owner column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -149,37 +147,68 @@ * @method ChildSettings requireOneByToken(string $token) Return the first ChildSettings filtered by the token column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildSettings requireOneBySkin(string $skin) Return the first ChildSettings filtered by the skin column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildSettings[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildSettings objects based on current ModelCriteria - * @method ChildSettings[]|ObjectCollection findBySiteUrl(string $siteurl) Return ChildSettings objects filtered by the siteurl column - * @method ChildSettings[]|ObjectCollection findByOwner(string $owner) Return ChildSettings objects filtered by the owner column - * @method ChildSettings[]|ObjectCollection findByNotificationEmail(string $notificationemail) Return ChildSettings objects filtered by the notificationemail column - * @method ChildSettings[]|ObjectCollection findByAdminEmailAddress(string $adminemailaddress) Return ChildSettings objects filtered by the adminemailaddress column - * @method ChildSettings[]|ObjectCollection findByNoRehearsalEmail(string $norehearsalemail) Return ChildSettings objects filtered by the norehearsalemail column - * @method ChildSettings[]|ObjectCollection findByYesRehearsal(string $yesrehearsal) Return ChildSettings objects filtered by the yesrehearsal column - * @method ChildSettings[]|ObjectCollection findByNewUserMessage(string $newusermessage) Return ChildSettings objects filtered by the newusermessage column - * @method ChildSettings[]|ObjectCollection findByVersion(string $version) Return ChildSettings objects filtered by the version column - * @method ChildSettings[]|ObjectCollection findByLangLocale(string $lang_locale) Return ChildSettings objects filtered by the lang_locale column - * @method ChildSettings[]|ObjectCollection findByEventSortingLatest(int $event_sorting_latest) Return ChildSettings objects filtered by the event_sorting_latest column - * @method ChildSettings[]|ObjectCollection findBySnapshotShowTwoMonth(int $snapshot_show_two_month) Return ChildSettings objects filtered by the snapshot_show_two_month column - * @method ChildSettings[]|ObjectCollection findBySnapshotReduceSkillsByGroup(int $snapshot_reduce_skills_by_group) Return ChildSettings objects filtered by the snapshot_reduce_skills_by_group column - * @method ChildSettings[]|ObjectCollection findByLoggedInShowSnapshotButton(int $logged_in_show_snapshot_button) Return ChildSettings objects filtered by the logged_in_show_snapshot_button column - * @method ChildSettings[]|ObjectCollection findByTimeFormatLong(string $time_format_long) Return ChildSettings objects filtered by the time_format_long column - * @method ChildSettings[]|ObjectCollection findByTimeFormatNormal(string $time_format_normal) Return ChildSettings objects filtered by the time_format_normal column - * @method ChildSettings[]|ObjectCollection findByTimeFormatShort(string $time_format_short) Return ChildSettings objects filtered by the time_format_short column - * @method ChildSettings[]|ObjectCollection findByTimeOnlyFormat(string $time_only_format) Return ChildSettings objects filtered by the time_only_format column - * @method ChildSettings[]|ObjectCollection findByDateOnlyFormat(string $date_only_format) Return ChildSettings objects filtered by the date_only_format column - * @method ChildSettings[]|ObjectCollection findByDayOnlyFormat(string $day_only_format) Return ChildSettings objects filtered by the day_only_format column - * @method ChildSettings[]|ObjectCollection findByUsersStartWithMyEvents(int $users_start_with_myevents) Return ChildSettings objects filtered by the users_start_with_myevents column - * @method ChildSettings[]|ObjectCollection findByTimeZone(string $time_zone) Return ChildSettings objects filtered by the time_zone column - * @method ChildSettings[]|ObjectCollection findByGoogleGroupCalendar(string $google_group_calendar) Return ChildSettings objects filtered by the google_group_calendar column - * @method ChildSettings[]|ObjectCollection findByOverviewEmail(string $overviewemail) Return ChildSettings objects filtered by the overviewemail column - * @method ChildSettings[]|ObjectCollection findByGroupSortingName(int $group_sorting_name) Return ChildSettings objects filtered by the group_sorting_name column - * @method ChildSettings[]|ObjectCollection findByDebugMode(int $debug_mode) Return ChildSettings objects filtered by the debug_mode column - * @method ChildSettings[]|ObjectCollection findByDaysToAlert(int $days_to_alert) Return ChildSettings objects filtered by the days_to_alert column - * @method ChildSettings[]|ObjectCollection findByToken(string $token) Return ChildSettings objects filtered by the token column - * @method ChildSettings[]|ObjectCollection findBySkin(string $skin) Return ChildSettings objects filtered by the skin column - * @method ChildSettings[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildSettings[]|Collection find(?ConnectionInterface $con = null) Return ChildSettings objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildSettings objects based on current ModelCriteria + * + * @method ChildSettings[]|Collection findBySiteUrl(string|array $siteurl) Return ChildSettings objects filtered by the siteurl column + * @psalm-method Collection&\Traversable findBySiteUrl(string|array $siteurl) Return ChildSettings objects filtered by the siteurl column + * @method ChildSettings[]|Collection findByOwner(string|array $owner) Return ChildSettings objects filtered by the owner column + * @psalm-method Collection&\Traversable findByOwner(string|array $owner) Return ChildSettings objects filtered by the owner column + * @method ChildSettings[]|Collection findByNotificationEmail(string|array $notificationemail) Return ChildSettings objects filtered by the notificationemail column + * @psalm-method Collection&\Traversable findByNotificationEmail(string|array $notificationemail) Return ChildSettings objects filtered by the notificationemail column + * @method ChildSettings[]|Collection findByAdminEmailAddress(string|array $adminemailaddress) Return ChildSettings objects filtered by the adminemailaddress column + * @psalm-method Collection&\Traversable findByAdminEmailAddress(string|array $adminemailaddress) Return ChildSettings objects filtered by the adminemailaddress column + * @method ChildSettings[]|Collection findByNoRehearsalEmail(string|array $norehearsalemail) Return ChildSettings objects filtered by the norehearsalemail column + * @psalm-method Collection&\Traversable findByNoRehearsalEmail(string|array $norehearsalemail) Return ChildSettings objects filtered by the norehearsalemail column + * @method ChildSettings[]|Collection findByYesRehearsal(string|array $yesrehearsal) Return ChildSettings objects filtered by the yesrehearsal column + * @psalm-method Collection&\Traversable findByYesRehearsal(string|array $yesrehearsal) Return ChildSettings objects filtered by the yesrehearsal column + * @method ChildSettings[]|Collection findByNewUserMessage(string|array $newusermessage) Return ChildSettings objects filtered by the newusermessage column + * @psalm-method Collection&\Traversable findByNewUserMessage(string|array $newusermessage) Return ChildSettings objects filtered by the newusermessage column + * @method ChildSettings[]|Collection findByVersion(string|array $version) Return ChildSettings objects filtered by the version column + * @psalm-method Collection&\Traversable findByVersion(string|array $version) Return ChildSettings objects filtered by the version column + * @method ChildSettings[]|Collection findByLangLocale(string|array $lang_locale) Return ChildSettings objects filtered by the lang_locale column + * @psalm-method Collection&\Traversable findByLangLocale(string|array $lang_locale) Return ChildSettings objects filtered by the lang_locale column + * @method ChildSettings[]|Collection findByEventSortingLatest(int|array $event_sorting_latest) Return ChildSettings objects filtered by the event_sorting_latest column + * @psalm-method Collection&\Traversable findByEventSortingLatest(int|array $event_sorting_latest) Return ChildSettings objects filtered by the event_sorting_latest column + * @method ChildSettings[]|Collection findBySnapshotShowTwoMonth(int|array $snapshot_show_two_month) Return ChildSettings objects filtered by the snapshot_show_two_month column + * @psalm-method Collection&\Traversable findBySnapshotShowTwoMonth(int|array $snapshot_show_two_month) Return ChildSettings objects filtered by the snapshot_show_two_month column + * @method ChildSettings[]|Collection findBySnapshotReduceSkillsByGroup(int|array $snapshot_reduce_skills_by_group) Return ChildSettings objects filtered by the snapshot_reduce_skills_by_group column + * @psalm-method Collection&\Traversable findBySnapshotReduceSkillsByGroup(int|array $snapshot_reduce_skills_by_group) Return ChildSettings objects filtered by the snapshot_reduce_skills_by_group column + * @method ChildSettings[]|Collection findByLoggedInShowSnapshotButton(int|array $logged_in_show_snapshot_button) Return ChildSettings objects filtered by the logged_in_show_snapshot_button column + * @psalm-method Collection&\Traversable findByLoggedInShowSnapshotButton(int|array $logged_in_show_snapshot_button) Return ChildSettings objects filtered by the logged_in_show_snapshot_button column + * @method ChildSettings[]|Collection findByTimeFormatLong(string|array $time_format_long) Return ChildSettings objects filtered by the time_format_long column + * @psalm-method Collection&\Traversable findByTimeFormatLong(string|array $time_format_long) Return ChildSettings objects filtered by the time_format_long column + * @method ChildSettings[]|Collection findByTimeFormatNormal(string|array $time_format_normal) Return ChildSettings objects filtered by the time_format_normal column + * @psalm-method Collection&\Traversable findByTimeFormatNormal(string|array $time_format_normal) Return ChildSettings objects filtered by the time_format_normal column + * @method ChildSettings[]|Collection findByTimeFormatShort(string|array $time_format_short) Return ChildSettings objects filtered by the time_format_short column + * @psalm-method Collection&\Traversable findByTimeFormatShort(string|array $time_format_short) Return ChildSettings objects filtered by the time_format_short column + * @method ChildSettings[]|Collection findByTimeOnlyFormat(string|array $time_only_format) Return ChildSettings objects filtered by the time_only_format column + * @psalm-method Collection&\Traversable findByTimeOnlyFormat(string|array $time_only_format) Return ChildSettings objects filtered by the time_only_format column + * @method ChildSettings[]|Collection findByDateOnlyFormat(string|array $date_only_format) Return ChildSettings objects filtered by the date_only_format column + * @psalm-method Collection&\Traversable findByDateOnlyFormat(string|array $date_only_format) Return ChildSettings objects filtered by the date_only_format column + * @method ChildSettings[]|Collection findByDayOnlyFormat(string|array $day_only_format) Return ChildSettings objects filtered by the day_only_format column + * @psalm-method Collection&\Traversable findByDayOnlyFormat(string|array $day_only_format) Return ChildSettings objects filtered by the day_only_format column + * @method ChildSettings[]|Collection findByUsersStartWithMyEvents(int|array $users_start_with_myevents) Return ChildSettings objects filtered by the users_start_with_myevents column + * @psalm-method Collection&\Traversable findByUsersStartWithMyEvents(int|array $users_start_with_myevents) Return ChildSettings objects filtered by the users_start_with_myevents column + * @method ChildSettings[]|Collection findByTimeZone(string|array $time_zone) Return ChildSettings objects filtered by the time_zone column + * @psalm-method Collection&\Traversable findByTimeZone(string|array $time_zone) Return ChildSettings objects filtered by the time_zone column + * @method ChildSettings[]|Collection findByGoogleGroupCalendar(string|array $google_group_calendar) Return ChildSettings objects filtered by the google_group_calendar column + * @psalm-method Collection&\Traversable findByGoogleGroupCalendar(string|array $google_group_calendar) Return ChildSettings objects filtered by the google_group_calendar column + * @method ChildSettings[]|Collection findByOverviewEmail(string|array $overviewemail) Return ChildSettings objects filtered by the overviewemail column + * @psalm-method Collection&\Traversable findByOverviewEmail(string|array $overviewemail) Return ChildSettings objects filtered by the overviewemail column + * @method ChildSettings[]|Collection findByGroupSortingName(int|array $group_sorting_name) Return ChildSettings objects filtered by the group_sorting_name column + * @psalm-method Collection&\Traversable findByGroupSortingName(int|array $group_sorting_name) Return ChildSettings objects filtered by the group_sorting_name column + * @method ChildSettings[]|Collection findByDebugMode(int|array $debug_mode) Return ChildSettings objects filtered by the debug_mode column + * @psalm-method Collection&\Traversable findByDebugMode(int|array $debug_mode) Return ChildSettings objects filtered by the debug_mode column + * @method ChildSettings[]|Collection findByDaysToAlert(int|array $days_to_alert) Return ChildSettings objects filtered by the days_to_alert column + * @psalm-method Collection&\Traversable findByDaysToAlert(int|array $days_to_alert) Return ChildSettings objects filtered by the days_to_alert column + * @method ChildSettings[]|Collection findByToken(string|array $token) Return ChildSettings objects filtered by the token column + * @psalm-method Collection&\Traversable findByToken(string|array $token) Return ChildSettings objects filtered by the token column + * @method ChildSettings[]|Collection findBySkin(string|array $skin) Return ChildSettings objects filtered by the skin column + * @psalm-method Collection&\Traversable findBySkin(string|array $skin) Return ChildSettings objects filtered by the skin column * + * @method ChildSettings[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class SettingsQuery extends ModelCriteria { @@ -188,9 +217,9 @@ abstract class SettingsQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\SettingsQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Settings', $modelAlias = null) { @@ -200,12 +229,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildSettingsQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildSettingsQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildSettingsQuery) { return $criteria; @@ -235,7 +264,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildSettings|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { throw new LogicException('The Settings object has no primary key'); } @@ -245,12 +274,12 @@ public function findPk($key, ConnectionInterface $con = null) * * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { throw new LogicException('The Settings object has no primary key'); } @@ -258,9 +287,9 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { @@ -270,9 +299,9 @@ public function filterByPrimaryKey($key) /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { @@ -286,14 +315,15 @@ public function filterByPrimaryKeys($keys) * * $query->filterBySiteUrl('fooValue'); // WHERE siteurl = 'fooValue' * $query->filterBySiteUrl('%fooValue%', Criteria::LIKE); // WHERE siteurl LIKE '%fooValue%' + * $query->filterBySiteUrl(['foo', 'bar']); // WHERE siteurl IN ('foo', 'bar') * * - * @param string $siteUrl The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $siteUrl The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySiteUrl($siteUrl = null, $comparison = null) + public function filterBySiteUrl($siteUrl = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($siteUrl)) { @@ -301,7 +331,9 @@ public function filterBySiteUrl($siteUrl = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_SITEURL, $siteUrl, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_SITEURL, $siteUrl, $comparison); + + return $this; } /** @@ -311,14 +343,15 @@ public function filterBySiteUrl($siteUrl = null, $comparison = null) * * $query->filterByOwner('fooValue'); // WHERE owner = 'fooValue' * $query->filterByOwner('%fooValue%', Criteria::LIKE); // WHERE owner LIKE '%fooValue%' + * $query->filterByOwner(['foo', 'bar']); // WHERE owner IN ('foo', 'bar') * * - * @param string $owner The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $owner The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByOwner($owner = null, $comparison = null) + public function filterByOwner($owner = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($owner)) { @@ -326,7 +359,9 @@ public function filterByOwner($owner = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_OWNER, $owner, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_OWNER, $owner, $comparison); + + return $this; } /** @@ -336,14 +371,15 @@ public function filterByOwner($owner = null, $comparison = null) * * $query->filterByNotificationEmail('fooValue'); // WHERE notificationemail = 'fooValue' * $query->filterByNotificationEmail('%fooValue%', Criteria::LIKE); // WHERE notificationemail LIKE '%fooValue%' + * $query->filterByNotificationEmail(['foo', 'bar']); // WHERE notificationemail IN ('foo', 'bar') * * - * @param string $notificationEmail The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $notificationEmail The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotificationEmail($notificationEmail = null, $comparison = null) + public function filterByNotificationEmail($notificationEmail = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($notificationEmail)) { @@ -351,7 +387,9 @@ public function filterByNotificationEmail($notificationEmail = null, $comparison } } - return $this->addUsingAlias(SettingsTableMap::COL_NOTIFICATIONEMAIL, $notificationEmail, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_NOTIFICATIONEMAIL, $notificationEmail, $comparison); + + return $this; } /** @@ -361,14 +399,15 @@ public function filterByNotificationEmail($notificationEmail = null, $comparison * * $query->filterByAdminEmailAddress('fooValue'); // WHERE adminemailaddress = 'fooValue' * $query->filterByAdminEmailAddress('%fooValue%', Criteria::LIKE); // WHERE adminemailaddress LIKE '%fooValue%' + * $query->filterByAdminEmailAddress(['foo', 'bar']); // WHERE adminemailaddress IN ('foo', 'bar') * * - * @param string $adminEmailAddress The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $adminEmailAddress The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAdminEmailAddress($adminEmailAddress = null, $comparison = null) + public function filterByAdminEmailAddress($adminEmailAddress = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($adminEmailAddress)) { @@ -376,7 +415,9 @@ public function filterByAdminEmailAddress($adminEmailAddress = null, $comparison } } - return $this->addUsingAlias(SettingsTableMap::COL_ADMINEMAILADDRESS, $adminEmailAddress, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_ADMINEMAILADDRESS, $adminEmailAddress, $comparison); + + return $this; } /** @@ -386,14 +427,15 @@ public function filterByAdminEmailAddress($adminEmailAddress = null, $comparison * * $query->filterByNoRehearsalEmail('fooValue'); // WHERE norehearsalemail = 'fooValue' * $query->filterByNoRehearsalEmail('%fooValue%', Criteria::LIKE); // WHERE norehearsalemail LIKE '%fooValue%' + * $query->filterByNoRehearsalEmail(['foo', 'bar']); // WHERE norehearsalemail IN ('foo', 'bar') * * - * @param string $noRehearsalEmail The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $noRehearsalEmail The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNoRehearsalEmail($noRehearsalEmail = null, $comparison = null) + public function filterByNoRehearsalEmail($noRehearsalEmail = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($noRehearsalEmail)) { @@ -401,7 +443,9 @@ public function filterByNoRehearsalEmail($noRehearsalEmail = null, $comparison = } } - return $this->addUsingAlias(SettingsTableMap::COL_NOREHEARSALEMAIL, $noRehearsalEmail, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_NOREHEARSALEMAIL, $noRehearsalEmail, $comparison); + + return $this; } /** @@ -411,14 +455,15 @@ public function filterByNoRehearsalEmail($noRehearsalEmail = null, $comparison = * * $query->filterByYesRehearsal('fooValue'); // WHERE yesrehearsal = 'fooValue' * $query->filterByYesRehearsal('%fooValue%', Criteria::LIKE); // WHERE yesrehearsal LIKE '%fooValue%' + * $query->filterByYesRehearsal(['foo', 'bar']); // WHERE yesrehearsal IN ('foo', 'bar') * * - * @param string $yesRehearsal The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $yesRehearsal The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByYesRehearsal($yesRehearsal = null, $comparison = null) + public function filterByYesRehearsal($yesRehearsal = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($yesRehearsal)) { @@ -426,7 +471,9 @@ public function filterByYesRehearsal($yesRehearsal = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_YESREHEARSAL, $yesRehearsal, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_YESREHEARSAL, $yesRehearsal, $comparison); + + return $this; } /** @@ -436,14 +483,15 @@ public function filterByYesRehearsal($yesRehearsal = null, $comparison = null) * * $query->filterByNewUserMessage('fooValue'); // WHERE newusermessage = 'fooValue' * $query->filterByNewUserMessage('%fooValue%', Criteria::LIKE); // WHERE newusermessage LIKE '%fooValue%' + * $query->filterByNewUserMessage(['foo', 'bar']); // WHERE newusermessage IN ('foo', 'bar') * * - * @param string $newUserMessage The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $newUserMessage The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNewUserMessage($newUserMessage = null, $comparison = null) + public function filterByNewUserMessage($newUserMessage = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($newUserMessage)) { @@ -451,7 +499,9 @@ public function filterByNewUserMessage($newUserMessage = null, $comparison = nul } } - return $this->addUsingAlias(SettingsTableMap::COL_NEWUSERMESSAGE, $newUserMessage, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_NEWUSERMESSAGE, $newUserMessage, $comparison); + + return $this; } /** @@ -461,14 +511,15 @@ public function filterByNewUserMessage($newUserMessage = null, $comparison = nul * * $query->filterByVersion('fooValue'); // WHERE version = 'fooValue' * $query->filterByVersion('%fooValue%', Criteria::LIKE); // WHERE version LIKE '%fooValue%' + * $query->filterByVersion(['foo', 'bar']); // WHERE version IN ('foo', 'bar') * * - * @param string $version The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $version The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByVersion($version = null, $comparison = null) + public function filterByVersion($version = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($version)) { @@ -476,7 +527,9 @@ public function filterByVersion($version = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_VERSION, $version, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_VERSION, $version, $comparison); + + return $this; } /** @@ -486,14 +539,15 @@ public function filterByVersion($version = null, $comparison = null) * * $query->filterByLangLocale('fooValue'); // WHERE lang_locale = 'fooValue' * $query->filterByLangLocale('%fooValue%', Criteria::LIKE); // WHERE lang_locale LIKE '%fooValue%' + * $query->filterByLangLocale(['foo', 'bar']); // WHERE lang_locale IN ('foo', 'bar') * * - * @param string $langLocale The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $langLocale The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLangLocale($langLocale = null, $comparison = null) + public function filterByLangLocale($langLocale = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($langLocale)) { @@ -501,7 +555,9 @@ public function filterByLangLocale($langLocale = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_LANG_LOCALE, $langLocale, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_LANG_LOCALE, $langLocale, $comparison); + + return $this; } /** @@ -514,15 +570,15 @@ public function filterByLangLocale($langLocale = null, $comparison = null) * $query->filterByEventSortingLatest(array('min' => 12)); // WHERE event_sorting_latest > 12 * * - * @param mixed $eventSortingLatest The value to use as filter. + * @param mixed $eventSortingLatest The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventSortingLatest($eventSortingLatest = null, $comparison = null) + public function filterByEventSortingLatest($eventSortingLatest = null, ?string $comparison = null) { if (is_array($eventSortingLatest)) { $useMinMax = false; @@ -542,7 +598,9 @@ public function filterByEventSortingLatest($eventSortingLatest = null, $comparis } } - return $this->addUsingAlias(SettingsTableMap::COL_EVENT_SORTING_LATEST, $eventSortingLatest, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_EVENT_SORTING_LATEST, $eventSortingLatest, $comparison); + + return $this; } /** @@ -555,15 +613,15 @@ public function filterByEventSortingLatest($eventSortingLatest = null, $comparis * $query->filterBySnapshotShowTwoMonth(array('min' => 12)); // WHERE snapshot_show_two_month > 12 * * - * @param mixed $snapshotShowTwoMonth The value to use as filter. + * @param mixed $snapshotShowTwoMonth The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySnapshotShowTwoMonth($snapshotShowTwoMonth = null, $comparison = null) + public function filterBySnapshotShowTwoMonth($snapshotShowTwoMonth = null, ?string $comparison = null) { if (is_array($snapshotShowTwoMonth)) { $useMinMax = false; @@ -583,7 +641,9 @@ public function filterBySnapshotShowTwoMonth($snapshotShowTwoMonth = null, $comp } } - return $this->addUsingAlias(SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH, $snapshotShowTwoMonth, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH, $snapshotShowTwoMonth, $comparison); + + return $this; } /** @@ -596,15 +656,15 @@ public function filterBySnapshotShowTwoMonth($snapshotShowTwoMonth = null, $comp * $query->filterBySnapshotReduceSkillsByGroup(array('min' => 12)); // WHERE snapshot_reduce_skills_by_group > 12 * * - * @param mixed $snapshotReduceSkillsByGroup The value to use as filter. + * @param mixed $snapshotReduceSkillsByGroup The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySnapshotReduceSkillsByGroup($snapshotReduceSkillsByGroup = null, $comparison = null) + public function filterBySnapshotReduceSkillsByGroup($snapshotReduceSkillsByGroup = null, ?string $comparison = null) { if (is_array($snapshotReduceSkillsByGroup)) { $useMinMax = false; @@ -624,7 +684,9 @@ public function filterBySnapshotReduceSkillsByGroup($snapshotReduceSkillsByGroup } } - return $this->addUsingAlias(SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP, $snapshotReduceSkillsByGroup, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP, $snapshotReduceSkillsByGroup, $comparison); + + return $this; } /** @@ -637,15 +699,15 @@ public function filterBySnapshotReduceSkillsByGroup($snapshotReduceSkillsByGroup * $query->filterByLoggedInShowSnapshotButton(array('min' => 12)); // WHERE logged_in_show_snapshot_button > 12 * * - * @param mixed $loggedInShowSnapshotButton The value to use as filter. + * @param mixed $loggedInShowSnapshotButton The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLoggedInShowSnapshotButton($loggedInShowSnapshotButton = null, $comparison = null) + public function filterByLoggedInShowSnapshotButton($loggedInShowSnapshotButton = null, ?string $comparison = null) { if (is_array($loggedInShowSnapshotButton)) { $useMinMax = false; @@ -665,7 +727,9 @@ public function filterByLoggedInShowSnapshotButton($loggedInShowSnapshotButton = } } - return $this->addUsingAlias(SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON, $loggedInShowSnapshotButton, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON, $loggedInShowSnapshotButton, $comparison); + + return $this; } /** @@ -675,14 +739,15 @@ public function filterByLoggedInShowSnapshotButton($loggedInShowSnapshotButton = * * $query->filterByTimeFormatLong('fooValue'); // WHERE time_format_long = 'fooValue' * $query->filterByTimeFormatLong('%fooValue%', Criteria::LIKE); // WHERE time_format_long LIKE '%fooValue%' + * $query->filterByTimeFormatLong(['foo', 'bar']); // WHERE time_format_long IN ('foo', 'bar') * * - * @param string $timeFormatLong The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $timeFormatLong The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimeFormatLong($timeFormatLong = null, $comparison = null) + public function filterByTimeFormatLong($timeFormatLong = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($timeFormatLong)) { @@ -690,7 +755,9 @@ public function filterByTimeFormatLong($timeFormatLong = null, $comparison = nul } } - return $this->addUsingAlias(SettingsTableMap::COL_TIME_FORMAT_LONG, $timeFormatLong, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_TIME_FORMAT_LONG, $timeFormatLong, $comparison); + + return $this; } /** @@ -700,14 +767,15 @@ public function filterByTimeFormatLong($timeFormatLong = null, $comparison = nul * * $query->filterByTimeFormatNormal('fooValue'); // WHERE time_format_normal = 'fooValue' * $query->filterByTimeFormatNormal('%fooValue%', Criteria::LIKE); // WHERE time_format_normal LIKE '%fooValue%' + * $query->filterByTimeFormatNormal(['foo', 'bar']); // WHERE time_format_normal IN ('foo', 'bar') * * - * @param string $timeFormatNormal The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $timeFormatNormal The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimeFormatNormal($timeFormatNormal = null, $comparison = null) + public function filterByTimeFormatNormal($timeFormatNormal = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($timeFormatNormal)) { @@ -715,7 +783,9 @@ public function filterByTimeFormatNormal($timeFormatNormal = null, $comparison = } } - return $this->addUsingAlias(SettingsTableMap::COL_TIME_FORMAT_NORMAL, $timeFormatNormal, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_TIME_FORMAT_NORMAL, $timeFormatNormal, $comparison); + + return $this; } /** @@ -725,14 +795,15 @@ public function filterByTimeFormatNormal($timeFormatNormal = null, $comparison = * * $query->filterByTimeFormatShort('fooValue'); // WHERE time_format_short = 'fooValue' * $query->filterByTimeFormatShort('%fooValue%', Criteria::LIKE); // WHERE time_format_short LIKE '%fooValue%' + * $query->filterByTimeFormatShort(['foo', 'bar']); // WHERE time_format_short IN ('foo', 'bar') * * - * @param string $timeFormatShort The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $timeFormatShort The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimeFormatShort($timeFormatShort = null, $comparison = null) + public function filterByTimeFormatShort($timeFormatShort = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($timeFormatShort)) { @@ -740,7 +811,9 @@ public function filterByTimeFormatShort($timeFormatShort = null, $comparison = n } } - return $this->addUsingAlias(SettingsTableMap::COL_TIME_FORMAT_SHORT, $timeFormatShort, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_TIME_FORMAT_SHORT, $timeFormatShort, $comparison); + + return $this; } /** @@ -750,14 +823,15 @@ public function filterByTimeFormatShort($timeFormatShort = null, $comparison = n * * $query->filterByTimeOnlyFormat('fooValue'); // WHERE time_only_format = 'fooValue' * $query->filterByTimeOnlyFormat('%fooValue%', Criteria::LIKE); // WHERE time_only_format LIKE '%fooValue%' + * $query->filterByTimeOnlyFormat(['foo', 'bar']); // WHERE time_only_format IN ('foo', 'bar') * * - * @param string $timeOnlyFormat The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $timeOnlyFormat The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimeOnlyFormat($timeOnlyFormat = null, $comparison = null) + public function filterByTimeOnlyFormat($timeOnlyFormat = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($timeOnlyFormat)) { @@ -765,7 +839,9 @@ public function filterByTimeOnlyFormat($timeOnlyFormat = null, $comparison = nul } } - return $this->addUsingAlias(SettingsTableMap::COL_TIME_ONLY_FORMAT, $timeOnlyFormat, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_TIME_ONLY_FORMAT, $timeOnlyFormat, $comparison); + + return $this; } /** @@ -775,14 +851,15 @@ public function filterByTimeOnlyFormat($timeOnlyFormat = null, $comparison = nul * * $query->filterByDateOnlyFormat('fooValue'); // WHERE date_only_format = 'fooValue' * $query->filterByDateOnlyFormat('%fooValue%', Criteria::LIKE); // WHERE date_only_format LIKE '%fooValue%' + * $query->filterByDateOnlyFormat(['foo', 'bar']); // WHERE date_only_format IN ('foo', 'bar') * * - * @param string $dateOnlyFormat The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $dateOnlyFormat The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDateOnlyFormat($dateOnlyFormat = null, $comparison = null) + public function filterByDateOnlyFormat($dateOnlyFormat = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($dateOnlyFormat)) { @@ -790,7 +867,9 @@ public function filterByDateOnlyFormat($dateOnlyFormat = null, $comparison = nul } } - return $this->addUsingAlias(SettingsTableMap::COL_DATE_ONLY_FORMAT, $dateOnlyFormat, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_DATE_ONLY_FORMAT, $dateOnlyFormat, $comparison); + + return $this; } /** @@ -800,14 +879,15 @@ public function filterByDateOnlyFormat($dateOnlyFormat = null, $comparison = nul * * $query->filterByDayOnlyFormat('fooValue'); // WHERE day_only_format = 'fooValue' * $query->filterByDayOnlyFormat('%fooValue%', Criteria::LIKE); // WHERE day_only_format LIKE '%fooValue%' + * $query->filterByDayOnlyFormat(['foo', 'bar']); // WHERE day_only_format IN ('foo', 'bar') * * - * @param string $dayOnlyFormat The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $dayOnlyFormat The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDayOnlyFormat($dayOnlyFormat = null, $comparison = null) + public function filterByDayOnlyFormat($dayOnlyFormat = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($dayOnlyFormat)) { @@ -815,7 +895,9 @@ public function filterByDayOnlyFormat($dayOnlyFormat = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_DAY_ONLY_FORMAT, $dayOnlyFormat, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_DAY_ONLY_FORMAT, $dayOnlyFormat, $comparison); + + return $this; } /** @@ -828,15 +910,15 @@ public function filterByDayOnlyFormat($dayOnlyFormat = null, $comparison = null) * $query->filterByUsersStartWithMyEvents(array('min' => 12)); // WHERE users_start_with_myevents > 12 * * - * @param mixed $usersStartWithMyEvents The value to use as filter. + * @param mixed $usersStartWithMyEvents The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUsersStartWithMyEvents($usersStartWithMyEvents = null, $comparison = null) + public function filterByUsersStartWithMyEvents($usersStartWithMyEvents = null, ?string $comparison = null) { if (is_array($usersStartWithMyEvents)) { $useMinMax = false; @@ -856,7 +938,9 @@ public function filterByUsersStartWithMyEvents($usersStartWithMyEvents = null, $ } } - return $this->addUsingAlias(SettingsTableMap::COL_USERS_START_WITH_MYEVENTS, $usersStartWithMyEvents, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_USERS_START_WITH_MYEVENTS, $usersStartWithMyEvents, $comparison); + + return $this; } /** @@ -866,14 +950,15 @@ public function filterByUsersStartWithMyEvents($usersStartWithMyEvents = null, $ * * $query->filterByTimeZone('fooValue'); // WHERE time_zone = 'fooValue' * $query->filterByTimeZone('%fooValue%', Criteria::LIKE); // WHERE time_zone LIKE '%fooValue%' + * $query->filterByTimeZone(['foo', 'bar']); // WHERE time_zone IN ('foo', 'bar') * * - * @param string $timeZone The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $timeZone The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByTimeZone($timeZone = null, $comparison = null) + public function filterByTimeZone($timeZone = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($timeZone)) { @@ -881,7 +966,9 @@ public function filterByTimeZone($timeZone = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_TIME_ZONE, $timeZone, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_TIME_ZONE, $timeZone, $comparison); + + return $this; } /** @@ -891,14 +978,15 @@ public function filterByTimeZone($timeZone = null, $comparison = null) * * $query->filterByGoogleGroupCalendar('fooValue'); // WHERE google_group_calendar = 'fooValue' * $query->filterByGoogleGroupCalendar('%fooValue%', Criteria::LIKE); // WHERE google_group_calendar LIKE '%fooValue%' + * $query->filterByGoogleGroupCalendar(['foo', 'bar']); // WHERE google_group_calendar IN ('foo', 'bar') * * - * @param string $googleGroupCalendar The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $googleGroupCalendar The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByGoogleGroupCalendar($googleGroupCalendar = null, $comparison = null) + public function filterByGoogleGroupCalendar($googleGroupCalendar = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($googleGroupCalendar)) { @@ -906,7 +994,9 @@ public function filterByGoogleGroupCalendar($googleGroupCalendar = null, $compar } } - return $this->addUsingAlias(SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR, $googleGroupCalendar, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR, $googleGroupCalendar, $comparison); + + return $this; } /** @@ -916,14 +1006,15 @@ public function filterByGoogleGroupCalendar($googleGroupCalendar = null, $compar * * $query->filterByOverviewEmail('fooValue'); // WHERE overviewemail = 'fooValue' * $query->filterByOverviewEmail('%fooValue%', Criteria::LIKE); // WHERE overviewemail LIKE '%fooValue%' + * $query->filterByOverviewEmail(['foo', 'bar']); // WHERE overviewemail IN ('foo', 'bar') * * - * @param string $overviewEmail The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $overviewEmail The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByOverviewEmail($overviewEmail = null, $comparison = null) + public function filterByOverviewEmail($overviewEmail = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($overviewEmail)) { @@ -931,7 +1022,9 @@ public function filterByOverviewEmail($overviewEmail = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_OVERVIEWEMAIL, $overviewEmail, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_OVERVIEWEMAIL, $overviewEmail, $comparison); + + return $this; } /** @@ -944,15 +1037,15 @@ public function filterByOverviewEmail($overviewEmail = null, $comparison = null) * $query->filterByGroupSortingName(array('min' => 12)); // WHERE group_sorting_name > 12 * * - * @param mixed $groupSortingName The value to use as filter. + * @param mixed $groupSortingName The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByGroupSortingName($groupSortingName = null, $comparison = null) + public function filterByGroupSortingName($groupSortingName = null, ?string $comparison = null) { if (is_array($groupSortingName)) { $useMinMax = false; @@ -972,7 +1065,9 @@ public function filterByGroupSortingName($groupSortingName = null, $comparison = } } - return $this->addUsingAlias(SettingsTableMap::COL_GROUP_SORTING_NAME, $groupSortingName, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_GROUP_SORTING_NAME, $groupSortingName, $comparison); + + return $this; } /** @@ -985,15 +1080,15 @@ public function filterByGroupSortingName($groupSortingName = null, $comparison = * $query->filterByDebugMode(array('min' => 12)); // WHERE debug_mode > 12 * * - * @param mixed $debugMode The value to use as filter. + * @param mixed $debugMode The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDebugMode($debugMode = null, $comparison = null) + public function filterByDebugMode($debugMode = null, ?string $comparison = null) { if (is_array($debugMode)) { $useMinMax = false; @@ -1013,7 +1108,9 @@ public function filterByDebugMode($debugMode = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_DEBUG_MODE, $debugMode, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_DEBUG_MODE, $debugMode, $comparison); + + return $this; } /** @@ -1026,15 +1123,15 @@ public function filterByDebugMode($debugMode = null, $comparison = null) * $query->filterByDaysToAlert(array('min' => 12)); // WHERE days_to_alert > 12 * * - * @param mixed $daysToAlert The value to use as filter. + * @param mixed $daysToAlert The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDaysToAlert($daysToAlert = null, $comparison = null) + public function filterByDaysToAlert($daysToAlert = null, ?string $comparison = null) { if (is_array($daysToAlert)) { $useMinMax = false; @@ -1054,7 +1151,9 @@ public function filterByDaysToAlert($daysToAlert = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_DAYS_TO_ALERT, $daysToAlert, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_DAYS_TO_ALERT, $daysToAlert, $comparison); + + return $this; } /** @@ -1064,14 +1163,15 @@ public function filterByDaysToAlert($daysToAlert = null, $comparison = null) * * $query->filterByToken('fooValue'); // WHERE token = 'fooValue' * $query->filterByToken('%fooValue%', Criteria::LIKE); // WHERE token LIKE '%fooValue%' + * $query->filterByToken(['foo', 'bar']); // WHERE token IN ('foo', 'bar') * * - * @param string $token The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $token The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByToken($token = null, $comparison = null) + public function filterByToken($token = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($token)) { @@ -1079,7 +1179,9 @@ public function filterByToken($token = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_TOKEN, $token, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_TOKEN, $token, $comparison); + + return $this; } /** @@ -1089,14 +1191,15 @@ public function filterByToken($token = null, $comparison = null) * * $query->filterBySkin('fooValue'); // WHERE skin = 'fooValue' * $query->filterBySkin('%fooValue%', Criteria::LIKE); // WHERE skin LIKE '%fooValue%' + * $query->filterBySkin(['foo', 'bar']); // WHERE skin IN ('foo', 'bar') * * - * @param string $skin The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $skin The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySkin($skin = null, $comparison = null) + public function filterBySkin($skin = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($skin)) { @@ -1104,20 +1207,23 @@ public function filterBySkin($skin = null, $comparison = null) } } - return $this->addUsingAlias(SettingsTableMap::COL_SKIN, $skin, $comparison); + $this->addUsingAlias(SettingsTableMap::COL_SKIN, $skin, $comparison); + + return $this; } /** * Exclude object from result * - * @param ChildSettings $settings Object to remove from the list of results + * @param ChildSettings $settings Object to remove from the list of results * - * @return $this|ChildSettingsQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($settings = null) { if ($settings) { throw new LogicException('Settings object has no primary key'); + } return $this; @@ -1129,7 +1235,7 @@ public function prune($settings = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SettingsTableMap::DATABASE_NAME); @@ -1154,12 +1260,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SettingsTableMap::DATABASE_NAME); @@ -1183,4 +1289,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // SettingsQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/SocialAuth.php b/generated-classes/TechWilk/Rota/Base/SocialAuth.php index 8cfa678c..bcf32499 100644 --- a/generated-classes/TechWilk/Rota/Base/SocialAuth.php +++ b/generated-classes/TechWilk/Rota/Base/SocialAuth.php @@ -31,19 +31,21 @@ abstract class SocialAuth implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\SocialAuthTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\SocialAuthTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -52,14 +54,14 @@ abstract class SocialAuth implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the userid field. @@ -85,7 +87,7 @@ abstract class SocialAuth implements ActiveRecordInterface /** * The value for the meta field. * - * @var string + * @var string|null */ protected $meta; @@ -106,7 +108,7 @@ abstract class SocialAuth implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -116,7 +118,7 @@ abstract class SocialAuth implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->revoked = false; } @@ -133,9 +135,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -143,10 +145,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -155,7 +157,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -165,9 +167,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -176,45 +178,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -223,10 +223,10 @@ public function resetModified($col = null) * obj is an instance of SocialAuth, delegates to * equals(SocialAuth). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -248,7 +248,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -256,10 +256,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -267,15 +267,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -284,12 +284,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|SocialAuth The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -299,13 +299,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -316,24 +316,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -341,7 +344,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -381,7 +384,7 @@ public function getSocialId() /** * Get the [meta] column value. * - * @return string + * @return string|null */ public function getMeta() { @@ -411,8 +414,8 @@ public function isRevoked() /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\SocialAuth The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -430,13 +433,13 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Set the value of [platform] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\SocialAuth The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setPlatform($v) { @@ -450,13 +453,13 @@ public function setPlatform($v) } return $this; - } // setPlatform() + } /** * Set the value of [socialid] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\SocialAuth The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setSocialId($v) { @@ -470,13 +473,13 @@ public function setSocialId($v) } return $this; - } // setSocialId() + } /** * Set the value of [meta] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\SocialAuth The current object (for fluent API support) + * @param string|null $v New value + * @return $this The current object (for fluent API support) */ public function setMeta($v) { @@ -490,7 +493,7 @@ public function setMeta($v) } return $this; - } // setMeta() + } /** * Sets the value of the [revoked] column. @@ -499,8 +502,8 @@ public function setMeta($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\SocialAuth The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setRevoked($v) { @@ -518,7 +521,7 @@ public function setRevoked($v) } return $this; - } // setRevoked() + } /** * Indicates whether the columns in this object are only set to default values. @@ -526,17 +529,17 @@ public function setRevoked($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->revoked !== false) { - return false; - } + if ($this->revoked !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -546,19 +549,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : SocialAuthTableMap::translateFieldName('UserId', TableMap::TYPE_PHPNAME, $indexType)]; $this->userid = (null !== $col) ? (int) $col : null; @@ -573,8 +577,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : SocialAuthTableMap::translateFieldName('Revoked', TableMap::TYPE_PHPNAME, $indexType)]; $this->revoked = (null !== $col) ? (boolean) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -582,6 +586,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 5; // 5 = SocialAuthTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\SocialAuth'), 0, $e); } @@ -598,26 +603,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -651,13 +657,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see SocialAuth::setDeleted() * @see SocialAuth::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -687,12 +693,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -737,12 +743,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -772,22 +778,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; @@ -820,18 +827,23 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'platform': $stmt->bindValue($identifier, $this->platform, PDO::PARAM_STR); + break; case 'socialId': $stmt->bindValue($identifier, $this->socialid, PDO::PARAM_INT); + break; case 'meta': $stmt->bindValue($identifier, $this->meta, PDO::PARAM_STR); + break; case 'revoked': $stmt->bindValue($identifier, (int) $this->revoked, PDO::PARAM_INT); + break; } } @@ -847,12 +859,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -863,14 +875,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = SocialAuthTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -882,30 +894,29 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getUserId(); - break; + case 1: return $this->getPlatform(); - break; + case 2: return $this->getSocialId(); - break; + case 3: return $this->getMeta(); - break; + case 4: return $this->getRevoked(); - break; + default: return null; - break; } // switch() } @@ -915,29 +926,29 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['SocialAuth'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['SocialAuth'][$this->hashCode()] = true; $keys = SocialAuthTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getUserId(), $keys[1] => $this->getPlatform(), $keys[2] => $this->getSocialId(), $keys[3] => $this->getMeta(), $keys[4] => $this->getRevoked(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -945,6 +956,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -956,7 +968,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -966,30 +978,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\SocialAuth + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = SocialAuthTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\SocialAuth + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1025,11 +1039,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = SocialAuthTableMap::getFieldNames($keyType); @@ -1048,6 +1062,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[4], $arr)) { $this->setRevoked($arr[$keys[4]]); } + + return $this; } /** @@ -1067,9 +1083,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\SocialAuth The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1083,9 +1099,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(SocialAuthTableMap::DATABASE_NAME); @@ -1112,13 +1128,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildSocialAuthQuery::create(); $criteria->add(SocialAuthTableMap::COL_USERID, $this->userid); @@ -1132,7 +1148,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1143,7 +1159,7 @@ public function hashCode() $validPrimaryKeyFKs = 1; $primaryKeyFKs = []; - //relation socialAuth_fk_c9d9b8 to table users + //relation socialAuth_fk_2596c7 to table users if ($this->aUser && $hash = spl_object_hash($this->aUser)) { $primaryKeyFKs[] = $hash; } else { @@ -1166,7 +1182,7 @@ public function hashCode() */ public function getPrimaryKey() { - $pks = array(); + $pks = []; $pks[0] = $this->getUserId(); $pks[1] = $this->getPlatform(); $pks[2] = $this->getSocialId(); @@ -1177,10 +1193,10 @@ public function getPrimaryKey() /** * Set the [composite] primary key. * - * @param array $keys The elements of the composite key (order must match the order in XML file). + * @param array $keys The elements of the composite key (order must match the order in XML file). * @return void */ - public function setPrimaryKey($keys) + public function setPrimaryKey(array $keys): void { $this->setUserId($keys[0]); $this->setPlatform($keys[1]); @@ -1189,9 +1205,10 @@ public function setPrimaryKey($keys) /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return (null === $this->getUserId()) && (null === $this->getPlatform()) && (null === $this->getSocialId()); } @@ -1202,12 +1219,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\SocialAuth (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\SocialAuth (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setUserId($this->getUserId()); $copyObj->setPlatform($this->getPlatform()); @@ -1227,11 +1245,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\SocialAuth Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1244,14 +1262,14 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\SocialAuth The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { if ($v === null) { - $this->setUserId(null); + $this->setUserId(NULL); } else { $this->setUserId($v->getId()); } @@ -1272,11 +1290,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1296,6 +1314,8 @@ public function getUser(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1313,6 +1333,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1321,14 +1343,16 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; + return $this; } /** @@ -1343,99 +1367,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1445,7 +1449,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1465,17 +1469,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/SocialAuthQuery.php b/generated-classes/TechWilk/Rota/Base/SocialAuthQuery.php index 19dedbfa..297eaadb 100644 --- a/generated-classes/TechWilk/Rota/Base/SocialAuthQuery.php +++ b/generated-classes/TechWilk/Rota/Base/SocialAuthQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\SocialAuthTableMap; /** - * Base class that represents a query for the 'socialAuth' table. - * - * + * Base class that represents a query for the `socialAuth` table. * * @method ChildSocialAuthQuery orderByUserId($order = Criteria::ASC) Order by the userId column * @method ChildSocialAuthQuery orderByPlatform($order = Criteria::ASC) Order by the platform column @@ -52,17 +51,17 @@ * * @method \TechWilk\Rota\UserQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildSocialAuth findOne(ConnectionInterface $con = null) Return the first ChildSocialAuth matching the query - * @method ChildSocialAuth findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocialAuth matching the query, or a new ChildSocialAuth object populated from the query conditions when no match is found + * @method ChildSocialAuth|null findOne(?ConnectionInterface $con = null) Return the first ChildSocialAuth matching the query + * @method ChildSocialAuth findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildSocialAuth matching the query, or a new ChildSocialAuth object populated from the query conditions when no match is found * - * @method ChildSocialAuth findOneByUserId(int $userId) Return the first ChildSocialAuth filtered by the userId column - * @method ChildSocialAuth findOneByPlatform(string $platform) Return the first ChildSocialAuth filtered by the platform column - * @method ChildSocialAuth findOneBySocialId(string $socialId) Return the first ChildSocialAuth filtered by the socialId column - * @method ChildSocialAuth findOneByMeta(string $meta) Return the first ChildSocialAuth filtered by the meta column - * @method ChildSocialAuth findOneByRevoked(boolean $revoked) Return the first ChildSocialAuth filtered by the revoked column * - - * @method ChildSocialAuth requirePk($key, ConnectionInterface $con = null) Return the ChildSocialAuth by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildSocialAuth requireOne(ConnectionInterface $con = null) Return the first ChildSocialAuth matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildSocialAuth|null findOneByUserId(int $userId) Return the first ChildSocialAuth filtered by the userId column + * @method ChildSocialAuth|null findOneByPlatform(string $platform) Return the first ChildSocialAuth filtered by the platform column + * @method ChildSocialAuth|null findOneBySocialId(string $socialId) Return the first ChildSocialAuth filtered by the socialId column + * @method ChildSocialAuth|null findOneByMeta(string $meta) Return the first ChildSocialAuth filtered by the meta column + * @method ChildSocialAuth|null findOneByRevoked(boolean $revoked) Return the first ChildSocialAuth filtered by the revoked column + * + * @method ChildSocialAuth requirePk($key, ?ConnectionInterface $con = null) Return the ChildSocialAuth by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildSocialAuth requireOne(?ConnectionInterface $con = null) Return the first ChildSocialAuth matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildSocialAuth requireOneByUserId(int $userId) Return the first ChildSocialAuth filtered by the userId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildSocialAuth requireOneByPlatform(string $platform) Return the first ChildSocialAuth filtered by the platform column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -70,14 +69,22 @@ * @method ChildSocialAuth requireOneByMeta(string $meta) Return the first ChildSocialAuth filtered by the meta column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildSocialAuth requireOneByRevoked(boolean $revoked) Return the first ChildSocialAuth filtered by the revoked column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildSocialAuth[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildSocialAuth objects based on current ModelCriteria - * @method ChildSocialAuth[]|ObjectCollection findByUserId(int $userId) Return ChildSocialAuth objects filtered by the userId column - * @method ChildSocialAuth[]|ObjectCollection findByPlatform(string $platform) Return ChildSocialAuth objects filtered by the platform column - * @method ChildSocialAuth[]|ObjectCollection findBySocialId(string $socialId) Return ChildSocialAuth objects filtered by the socialId column - * @method ChildSocialAuth[]|ObjectCollection findByMeta(string $meta) Return ChildSocialAuth objects filtered by the meta column - * @method ChildSocialAuth[]|ObjectCollection findByRevoked(boolean $revoked) Return ChildSocialAuth objects filtered by the revoked column - * @method ChildSocialAuth[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildSocialAuth[]|Collection find(?ConnectionInterface $con = null) Return ChildSocialAuth objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildSocialAuth objects based on current ModelCriteria + * + * @method ChildSocialAuth[]|Collection findByUserId(int|array $userId) Return ChildSocialAuth objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserId(int|array $userId) Return ChildSocialAuth objects filtered by the userId column + * @method ChildSocialAuth[]|Collection findByPlatform(string|array $platform) Return ChildSocialAuth objects filtered by the platform column + * @psalm-method Collection&\Traversable findByPlatform(string|array $platform) Return ChildSocialAuth objects filtered by the platform column + * @method ChildSocialAuth[]|Collection findBySocialId(string|array $socialId) Return ChildSocialAuth objects filtered by the socialId column + * @psalm-method Collection&\Traversable findBySocialId(string|array $socialId) Return ChildSocialAuth objects filtered by the socialId column + * @method ChildSocialAuth[]|Collection findByMeta(string|array $meta) Return ChildSocialAuth objects filtered by the meta column + * @psalm-method Collection&\Traversable findByMeta(string|array $meta) Return ChildSocialAuth objects filtered by the meta column + * @method ChildSocialAuth[]|Collection findByRevoked(boolean|array $revoked) Return ChildSocialAuth objects filtered by the revoked column + * @psalm-method Collection&\Traversable findByRevoked(boolean|array $revoked) Return ChildSocialAuth objects filtered by the revoked column * + * @method ChildSocialAuth[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class SocialAuthQuery extends ModelCriteria { @@ -86,9 +93,9 @@ abstract class SocialAuthQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\SocialAuthQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\SocialAuth', $modelAlias = null) { @@ -98,12 +105,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildSocialAuthQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildSocialAuthQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildSocialAuthQuery) { return $criteria; @@ -133,7 +140,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildSocialAuth|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -165,8 +172,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -200,8 +207,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildSocialAuth|array|mixed the result, formatted by the current formatter */ @@ -221,12 +228,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -243,9 +250,9 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { @@ -259,14 +266,16 @@ public function filterByPrimaryKey($key) /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { if (empty($keys)) { - return $this->add(null, '1<>1', Criteria::CUSTOM); + $this->add(null, '1<>1', Criteria::CUSTOM); + + return $this; } foreach ($keys as $key) { $cton0 = $this->getNewCriterion(SocialAuthTableMap::COL_USERID, $key[0], Criteria::EQUAL); @@ -292,15 +301,15 @@ public function filterByPrimaryKeys($keys) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -320,7 +329,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(SocialAuthTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(SocialAuthTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -330,14 +341,15 @@ public function filterByUserId($userId = null, $comparison = null) * * $query->filterByPlatform('fooValue'); // WHERE platform = 'fooValue' * $query->filterByPlatform('%fooValue%', Criteria::LIKE); // WHERE platform LIKE '%fooValue%' + * $query->filterByPlatform(['foo', 'bar']); // WHERE platform IN ('foo', 'bar') * * - * @param string $platform The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $platform The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPlatform($platform = null, $comparison = null) + public function filterByPlatform($platform = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($platform)) { @@ -345,7 +357,9 @@ public function filterByPlatform($platform = null, $comparison = null) } } - return $this->addUsingAlias(SocialAuthTableMap::COL_PLATFORM, $platform, $comparison); + $this->addUsingAlias(SocialAuthTableMap::COL_PLATFORM, $platform, $comparison); + + return $this; } /** @@ -358,15 +372,15 @@ public function filterByPlatform($platform = null, $comparison = null) * $query->filterBySocialId(array('min' => 12)); // WHERE socialId > 12 * * - * @param mixed $socialId The value to use as filter. + * @param mixed $socialId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySocialId($socialId = null, $comparison = null) + public function filterBySocialId($socialId = null, ?string $comparison = null) { if (is_array($socialId)) { $useMinMax = false; @@ -386,7 +400,9 @@ public function filterBySocialId($socialId = null, $comparison = null) } } - return $this->addUsingAlias(SocialAuthTableMap::COL_SOCIALID, $socialId, $comparison); + $this->addUsingAlias(SocialAuthTableMap::COL_SOCIALID, $socialId, $comparison); + + return $this; } /** @@ -396,14 +412,15 @@ public function filterBySocialId($socialId = null, $comparison = null) * * $query->filterByMeta('fooValue'); // WHERE meta = 'fooValue' * $query->filterByMeta('%fooValue%', Criteria::LIKE); // WHERE meta LIKE '%fooValue%' + * $query->filterByMeta(['foo', 'bar']); // WHERE meta IN ('foo', 'bar') * * - * @param string $meta The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $meta The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByMeta($meta = null, $comparison = null) + public function filterByMeta($meta = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($meta)) { @@ -411,7 +428,9 @@ public function filterByMeta($meta = null, $comparison = null) } } - return $this->addUsingAlias(SocialAuthTableMap::COL_META, $meta, $comparison); + $this->addUsingAlias(SocialAuthTableMap::COL_META, $meta, $comparison); + + return $this; } /** @@ -423,35 +442,37 @@ public function filterByMeta($meta = null, $comparison = null) * $query->filterByRevoked('yes'); // WHERE revoked = true * * - * @param boolean|string $revoked The value to use as filter. + * @param bool|string $revoked The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRevoked($revoked = null, $comparison = null) + public function filterByRevoked($revoked = null, ?string $comparison = null) { if (is_string($revoked)) { - $revoked = in_array(strtolower($revoked), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $revoked = in_array(strtolower($revoked), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(SocialAuthTableMap::COL_REVOKED, $revoked, $comparison); + $this->addUsingAlias(SocialAuthTableMap::COL_REVOKED, $revoked, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -461,8 +482,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(SocialAuthTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -471,12 +494,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -505,9 +528,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -518,12 +541,108 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildSocialAuth $socialAuth Object to remove from the list of results + * @param ChildSocialAuth $socialAuth Object to remove from the list of results * - * @return $this|ChildSocialAuthQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($socialAuth = null) { @@ -543,7 +662,7 @@ public function prune($socialAuth = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SocialAuthTableMap::DATABASE_NAME); @@ -568,12 +687,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SocialAuthTableMap::DATABASE_NAME); @@ -597,4 +716,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // SocialAuthQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Statistic.php b/generated-classes/TechWilk/Rota/Base/Statistic.php index d54a1d21..8008ca37 100644 --- a/generated-classes/TechWilk/Rota/Base/Statistic.php +++ b/generated-classes/TechWilk/Rota/Base/Statistic.php @@ -33,19 +33,21 @@ abstract class Statistic implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\StatisticTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\StatisticTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -54,14 +56,14 @@ abstract class Statistic implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -74,7 +76,7 @@ abstract class Statistic implements ActiveRecordInterface * The value for the userid field. * * Note: this column has a database default value of: 0 - * @var int + * @var int|null */ protected $userid; @@ -130,7 +132,7 @@ abstract class Statistic implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -140,10 +142,10 @@ abstract class Statistic implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->userid = 0; - $this->date = PropelDateTime::newInstance(null, null, 'DateTime'); + $this->date = PropelDateTime::newInstance(NULL, null, 'DateTime'); } /** @@ -158,9 +160,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -168,10 +170,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -180,7 +182,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -190,9 +192,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -201,45 +203,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -248,10 +248,10 @@ public function resetModified($col = null) * obj is an instance of Statistic, delegates to * equals(Statistic). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -273,7 +273,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -281,10 +281,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -292,15 +292,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -309,12 +309,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Statistic The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -324,13 +324,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -341,24 +341,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -366,7 +369,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -386,7 +389,7 @@ public function getId() /** * Get the [userid] column value. * - * @return int + * @return int|null */ public function getUserId() { @@ -397,12 +400,14 @@ public function getUserId() * Get the [optionally formatted] temporal [date] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime : string) */ public function getDate($format = null) { @@ -466,8 +471,8 @@ public function getScript() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -481,13 +486,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param int|null $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -505,21 +510,21 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Sets the value of [date] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setDate($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->date !== null || $dt !== null) { - if (($dt != $this->date) // normalized values don't match - || ($dt->format('Y-m-d H:i:s.u') === null) // or the entered value matches the default + if ( ($dt != $this->date) // normalized values don't match + || ($dt->format('Y-m-d H:i:s.u') === NULL) // or the entered value matches the default ) { $this->date = $dt === null ? null : clone $dt; $this->modifiedColumns[StatisticTableMap::COL_DATE] = true; @@ -527,13 +532,13 @@ public function setDate($v) } // if either are not null return $this; - } // setDate() + } /** * Set the value of [type] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setType($v) { @@ -547,13 +552,13 @@ public function setType($v) } return $this; - } // setType() + } /** * Set the value of [detail1] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDetail1($v) { @@ -567,13 +572,13 @@ public function setDetail1($v) } return $this; - } // setDetail1() + } /** * Set the value of [detail2] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDetail2($v) { @@ -587,13 +592,13 @@ public function setDetail2($v) } return $this; - } // setDetail2() + } /** * Set the value of [detail3] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setDetail3($v) { @@ -607,13 +612,13 @@ public function setDetail3($v) } return $this; - } // setDetail3() + } /** * Set the value of [script] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setScript($v) { @@ -627,7 +632,7 @@ public function setScript($v) } return $this; - } // setScript() + } /** * Indicates whether the columns in this object are only set to default values. @@ -635,21 +640,21 @@ public function setScript($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->userid !== 0) { - return false; - } + if ($this->userid !== 0) { + return false; + } - if ($this->date && $this->date->format('Y-m-d H:i:s.u') !== null) { - return false; - } + if ($this->date && $this->date->format('Y-m-d H:i:s.u') !== NULL) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -659,19 +664,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : StatisticTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -698,8 +704,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : StatisticTableMap::translateFieldName('Script', TableMap::TYPE_PHPNAME, $indexType)]; $this->script = (null !== $col) ? (string) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -707,6 +713,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 8; // 8 = StatisticTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Statistic'), 0, $e); } @@ -723,26 +730,27 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -776,13 +784,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Statistic::setDeleted() * @see Statistic::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -812,12 +820,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -862,12 +870,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -897,22 +905,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[StatisticTableMap::COL_ID] = true; @@ -958,27 +967,35 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'userid': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'date': $stmt->bindValue($identifier, $this->date ? $this->date->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'type': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); + break; case 'detail1': $stmt->bindValue($identifier, $this->detail1, PDO::PARAM_STR); + break; case 'detail2': $stmt->bindValue($identifier, $this->detail2, PDO::PARAM_STR); + break; case 'detail3': $stmt->bindValue($identifier, $this->detail3, PDO::PARAM_STR); + break; case 'script': $stmt->bindValue($identifier, $this->script, PDO::PARAM_STR); + break; } } @@ -1001,12 +1018,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1017,14 +1034,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = StatisticTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1036,39 +1053,38 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getUserId(); - break; + case 2: return $this->getDate(); - break; + case 3: return $this->getType(); - break; + case 4: return $this->getDetail1(); - break; + case 5: return $this->getDetail2(); - break; + case 6: return $this->getDetail3(); - break; + case 7: return $this->getScript(); - break; + default: return null; - break; } // switch() } @@ -1078,23 +1094,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Statistic'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Statistic'][$this->hashCode()] = true; $keys = StatisticTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getDate(), @@ -1103,9 +1119,9 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[5] => $this->getDetail2(), $keys[6] => $this->getDetail3(), $keys[7] => $this->getScript(), - ); + ]; if ($result[$keys[2]] instanceof \DateTimeInterface) { - $result[$keys[2]] = $result[$keys[2]]->format('c'); + $result[$keys[2]] = $result[$keys[2]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1115,6 +1131,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1126,7 +1143,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1136,30 +1153,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Statistic + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = StatisticTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Statistic + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1204,11 +1223,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = StatisticTableMap::getFieldNames($keyType); @@ -1236,6 +1255,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[7], $arr)) { $this->setScript($arr[$keys[7]]); } + + return $this; } /** @@ -1255,9 +1276,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Statistic The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1271,9 +1292,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(StatisticTableMap::DATABASE_NAME); @@ -1309,13 +1330,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildStatisticQuery::create(); $criteria->add(StatisticTableMap::COL_ID, $this->id); @@ -1327,7 +1348,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1357,19 +1378,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1380,12 +1402,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Statistic (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Statistic (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setUserId($this->getUserId()); $copyObj->setDate($this->getDate()); @@ -1396,7 +1419,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setScript($this->getScript()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1408,11 +1431,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Statistic Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1425,9 +1448,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\Statistic The current object (for fluent API support) - * @throws PropelException + * @param ChildUser|null $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { @@ -1453,11 +1476,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @param ConnectionInterface $con Optional Connection object. + * @return ChildUser|null The associated ChildUser object. + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1477,6 +1500,8 @@ public function getUser(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1497,6 +1522,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1505,14 +1532,16 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; + return $this; } /** @@ -1527,99 +1556,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1629,7 +1638,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1649,17 +1658,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/StatisticQuery.php b/generated-classes/TechWilk/Rota/Base/StatisticQuery.php index e70e0378..63b09466 100644 --- a/generated-classes/TechWilk/Rota/Base/StatisticQuery.php +++ b/generated-classes/TechWilk/Rota/Base/StatisticQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\StatisticTableMap; /** - * Base class that represents a query for the 'statistics' table. - * - * + * Base class that represents a query for the `statistics` table. * * @method ChildStatisticQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildStatisticQuery orderByUserId($order = Criteria::ASC) Order by the userid column @@ -58,20 +57,20 @@ * * @method \TechWilk\Rota\UserQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildStatistic findOne(ConnectionInterface $con = null) Return the first ChildStatistic matching the query - * @method ChildStatistic findOneOrCreate(ConnectionInterface $con = null) Return the first ChildStatistic matching the query, or a new ChildStatistic object populated from the query conditions when no match is found + * @method ChildStatistic|null findOne(?ConnectionInterface $con = null) Return the first ChildStatistic matching the query + * @method ChildStatistic findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildStatistic matching the query, or a new ChildStatistic object populated from the query conditions when no match is found + * + * @method ChildStatistic|null findOneById(int $id) Return the first ChildStatistic filtered by the id column + * @method ChildStatistic|null findOneByUserId(int $userid) Return the first ChildStatistic filtered by the userid column + * @method ChildStatistic|null findOneByDate(string $date) Return the first ChildStatistic filtered by the date column + * @method ChildStatistic|null findOneByType(string $type) Return the first ChildStatistic filtered by the type column + * @method ChildStatistic|null findOneByDetail1(string $detail1) Return the first ChildStatistic filtered by the detail1 column + * @method ChildStatistic|null findOneByDetail2(string $detail2) Return the first ChildStatistic filtered by the detail2 column + * @method ChildStatistic|null findOneByDetail3(string $detail3) Return the first ChildStatistic filtered by the detail3 column + * @method ChildStatistic|null findOneByScript(string $script) Return the first ChildStatistic filtered by the script column * - * @method ChildStatistic findOneById(int $id) Return the first ChildStatistic filtered by the id column - * @method ChildStatistic findOneByUserId(int $userid) Return the first ChildStatistic filtered by the userid column - * @method ChildStatistic findOneByDate(string $date) Return the first ChildStatistic filtered by the date column - * @method ChildStatistic findOneByType(string $type) Return the first ChildStatistic filtered by the type column - * @method ChildStatistic findOneByDetail1(string $detail1) Return the first ChildStatistic filtered by the detail1 column - * @method ChildStatistic findOneByDetail2(string $detail2) Return the first ChildStatistic filtered by the detail2 column - * @method ChildStatistic findOneByDetail3(string $detail3) Return the first ChildStatistic filtered by the detail3 column - * @method ChildStatistic findOneByScript(string $script) Return the first ChildStatistic filtered by the script column * - - * @method ChildStatistic requirePk($key, ConnectionInterface $con = null) Return the ChildStatistic by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildStatistic requireOne(ConnectionInterface $con = null) Return the first ChildStatistic matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildStatistic requirePk($key, ?ConnectionInterface $con = null) Return the ChildStatistic by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildStatistic requireOne(?ConnectionInterface $con = null) Return the first ChildStatistic matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildStatistic requireOneById(int $id) Return the first ChildStatistic filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildStatistic requireOneByUserId(int $userid) Return the first ChildStatistic filtered by the userid column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -82,17 +81,28 @@ * @method ChildStatistic requireOneByDetail3(string $detail3) Return the first ChildStatistic filtered by the detail3 column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildStatistic requireOneByScript(string $script) Return the first ChildStatistic filtered by the script column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildStatistic[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildStatistic objects based on current ModelCriteria - * @method ChildStatistic[]|ObjectCollection findById(int $id) Return ChildStatistic objects filtered by the id column - * @method ChildStatistic[]|ObjectCollection findByUserId(int $userid) Return ChildStatistic objects filtered by the userid column - * @method ChildStatistic[]|ObjectCollection findByDate(string $date) Return ChildStatistic objects filtered by the date column - * @method ChildStatistic[]|ObjectCollection findByType(string $type) Return ChildStatistic objects filtered by the type column - * @method ChildStatistic[]|ObjectCollection findByDetail1(string $detail1) Return ChildStatistic objects filtered by the detail1 column - * @method ChildStatistic[]|ObjectCollection findByDetail2(string $detail2) Return ChildStatistic objects filtered by the detail2 column - * @method ChildStatistic[]|ObjectCollection findByDetail3(string $detail3) Return ChildStatistic objects filtered by the detail3 column - * @method ChildStatistic[]|ObjectCollection findByScript(string $script) Return ChildStatistic objects filtered by the script column - * @method ChildStatistic[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildStatistic[]|Collection find(?ConnectionInterface $con = null) Return ChildStatistic objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildStatistic objects based on current ModelCriteria * + * @method ChildStatistic[]|Collection findById(int|array $id) Return ChildStatistic objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildStatistic objects filtered by the id column + * @method ChildStatistic[]|Collection findByUserId(int|array $userid) Return ChildStatistic objects filtered by the userid column + * @psalm-method Collection&\Traversable findByUserId(int|array $userid) Return ChildStatistic objects filtered by the userid column + * @method ChildStatistic[]|Collection findByDate(string|array $date) Return ChildStatistic objects filtered by the date column + * @psalm-method Collection&\Traversable findByDate(string|array $date) Return ChildStatistic objects filtered by the date column + * @method ChildStatistic[]|Collection findByType(string|array $type) Return ChildStatistic objects filtered by the type column + * @psalm-method Collection&\Traversable findByType(string|array $type) Return ChildStatistic objects filtered by the type column + * @method ChildStatistic[]|Collection findByDetail1(string|array $detail1) Return ChildStatistic objects filtered by the detail1 column + * @psalm-method Collection&\Traversable findByDetail1(string|array $detail1) Return ChildStatistic objects filtered by the detail1 column + * @method ChildStatistic[]|Collection findByDetail2(string|array $detail2) Return ChildStatistic objects filtered by the detail2 column + * @psalm-method Collection&\Traversable findByDetail2(string|array $detail2) Return ChildStatistic objects filtered by the detail2 column + * @method ChildStatistic[]|Collection findByDetail3(string|array $detail3) Return ChildStatistic objects filtered by the detail3 column + * @psalm-method Collection&\Traversable findByDetail3(string|array $detail3) Return ChildStatistic objects filtered by the detail3 column + * @method ChildStatistic[]|Collection findByScript(string|array $script) Return ChildStatistic objects filtered by the script column + * @psalm-method Collection&\Traversable findByScript(string|array $script) Return ChildStatistic objects filtered by the script column + * + * @method ChildStatistic[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class StatisticQuery extends ModelCriteria { @@ -101,9 +111,9 @@ abstract class StatisticQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\StatisticQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Statistic', $modelAlias = null) { @@ -113,12 +123,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildStatisticQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildStatisticQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildStatisticQuery) { return $criteria; @@ -148,7 +158,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildStatistic|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -180,8 +190,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -213,8 +223,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildStatistic|array|mixed the result, formatted by the current formatter */ @@ -234,12 +244,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -256,25 +266,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(StatisticTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(StatisticTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(StatisticTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(StatisticTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -287,15 +303,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -315,7 +331,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -330,15 +348,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -358,7 +376,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -371,17 +391,17 @@ public function filterByUserId($userId = null, $comparison = null) * $query->filterByDate(array('max' => 'yesterday')); // WHERE date > '2011-03-13' * * - * @param mixed $date The value to use as filter. + * @param mixed $date The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDate($date = null, $comparison = null) + public function filterByDate($date = null, ?string $comparison = null) { if (is_array($date)) { $useMinMax = false; @@ -401,7 +421,9 @@ public function filterByDate($date = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_DATE, $date, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_DATE, $date, $comparison); + + return $this; } /** @@ -411,14 +433,15 @@ public function filterByDate($date = null, $comparison = null) * * $query->filterByType('fooValue'); // WHERE type = 'fooValue' * $query->filterByType('%fooValue%', Criteria::LIKE); // WHERE type LIKE '%fooValue%' + * $query->filterByType(['foo', 'bar']); // WHERE type IN ('foo', 'bar') * * - * @param string $type The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $type The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByType($type = null, $comparison = null) + public function filterByType($type = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($type)) { @@ -426,7 +449,9 @@ public function filterByType($type = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_TYPE, $type, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_TYPE, $type, $comparison); + + return $this; } /** @@ -436,14 +461,15 @@ public function filterByType($type = null, $comparison = null) * * $query->filterByDetail1('fooValue'); // WHERE detail1 = 'fooValue' * $query->filterByDetail1('%fooValue%', Criteria::LIKE); // WHERE detail1 LIKE '%fooValue%' + * $query->filterByDetail1(['foo', 'bar']); // WHERE detail1 IN ('foo', 'bar') * * - * @param string $detail1 The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $detail1 The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDetail1($detail1 = null, $comparison = null) + public function filterByDetail1($detail1 = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($detail1)) { @@ -451,7 +477,9 @@ public function filterByDetail1($detail1 = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_DETAIL1, $detail1, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_DETAIL1, $detail1, $comparison); + + return $this; } /** @@ -461,14 +489,15 @@ public function filterByDetail1($detail1 = null, $comparison = null) * * $query->filterByDetail2('fooValue'); // WHERE detail2 = 'fooValue' * $query->filterByDetail2('%fooValue%', Criteria::LIKE); // WHERE detail2 LIKE '%fooValue%' + * $query->filterByDetail2(['foo', 'bar']); // WHERE detail2 IN ('foo', 'bar') * * - * @param string $detail2 The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $detail2 The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDetail2($detail2 = null, $comparison = null) + public function filterByDetail2($detail2 = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($detail2)) { @@ -476,7 +505,9 @@ public function filterByDetail2($detail2 = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_DETAIL2, $detail2, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_DETAIL2, $detail2, $comparison); + + return $this; } /** @@ -486,14 +517,15 @@ public function filterByDetail2($detail2 = null, $comparison = null) * * $query->filterByDetail3('fooValue'); // WHERE detail3 = 'fooValue' * $query->filterByDetail3('%fooValue%', Criteria::LIKE); // WHERE detail3 LIKE '%fooValue%' + * $query->filterByDetail3(['foo', 'bar']); // WHERE detail3 IN ('foo', 'bar') * * - * @param string $detail3 The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $detail3 The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDetail3($detail3 = null, $comparison = null) + public function filterByDetail3($detail3 = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($detail3)) { @@ -501,7 +533,9 @@ public function filterByDetail3($detail3 = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_DETAIL3, $detail3, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_DETAIL3, $detail3, $comparison); + + return $this; } /** @@ -511,14 +545,15 @@ public function filterByDetail3($detail3 = null, $comparison = null) * * $query->filterByScript('fooValue'); // WHERE script = 'fooValue' * $query->filterByScript('%fooValue%', Criteria::LIKE); // WHERE script LIKE '%fooValue%' + * $query->filterByScript(['foo', 'bar']); // WHERE script IN ('foo', 'bar') * * - * @param string $script The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $script The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByScript($script = null, $comparison = null) + public function filterByScript($script = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($script)) { @@ -526,20 +561,22 @@ public function filterByScript($script = null, $comparison = null) } } - return $this->addUsingAlias(StatisticTableMap::COL_SCRIPT, $script, $comparison); + $this->addUsingAlias(StatisticTableMap::COL_SCRIPT, $script, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -549,8 +586,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(StatisticTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -559,12 +598,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -593,9 +632,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN) * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -606,12 +645,108 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_J ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::LEFT_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildStatistic $statistic Object to remove from the list of results + * @param ChildStatistic $statistic Object to remove from the list of results * - * @return $this|ChildStatisticQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($statistic = null) { @@ -628,7 +763,7 @@ public function prune($statistic = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(StatisticTableMap::DATABASE_NAME); @@ -653,12 +788,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(StatisticTableMap::DATABASE_NAME); @@ -682,4 +817,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // StatisticQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/Swap.php b/generated-classes/TechWilk/Rota/Base/Swap.php index f31d23b5..f5cbfd32 100644 --- a/generated-classes/TechWilk/Rota/Base/Swap.php +++ b/generated-classes/TechWilk/Rota/Base/Swap.php @@ -19,7 +19,6 @@ use Propel\Runtime\Util\PropelDateTime; use TechWilk\Rota\EventPerson as ChildEventPerson; use TechWilk\Rota\EventPersonQuery as ChildEventPersonQuery; -use TechWilk\Rota\Swap as ChildSwap; use TechWilk\Rota\SwapQuery as ChildSwapQuery; use TechWilk\Rota\User as ChildUser; use TechWilk\Rota\UserQuery as ChildUserQuery; @@ -38,19 +37,21 @@ abstract class Swap implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\SwapTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\SwapTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -59,14 +60,14 @@ abstract class Swap implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -132,14 +133,14 @@ abstract class Swap implements ActiveRecordInterface /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; @@ -167,7 +168,7 @@ abstract class Swap implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -177,7 +178,7 @@ abstract class Swap implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->eventpersonid = 0; $this->olduserroleid = 0; @@ -198,9 +199,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -208,10 +209,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -220,7 +221,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -230,9 +231,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -241,45 +242,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -288,10 +287,10 @@ public function resetModified($col = null) * obj is an instance of Swap, delegates to * equals(Swap). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -313,7 +312,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -321,10 +320,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -332,15 +331,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -349,12 +348,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|Swap The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -364,13 +363,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -381,24 +380,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -406,7 +408,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -497,12 +499,14 @@ public function getVerificationCode() * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -517,12 +521,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -536,8 +542,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -551,13 +557,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [eventpersonid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setEventPersonId($v) { @@ -575,13 +581,13 @@ public function setEventPersonId($v) } return $this; - } // setEventPersonId() + } /** * Set the value of [olduserroleid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setOldUserRoleId($v) { @@ -599,13 +605,13 @@ public function setOldUserRoleId($v) } return $this; - } // setOldUserRoleId() + } /** * Set the value of [newuserroleid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setNewUserRoleId($v) { @@ -623,13 +629,13 @@ public function setNewUserRoleId($v) } return $this; - } // setNewUserRoleId() + } /** * Set the value of [accepted] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setAccepted($v) { @@ -643,13 +649,13 @@ public function setAccepted($v) } return $this; - } // setAccepted() + } /** * Set the value of [declined] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setDeclined($v) { @@ -663,13 +669,13 @@ public function setDeclined($v) } return $this; - } // setDeclined() + } /** * Set the value of [requestedby] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setRequestedBy($v) { @@ -687,13 +693,13 @@ public function setRequestedBy($v) } return $this; - } // setRequestedBy() + } /** * Set the value of [verificationcode] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setVerificationCode($v) { @@ -707,14 +713,14 @@ public function setVerificationCode($v) } return $this; - } // setVerificationCode() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -727,14 +733,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -747,7 +753,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -755,33 +761,33 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->eventpersonid !== 0) { - return false; - } + if ($this->eventpersonid !== 0) { + return false; + } - if ($this->olduserroleid !== 0) { - return false; - } + if ($this->olduserroleid !== 0) { + return false; + } - if ($this->newuserroleid !== 0) { - return false; - } + if ($this->newuserroleid !== 0) { + return false; + } - if ($this->accepted !== 0) { - return false; - } + if ($this->accepted !== 0) { + return false; + } - if ($this->declined !== 0) { - return false; - } + if ($this->declined !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -791,19 +797,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : SwapTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -839,8 +846,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -848,6 +855,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 10; // 10 = SwapTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\Swap'), 0, $e); } @@ -864,9 +872,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aEventPerson !== null && $this->eventpersonid !== $this->aEventPerson->getId()) { $this->aEventPerson = null; @@ -880,19 +889,19 @@ public function ensureConsistency() if ($this->aUser !== null && $this->requestedby !== $this->aUser->getId()) { $this->aUser = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -929,13 +938,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see Swap::setDeleted() * @see Swap::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -965,12 +974,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -990,12 +999,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(SwapTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(SwapTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -1027,12 +1037,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -1083,22 +1093,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[SwapTableMap::COL_ID] = true; @@ -1150,33 +1161,43 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'eventPersonId': $stmt->bindValue($identifier, $this->eventpersonid, PDO::PARAM_INT); + break; case 'oldUserRoleId': $stmt->bindValue($identifier, $this->olduserroleid, PDO::PARAM_INT); + break; case 'newUserRoleId': $stmt->bindValue($identifier, $this->newuserroleid, PDO::PARAM_INT); + break; case 'accepted': $stmt->bindValue($identifier, $this->accepted, PDO::PARAM_INT); + break; case 'declined': $stmt->bindValue($identifier, $this->declined, PDO::PARAM_INT); + break; case 'requestedBy': $stmt->bindValue($identifier, $this->requestedby, PDO::PARAM_INT); + break; case 'verificationCode': $stmt->bindValue($identifier, $this->verificationcode, PDO::PARAM_STR); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -1199,12 +1220,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1215,14 +1236,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = SwapTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1234,45 +1255,44 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getEventPersonId(); - break; + case 2: return $this->getOldUserRoleId(); - break; + case 3: return $this->getNewUserRoleId(); - break; + case 4: return $this->getAccepted(); - break; + case 5: return $this->getDeclined(); - break; + case 6: return $this->getRequestedBy(); - break; + case 7: return $this->getVerificationCode(); - break; + case 8: return $this->getCreated(); - break; + case 9: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -1282,23 +1302,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['Swap'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['Swap'][$this->hashCode()] = true; $keys = SwapTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getEventPersonId(), $keys[2] => $this->getOldUserRoleId(), @@ -1309,13 +1329,13 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[7] => $this->getVerificationCode(), $keys[8] => $this->getCreated(), $keys[9] => $this->getUpdated(), - ); + ]; if ($result[$keys[8]] instanceof \DateTimeInterface) { - $result[$keys[8]] = $result[$keys[8]]->format('c'); + $result[$keys[8]] = $result[$keys[8]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[9]] instanceof \DateTimeInterface) { - $result[$keys[9]] = $result[$keys[9]]->format('c'); + $result[$keys[9]] = $result[$keys[9]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1325,6 +1345,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aEventPerson) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventPerson'; @@ -1336,9 +1357,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'EventPerson'; } - $result[$key] = $this->aEventPerson->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aEventPerson->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aOldUserRole) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userRole'; @@ -1350,9 +1372,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'OldUserRole'; } - $result[$key] = $this->aOldUserRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aOldUserRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aNewUserRole) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userRole'; @@ -1364,9 +1387,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'NewUserRole'; } - $result[$key] = $this->aNewUserRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aNewUserRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1378,7 +1402,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1388,30 +1412,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\Swap + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = SwapTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\Swap + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1462,11 +1488,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = SwapTableMap::getFieldNames($keyType); @@ -1500,6 +1526,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[9], $arr)) { $this->setUpdated($arr[$keys[9]]); } + + return $this; } /** @@ -1519,9 +1547,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\Swap The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1535,9 +1563,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(SwapTableMap::DATABASE_NAME); @@ -1579,13 +1607,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildSwapQuery::create(); $criteria->add(SwapTableMap::COL_ID, $this->id); @@ -1597,7 +1625,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1627,19 +1655,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1650,12 +1679,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\Swap (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\Swap (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setEventPersonId($this->getEventPersonId()); $copyObj->setOldUserRoleId($this->getOldUserRoleId()); @@ -1668,7 +1698,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setUpdated($this->getUpdated()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1680,11 +1710,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\Swap Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1697,9 +1727,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildEventPerson object. * - * @param ChildEventPerson $v - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) - * @throws PropelException + * @param ChildEventPerson $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setEventPerson(ChildEventPerson $v = null) { @@ -1725,11 +1755,11 @@ public function setEventPerson(ChildEventPerson $v = null) /** * Get the associated ChildEventPerson object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildEventPerson The associated ChildEventPerson object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventPerson(ConnectionInterface $con = null) + public function getEventPerson(?ConnectionInterface $con = null) { if ($this->aEventPerson === null && ($this->eventpersonid != 0)) { $this->aEventPerson = ChildEventPersonQuery::create()->findPk($this->eventpersonid, $con); @@ -1748,9 +1778,9 @@ public function getEventPerson(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildUserRole object. * - * @param ChildUserRole $v - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) - * @throws PropelException + * @param ChildUserRole $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setOldUserRole(ChildUserRole $v = null) { @@ -1776,11 +1806,11 @@ public function setOldUserRole(ChildUserRole $v = null) /** * Get the associated ChildUserRole object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUserRole The associated ChildUserRole object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getOldUserRole(ConnectionInterface $con = null) + public function getOldUserRole(?ConnectionInterface $con = null) { if ($this->aOldUserRole === null && ($this->olduserroleid != 0)) { $this->aOldUserRole = ChildUserRoleQuery::create()->findPk($this->olduserroleid, $con); @@ -1799,9 +1829,9 @@ public function getOldUserRole(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildUserRole object. * - * @param ChildUserRole $v - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) - * @throws PropelException + * @param ChildUserRole $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setNewUserRole(ChildUserRole $v = null) { @@ -1827,11 +1857,11 @@ public function setNewUserRole(ChildUserRole $v = null) /** * Get the associated ChildUserRole object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUserRole The associated ChildUserRole object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getNewUserRole(ConnectionInterface $con = null) + public function getNewUserRole(?ConnectionInterface $con = null) { if ($this->aNewUserRole === null && ($this->newuserroleid != 0)) { $this->aNewUserRole = ChildUserRoleQuery::create()->findPk($this->newuserroleid, $con); @@ -1850,14 +1880,14 @@ public function getNewUserRole(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\Swap The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { if ($v === null) { - $this->setRequestedBy(null); + $this->setRequestedBy(NULL); } else { $this->setRequestedBy($v->getId()); } @@ -1878,11 +1908,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->requestedby != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->requestedby, $con); @@ -1902,6 +1932,8 @@ public function getUser(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1933,6 +1965,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1941,9 +1975,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) @@ -1952,6 +1987,7 @@ public function clearAllReferences($deep = false) $this->aOldUserRole = null; $this->aNewUserRole = null; $this->aUser = null; + return $this; } /** @@ -1969,7 +2005,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildSwap The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -1980,99 +2016,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -2082,7 +2098,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -2102,17 +2118,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/SwapQuery.php b/generated-classes/TechWilk/Rota/Base/SwapQuery.php index 138cd8c0..0fbbb218 100644 --- a/generated-classes/TechWilk/Rota/Base/SwapQuery.php +++ b/generated-classes/TechWilk/Rota/Base/SwapQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\SwapTableMap; /** - * Base class that represents a query for the 'swaps' table. - * - * + * Base class that represents a query for the `swaps` table. * * @method ChildSwapQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildSwapQuery orderByEventPersonId($order = Criteria::ASC) Order by the eventPersonId column @@ -90,24 +89,24 @@ * @method ChildSwapQuery rightJoinWithUser() Adds a RIGHT JOIN clause and with to the query using the User relation * @method ChildSwapQuery innerJoinWithUser() Adds a INNER JOIN clause and with to the query using the User relation * - * @method \TechWilk\Rota\EventPersonQuery|\TechWilk\Rota\UserRoleQuery|\TechWilk\Rota\UserQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria + * @method \TechWilk\Rota\EventPersonQuery|\TechWilk\Rota\UserRoleQuery|\TechWilk\Rota\UserRoleQuery|\TechWilk\Rota\UserQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildSwap findOne(ConnectionInterface $con = null) Return the first ChildSwap matching the query - * @method ChildSwap findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSwap matching the query, or a new ChildSwap object populated from the query conditions when no match is found + * @method ChildSwap|null findOne(?ConnectionInterface $con = null) Return the first ChildSwap matching the query + * @method ChildSwap findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildSwap matching the query, or a new ChildSwap object populated from the query conditions when no match is found * - * @method ChildSwap findOneById(int $id) Return the first ChildSwap filtered by the id column - * @method ChildSwap findOneByEventPersonId(int $eventPersonId) Return the first ChildSwap filtered by the eventPersonId column - * @method ChildSwap findOneByOldUserRoleId(int $oldUserRoleId) Return the first ChildSwap filtered by the oldUserRoleId column - * @method ChildSwap findOneByNewUserRoleId(int $newUserRoleId) Return the first ChildSwap filtered by the newUserRoleId column - * @method ChildSwap findOneByAccepted(int $accepted) Return the first ChildSwap filtered by the accepted column - * @method ChildSwap findOneByDeclined(int $declined) Return the first ChildSwap filtered by the declined column - * @method ChildSwap findOneByRequestedBy(int $requestedBy) Return the first ChildSwap filtered by the requestedBy column - * @method ChildSwap findOneByVerificationCode(string $verificationCode) Return the first ChildSwap filtered by the verificationCode column - * @method ChildSwap findOneByCreated(string $created) Return the first ChildSwap filtered by the created column - * @method ChildSwap findOneByUpdated(string $updated) Return the first ChildSwap filtered by the updated column * - - * @method ChildSwap requirePk($key, ConnectionInterface $con = null) Return the ChildSwap by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildSwap requireOne(ConnectionInterface $con = null) Return the first ChildSwap matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildSwap|null findOneById(int $id) Return the first ChildSwap filtered by the id column + * @method ChildSwap|null findOneByEventPersonId(int $eventPersonId) Return the first ChildSwap filtered by the eventPersonId column + * @method ChildSwap|null findOneByOldUserRoleId(int $oldUserRoleId) Return the first ChildSwap filtered by the oldUserRoleId column + * @method ChildSwap|null findOneByNewUserRoleId(int $newUserRoleId) Return the first ChildSwap filtered by the newUserRoleId column + * @method ChildSwap|null findOneByAccepted(int $accepted) Return the first ChildSwap filtered by the accepted column + * @method ChildSwap|null findOneByDeclined(int $declined) Return the first ChildSwap filtered by the declined column + * @method ChildSwap|null findOneByRequestedBy(int $requestedBy) Return the first ChildSwap filtered by the requestedBy column + * @method ChildSwap|null findOneByVerificationCode(string $verificationCode) Return the first ChildSwap filtered by the verificationCode column + * @method ChildSwap|null findOneByCreated(string $created) Return the first ChildSwap filtered by the created column + * @method ChildSwap|null findOneByUpdated(string $updated) Return the first ChildSwap filtered by the updated column + * + * @method ChildSwap requirePk($key, ?ConnectionInterface $con = null) Return the ChildSwap by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildSwap requireOne(?ConnectionInterface $con = null) Return the first ChildSwap matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildSwap requireOneById(int $id) Return the first ChildSwap filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildSwap requireOneByEventPersonId(int $eventPersonId) Return the first ChildSwap filtered by the eventPersonId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -120,19 +119,32 @@ * @method ChildSwap requireOneByCreated(string $created) Return the first ChildSwap filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildSwap requireOneByUpdated(string $updated) Return the first ChildSwap filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildSwap[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildSwap objects based on current ModelCriteria - * @method ChildSwap[]|ObjectCollection findById(int $id) Return ChildSwap objects filtered by the id column - * @method ChildSwap[]|ObjectCollection findByEventPersonId(int $eventPersonId) Return ChildSwap objects filtered by the eventPersonId column - * @method ChildSwap[]|ObjectCollection findByOldUserRoleId(int $oldUserRoleId) Return ChildSwap objects filtered by the oldUserRoleId column - * @method ChildSwap[]|ObjectCollection findByNewUserRoleId(int $newUserRoleId) Return ChildSwap objects filtered by the newUserRoleId column - * @method ChildSwap[]|ObjectCollection findByAccepted(int $accepted) Return ChildSwap objects filtered by the accepted column - * @method ChildSwap[]|ObjectCollection findByDeclined(int $declined) Return ChildSwap objects filtered by the declined column - * @method ChildSwap[]|ObjectCollection findByRequestedBy(int $requestedBy) Return ChildSwap objects filtered by the requestedBy column - * @method ChildSwap[]|ObjectCollection findByVerificationCode(string $verificationCode) Return ChildSwap objects filtered by the verificationCode column - * @method ChildSwap[]|ObjectCollection findByCreated(string $created) Return ChildSwap objects filtered by the created column - * @method ChildSwap[]|ObjectCollection findByUpdated(string $updated) Return ChildSwap objects filtered by the updated column - * @method ChildSwap[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildSwap[]|Collection find(?ConnectionInterface $con = null) Return ChildSwap objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildSwap objects based on current ModelCriteria + * + * @method ChildSwap[]|Collection findById(int|array $id) Return ChildSwap objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildSwap objects filtered by the id column + * @method ChildSwap[]|Collection findByEventPersonId(int|array $eventPersonId) Return ChildSwap objects filtered by the eventPersonId column + * @psalm-method Collection&\Traversable findByEventPersonId(int|array $eventPersonId) Return ChildSwap objects filtered by the eventPersonId column + * @method ChildSwap[]|Collection findByOldUserRoleId(int|array $oldUserRoleId) Return ChildSwap objects filtered by the oldUserRoleId column + * @psalm-method Collection&\Traversable findByOldUserRoleId(int|array $oldUserRoleId) Return ChildSwap objects filtered by the oldUserRoleId column + * @method ChildSwap[]|Collection findByNewUserRoleId(int|array $newUserRoleId) Return ChildSwap objects filtered by the newUserRoleId column + * @psalm-method Collection&\Traversable findByNewUserRoleId(int|array $newUserRoleId) Return ChildSwap objects filtered by the newUserRoleId column + * @method ChildSwap[]|Collection findByAccepted(int|array $accepted) Return ChildSwap objects filtered by the accepted column + * @psalm-method Collection&\Traversable findByAccepted(int|array $accepted) Return ChildSwap objects filtered by the accepted column + * @method ChildSwap[]|Collection findByDeclined(int|array $declined) Return ChildSwap objects filtered by the declined column + * @psalm-method Collection&\Traversable findByDeclined(int|array $declined) Return ChildSwap objects filtered by the declined column + * @method ChildSwap[]|Collection findByRequestedBy(int|array $requestedBy) Return ChildSwap objects filtered by the requestedBy column + * @psalm-method Collection&\Traversable findByRequestedBy(int|array $requestedBy) Return ChildSwap objects filtered by the requestedBy column + * @method ChildSwap[]|Collection findByVerificationCode(string|array $verificationCode) Return ChildSwap objects filtered by the verificationCode column + * @psalm-method Collection&\Traversable findByVerificationCode(string|array $verificationCode) Return ChildSwap objects filtered by the verificationCode column + * @method ChildSwap[]|Collection findByCreated(string|array $created) Return ChildSwap objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildSwap objects filtered by the created column + * @method ChildSwap[]|Collection findByUpdated(string|array $updated) Return ChildSwap objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildSwap objects filtered by the updated column * + * @method ChildSwap[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class SwapQuery extends ModelCriteria { @@ -141,9 +153,9 @@ abstract class SwapQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\SwapQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\Swap', $modelAlias = null) { @@ -153,12 +165,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildSwapQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildSwapQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildSwapQuery) { return $criteria; @@ -188,7 +200,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildSwap|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -220,8 +232,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -253,8 +265,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildSwap|array|mixed the result, formatted by the current formatter */ @@ -274,12 +286,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -296,25 +308,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(SwapTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(SwapTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(SwapTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(SwapTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -327,15 +345,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -355,7 +373,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(SwapTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -370,15 +390,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByEventPerson() * - * @param mixed $eventPersonId The value to use as filter. + * @param mixed $eventPersonId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventPersonId($eventPersonId = null, $comparison = null) + public function filterByEventPersonId($eventPersonId = null, ?string $comparison = null) { if (is_array($eventPersonId)) { $useMinMax = false; @@ -398,7 +418,9 @@ public function filterByEventPersonId($eventPersonId = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_EVENTPERSONID, $eventPersonId, $comparison); + $this->addUsingAlias(SwapTableMap::COL_EVENTPERSONID, $eventPersonId, $comparison); + + return $this; } /** @@ -413,15 +435,15 @@ public function filterByEventPersonId($eventPersonId = null, $comparison = null) * * @see filterByOldUserRole() * - * @param mixed $oldUserRoleId The value to use as filter. + * @param mixed $oldUserRoleId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByOldUserRoleId($oldUserRoleId = null, $comparison = null) + public function filterByOldUserRoleId($oldUserRoleId = null, ?string $comparison = null) { if (is_array($oldUserRoleId)) { $useMinMax = false; @@ -441,7 +463,9 @@ public function filterByOldUserRoleId($oldUserRoleId = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_OLDUSERROLEID, $oldUserRoleId, $comparison); + $this->addUsingAlias(SwapTableMap::COL_OLDUSERROLEID, $oldUserRoleId, $comparison); + + return $this; } /** @@ -456,15 +480,15 @@ public function filterByOldUserRoleId($oldUserRoleId = null, $comparison = null) * * @see filterByNewUserRole() * - * @param mixed $newUserRoleId The value to use as filter. + * @param mixed $newUserRoleId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNewUserRoleId($newUserRoleId = null, $comparison = null) + public function filterByNewUserRoleId($newUserRoleId = null, ?string $comparison = null) { if (is_array($newUserRoleId)) { $useMinMax = false; @@ -484,7 +508,9 @@ public function filterByNewUserRoleId($newUserRoleId = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_NEWUSERROLEID, $newUserRoleId, $comparison); + $this->addUsingAlias(SwapTableMap::COL_NEWUSERROLEID, $newUserRoleId, $comparison); + + return $this; } /** @@ -497,15 +523,15 @@ public function filterByNewUserRoleId($newUserRoleId = null, $comparison = null) * $query->filterByAccepted(array('min' => 12)); // WHERE accepted > 12 * * - * @param mixed $accepted The value to use as filter. + * @param mixed $accepted The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAccepted($accepted = null, $comparison = null) + public function filterByAccepted($accepted = null, ?string $comparison = null) { if (is_array($accepted)) { $useMinMax = false; @@ -525,7 +551,9 @@ public function filterByAccepted($accepted = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_ACCEPTED, $accepted, $comparison); + $this->addUsingAlias(SwapTableMap::COL_ACCEPTED, $accepted, $comparison); + + return $this; } /** @@ -538,15 +566,15 @@ public function filterByAccepted($accepted = null, $comparison = null) * $query->filterByDeclined(array('min' => 12)); // WHERE declined > 12 * * - * @param mixed $declined The value to use as filter. + * @param mixed $declined The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByDeclined($declined = null, $comparison = null) + public function filterByDeclined($declined = null, ?string $comparison = null) { if (is_array($declined)) { $useMinMax = false; @@ -566,7 +594,9 @@ public function filterByDeclined($declined = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_DECLINED, $declined, $comparison); + $this->addUsingAlias(SwapTableMap::COL_DECLINED, $declined, $comparison); + + return $this; } /** @@ -581,15 +611,15 @@ public function filterByDeclined($declined = null, $comparison = null) * * @see filterByUser() * - * @param mixed $requestedBy The value to use as filter. + * @param mixed $requestedBy The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRequestedBy($requestedBy = null, $comparison = null) + public function filterByRequestedBy($requestedBy = null, ?string $comparison = null) { if (is_array($requestedBy)) { $useMinMax = false; @@ -609,7 +639,9 @@ public function filterByRequestedBy($requestedBy = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_REQUESTEDBY, $requestedBy, $comparison); + $this->addUsingAlias(SwapTableMap::COL_REQUESTEDBY, $requestedBy, $comparison); + + return $this; } /** @@ -619,14 +651,15 @@ public function filterByRequestedBy($requestedBy = null, $comparison = null) * * $query->filterByVerificationCode('fooValue'); // WHERE verificationCode = 'fooValue' * $query->filterByVerificationCode('%fooValue%', Criteria::LIKE); // WHERE verificationCode LIKE '%fooValue%' + * $query->filterByVerificationCode(['foo', 'bar']); // WHERE verificationCode IN ('foo', 'bar') * * - * @param string $verificationCode The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $verificationCode The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByVerificationCode($verificationCode = null, $comparison = null) + public function filterByVerificationCode($verificationCode = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($verificationCode)) { @@ -634,7 +667,9 @@ public function filterByVerificationCode($verificationCode = null, $comparison = } } - return $this->addUsingAlias(SwapTableMap::COL_VERIFICATIONCODE, $verificationCode, $comparison); + $this->addUsingAlias(SwapTableMap::COL_VERIFICATIONCODE, $verificationCode, $comparison); + + return $this; } /** @@ -647,17 +682,17 @@ public function filterByVerificationCode($verificationCode = null, $comparison = * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -677,7 +712,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(SwapTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -690,17 +727,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -720,20 +757,22 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(SwapTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(SwapTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\EventPerson object * * @param \TechWilk\Rota\EventPerson|ObjectCollection $eventPerson The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventPerson($eventPerson, $comparison = null) + public function filterByEventPerson($eventPerson, ?string $comparison = null) { if ($eventPerson instanceof \TechWilk\Rota\EventPerson) { return $this @@ -743,8 +782,10 @@ public function filterByEventPerson($eventPerson, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(SwapTableMap::COL_EVENTPERSONID, $eventPerson->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByEventPerson() only accepts arguments of type \TechWilk\Rota\EventPerson or Collection'); } @@ -753,12 +794,12 @@ public function filterByEventPerson($eventPerson, $comparison = null) /** * Adds a JOIN clause to the query using the EventPerson relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventPerson($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEventPerson(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventPerson'); @@ -787,9 +828,9 @@ public function joinEventPerson($relationAlias = null, $joinType = Criteria::INN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventPersonQuery A secondary query class using the current class as primary query */ @@ -800,17 +841,113 @@ public function useEventPersonQuery($relationAlias = null, $joinType = Criteria: ->useQuery($relationAlias ? $relationAlias : 'EventPerson', '\TechWilk\Rota\EventPersonQuery'); } + /** + * Use the EventPerson relation EventPerson object + * + * @param callable(\TechWilk\Rota\EventPersonQuery):\TechWilk\Rota\EventPersonQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventPersonQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventPersonQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventPerson table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the EXISTS statement + */ + public function useEventPersonExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useExistsQuery('EventPerson', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventPerson table for a NOT EXISTS query. + * + * @see useEventPersonExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the NOT EXISTS statement + */ + public function useEventPersonNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useExistsQuery('EventPerson', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventPerson table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the IN statement + */ + public function useInEventPersonQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useInQuery('EventPerson', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventPerson table for a NOT IN query. + * + * @see useEventPersonInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the NOT IN statement + */ + public function useNotInEventPersonQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useInQuery('EventPerson', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\UserRole object * * @param \TechWilk\Rota\UserRole|ObjectCollection $userRole The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByOldUserRole($userRole, $comparison = null) + public function filterByOldUserRole($userRole, ?string $comparison = null) { if ($userRole instanceof \TechWilk\Rota\UserRole) { return $this @@ -820,8 +957,10 @@ public function filterByOldUserRole($userRole, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(SwapTableMap::COL_OLDUSERROLEID, $userRole->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByOldUserRole() only accepts arguments of type \TechWilk\Rota\UserRole or Collection'); } @@ -830,12 +969,12 @@ public function filterByOldUserRole($userRole, $comparison = null) /** * Adds a JOIN clause to the query using the OldUserRole relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinOldUserRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinOldUserRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('OldUserRole'); @@ -864,9 +1003,9 @@ public function joinOldUserRole($relationAlias = null, $joinType = Criteria::INN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserRoleQuery A secondary query class using the current class as primary query */ @@ -877,17 +1016,113 @@ public function useOldUserRoleQuery($relationAlias = null, $joinType = Criteria: ->useQuery($relationAlias ? $relationAlias : 'OldUserRole', '\TechWilk\Rota\UserRoleQuery'); } + /** + * Use the OldUserRole relation UserRole object + * + * @param callable(\TechWilk\Rota\UserRoleQuery):\TechWilk\Rota\UserRoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withOldUserRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useOldUserRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the OldUserRole relation to the UserRole table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the EXISTS statement + */ + public function useOldUserRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('OldUserRole', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the OldUserRole relation to the UserRole table for a NOT EXISTS query. + * + * @see useOldUserRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT EXISTS statement + */ + public function useOldUserRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('OldUserRole', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the OldUserRole relation to the UserRole table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the IN statement + */ + public function useInOldUserRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('OldUserRole', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the OldUserRole relation to the UserRole table for a NOT IN query. + * + * @see useOldUserRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT IN statement + */ + public function useNotInOldUserRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('OldUserRole', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\UserRole object * * @param \TechWilk\Rota\UserRole|ObjectCollection $userRole The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNewUserRole($userRole, $comparison = null) + public function filterByNewUserRole($userRole, ?string $comparison = null) { if ($userRole instanceof \TechWilk\Rota\UserRole) { return $this @@ -897,8 +1132,10 @@ public function filterByNewUserRole($userRole, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(SwapTableMap::COL_NEWUSERROLEID, $userRole->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByNewUserRole() only accepts arguments of type \TechWilk\Rota\UserRole or Collection'); } @@ -907,12 +1144,12 @@ public function filterByNewUserRole($userRole, $comparison = null) /** * Adds a JOIN clause to the query using the NewUserRole relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinNewUserRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinNewUserRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('NewUserRole'); @@ -941,9 +1178,9 @@ public function joinNewUserRole($relationAlias = null, $joinType = Criteria::INN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserRoleQuery A secondary query class using the current class as primary query */ @@ -954,17 +1191,113 @@ public function useNewUserRoleQuery($relationAlias = null, $joinType = Criteria: ->useQuery($relationAlias ? $relationAlias : 'NewUserRole', '\TechWilk\Rota\UserRoleQuery'); } + /** + * Use the NewUserRole relation UserRole object + * + * @param callable(\TechWilk\Rota\UserRoleQuery):\TechWilk\Rota\UserRoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withNewUserRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useNewUserRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the NewUserRole relation to the UserRole table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the EXISTS statement + */ + public function useNewUserRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('NewUserRole', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the NewUserRole relation to the UserRole table for a NOT EXISTS query. + * + * @see useNewUserRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT EXISTS statement + */ + public function useNewUserRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('NewUserRole', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the NewUserRole relation to the UserRole table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the IN statement + */ + public function useInNewUserRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('NewUserRole', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the NewUserRole relation to the UserRole table for a NOT IN query. + * + * @see useNewUserRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT IN statement + */ + public function useNotInNewUserRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('NewUserRole', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -974,8 +1307,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(SwapTableMap::COL_REQUESTEDBY, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -984,12 +1319,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -1018,9 +1353,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -1031,12 +1366,108 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildSwap $swap Object to remove from the list of results + * @param ChildSwap $swap Object to remove from the list of results * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($swap = null) { @@ -1053,7 +1484,7 @@ public function prune($swap = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SwapTableMap::DATABASE_NAME); @@ -1078,12 +1509,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SwapTableMap::DATABASE_NAME); @@ -1113,64 +1544,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(SwapTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(SwapTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(SwapTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(SwapTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(SwapTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(SwapTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(SwapTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(SwapTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(SwapTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(SwapTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildSwapQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(SwapTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(SwapTableMap::COL_CREATED); + + return $this; } -} // SwapQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/User.php b/generated-classes/TechWilk/Rota/Base/User.php index 14016135..6d9c0695 100644 --- a/generated-classes/TechWilk/Rota/Base/User.php +++ b/generated-classes/TechWilk/Rota/Base/User.php @@ -63,19 +63,21 @@ abstract class User implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\UserTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\UserTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -84,14 +86,14 @@ abstract class User implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -143,7 +145,7 @@ abstract class User implements ActiveRecordInterface /** * The value for the email field. * - * @var \TechWilk\Rota\EmailAddress + * @var \TechWilk\Rota\EmailAddress|null */ protected $email; @@ -190,87 +192,97 @@ abstract class User implements ActiveRecordInterface /** * The value for the lastlogin field. * - * @var DateTime + * @var DateTime|null */ protected $lastlogin; /** * The value for the passwordchanged field. * - * @var DateTime + * @var DateTime|null */ protected $passwordchanged; /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; /** * @var ObjectCollection|ChildCalendarToken[] Collection to store aggregation of ChildCalendarToken objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildCalendarToken objects. */ protected $collCalendarTokens; protected $collCalendarTokensPartial; /** * @var ObjectCollection|ChildComment[] Collection to store aggregation of ChildComment objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildComment objects. */ protected $collComments; protected $collCommentsPartial; /** * @var ObjectCollection|ChildEvent[] Collection to store aggregation of ChildEvent objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEvent objects. */ protected $collEvents; protected $collEventsPartial; /** * @var ObjectCollection|ChildAvailability[] Collection to store aggregation of ChildAvailability objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildAvailability objects. */ protected $collAvailabilities; protected $collAvailabilitiesPartial; /** * @var ObjectCollection|ChildNotification[] Collection to store aggregation of ChildNotification objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildNotification objects. */ protected $collNotifications; protected $collNotificationsPartial; /** * @var ObjectCollection|ChildSocialAuth[] Collection to store aggregation of ChildSocialAuth objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildSocialAuth objects. */ protected $collSocialAuths; protected $collSocialAuthsPartial; /** * @var ObjectCollection|ChildStatistic[] Collection to store aggregation of ChildStatistic objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildStatistic objects. */ protected $collStatistics; protected $collStatisticsPartial; /** * @var ObjectCollection|ChildSwap[] Collection to store aggregation of ChildSwap objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildSwap objects. */ protected $collSwaps; protected $collSwapsPartial; /** * @var ObjectCollection|ChildUserRole[] Collection to store aggregation of ChildUserRole objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildUserRole objects. */ protected $collUserRoles; protected $collUserRolesPartial; /** * @var ObjectCollection|ChildUserPermission[] Collection to store aggregation of ChildUserPermission objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildUserPermission objects. */ protected $collUserPermissions; protected $collUserPermissionsPartial; @@ -279,67 +291,77 @@ abstract class User implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildCalendarToken[] + * @phpstan-var ObjectCollection&\Traversable */ protected $calendarTokensScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildComment[] + * @phpstan-var ObjectCollection&\Traversable */ protected $commentsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEvent[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildAvailability[] + * @phpstan-var ObjectCollection&\Traversable */ protected $availabilitiesScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildNotification[] + * @phpstan-var ObjectCollection&\Traversable */ protected $notificationsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildSocialAuth[] + * @phpstan-var ObjectCollection&\Traversable */ protected $socialAuthsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildStatistic[] + * @phpstan-var ObjectCollection&\Traversable */ protected $statisticsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildSwap[] + * @phpstan-var ObjectCollection&\Traversable */ protected $swapsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildUserRole[] + * @phpstan-var ObjectCollection&\Traversable */ protected $userRolesScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildUserPermission[] + * @phpstan-var ObjectCollection&\Traversable */ protected $userPermissionsScheduledForDeletion = null; @@ -349,7 +371,7 @@ abstract class User implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->firstname = ''; $this->lastname = ''; @@ -375,9 +397,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -385,10 +407,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -397,7 +419,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -407,9 +429,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -418,45 +440,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -465,10 +485,10 @@ public function resetModified($col = null) * obj is an instance of User, delegates to * equals(User). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -490,7 +510,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -498,10 +518,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -509,15 +529,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -526,12 +546,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|User The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -541,13 +561,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -558,24 +578,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -583,7 +606,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -653,7 +676,7 @@ public function getIsAdmin() /** * Get the [email] column value. * - * @return \TechWilk\Rota\EmailAddress + * @return \TechWilk\Rota\EmailAddress|null */ public function getEmail() { @@ -724,12 +747,14 @@ public function getIsEventEditor() * Get the [optionally formatted] temporal [lastlogin] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getLastLogin($format = null) { @@ -744,12 +769,14 @@ public function getLastLogin($format = null) * Get the [optionally formatted] temporal [passwordchanged] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getPasswordChanged($format = null) { @@ -764,12 +791,14 @@ public function getPasswordChanged($format = null) * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. + * + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -784,12 +813,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -803,8 +834,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -818,13 +849,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [firstname] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setFirstName($v) { @@ -838,13 +869,13 @@ public function setFirstName($v) } return $this; - } // setFirstName() + } /** * Set the value of [lastname] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setLastName($v) { @@ -858,13 +889,13 @@ public function setLastName($v) } return $this; - } // setLastName() + } /** * Set the value of [username] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setUsername($v) { @@ -878,13 +909,13 @@ public function setUsername($v) } return $this; - } // setUsername() + } /** * Set the value of [password] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setPassword($v) { @@ -898,13 +929,13 @@ public function setPassword($v) } return $this; - } // setPassword() + } /** * Set the value of [isadmin] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setIsAdmin($v) { @@ -918,13 +949,13 @@ public function setIsAdmin($v) } return $this; - } // setIsAdmin() + } /** * Set the value of [email] column. * - * @param \TechWilk\Rota\EmailAddress $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param \TechWilk\Rota\EmailAddress|null $v New value + * @return $this The current object (for fluent API support) */ public function setEmail($v) { @@ -934,13 +965,13 @@ public function setEmail($v) } return $this; - } // setEmail() + } /** * Set the value of [mobile] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setMobile($v) { @@ -954,13 +985,13 @@ public function setMobile($v) } return $this; - } // setMobile() + } /** * Set the value of [isoverviewrecipient] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setIsOverviewRecipient($v) { @@ -974,7 +1005,7 @@ public function setIsOverviewRecipient($v) } return $this; - } // setIsOverviewRecipient() + } /** * Sets the value of the [recievereminderemails] column. @@ -983,8 +1014,8 @@ public function setIsOverviewRecipient($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setRecieveReminderEmails($v) { @@ -1002,13 +1033,13 @@ public function setRecieveReminderEmails($v) } return $this; - } // setRecieveReminderEmails() + } /** * Set the value of [isbandadmin] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setIsBandAdmin($v) { @@ -1022,13 +1053,13 @@ public function setIsBandAdmin($v) } return $this; - } // setIsBandAdmin() + } /** * Set the value of [iseventeditor] column. * - * @param string $v new value - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param string $v New value + * @return $this The current object (for fluent API support) */ public function setIsEventEditor($v) { @@ -1042,14 +1073,14 @@ public function setIsEventEditor($v) } return $this; - } // setIsEventEditor() + } /** * Sets the value of [lastlogin] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setLastLogin($v) { @@ -1062,14 +1093,14 @@ public function setLastLogin($v) } // if either are not null return $this; - } // setLastLogin() + } /** * Sets the value of [passwordchanged] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setPasswordChanged($v) { @@ -1082,14 +1113,14 @@ public function setPasswordChanged($v) } // if either are not null return $this; - } // setPasswordChanged() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -1102,14 +1133,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -1122,7 +1153,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -1130,53 +1161,53 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->firstname !== '') { - return false; - } + if ($this->firstname !== '') { + return false; + } - if ($this->lastname !== '') { - return false; - } + if ($this->lastname !== '') { + return false; + } - if ($this->username !== '') { - return false; - } + if ($this->username !== '') { + return false; + } - if ($this->password !== '') { - return false; - } + if ($this->password !== '') { + return false; + } - if ($this->isadmin !== '0') { - return false; - } + if ($this->isadmin !== '0') { + return false; + } - if ($this->mobile !== '') { - return false; - } + if ($this->mobile !== '') { + return false; + } - if ($this->isoverviewrecipient !== '0') { - return false; - } + if ($this->isoverviewrecipient !== '0') { + return false; + } - if ($this->recievereminderemails !== true) { - return false; - } + if ($this->recievereminderemails !== true) { + return false; + } - if ($this->isbandadmin !== '0') { - return false; - } + if ($this->isbandadmin !== '0') { + return false; + } - if ($this->iseventeditor !== '0') { - return false; - } + if ($this->iseventeditor !== '0') { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -1186,19 +1217,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : UserTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -1258,8 +1290,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -1267,6 +1299,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 16; // 16 = UserTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\User'), 0, $e); } @@ -1283,23 +1316,24 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -1345,19 +1379,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->collUserRoles = null; $this->collUserPermissions = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see User::setDeleted() * @see User::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -1387,12 +1422,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -1412,12 +1447,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(UserTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(UserTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -1449,12 +1485,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -1643,22 +1679,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[UserTableMap::COL_ID] = true; @@ -1725,51 +1762,67 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'firstName': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); + break; case 'lastName': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); + break; case 'username': $stmt->bindValue($identifier, $this->username, PDO::PARAM_STR); + break; case 'password': $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR); + break; case 'isAdmin': $stmt->bindValue($identifier, $this->isadmin, PDO::PARAM_STR); + break; case 'email': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); + break; case 'mobile': $stmt->bindValue($identifier, $this->mobile, PDO::PARAM_STR); + break; case 'isOverviewRecipient': $stmt->bindValue($identifier, $this->isoverviewrecipient, PDO::PARAM_STR); + break; case 'recieveReminderEmails': $stmt->bindValue($identifier, (int) $this->recievereminderemails, PDO::PARAM_INT); + break; case 'isBandAdmin': $stmt->bindValue($identifier, $this->isbandadmin, PDO::PARAM_STR); + break; case 'isEventEditor': $stmt->bindValue($identifier, $this->iseventeditor, PDO::PARAM_STR); + break; case 'lastLogin': $stmt->bindValue($identifier, $this->lastlogin ? $this->lastlogin->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'passwordChanged': $stmt->bindValue($identifier, $this->passwordchanged ? $this->passwordchanged->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -1794,12 +1847,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -1810,14 +1863,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = UserTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -1829,63 +1882,62 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getFirstName(); - break; + case 2: return $this->getLastName(); - break; + case 3: return $this->getUsername(); - break; + case 4: return $this->getPassword(); - break; + case 5: return $this->getIsAdmin(); - break; + case 6: return $this->getEmail(); - break; + case 7: return $this->getMobile(); - break; + case 8: return $this->getIsOverviewRecipient(); - break; + case 9: return $this->getRecieveReminderEmails(); - break; + case 10: return $this->getIsBandAdmin(); - break; + case 11: return $this->getIsEventEditor(); - break; + case 12: return $this->getLastLogin(); - break; + case 13: return $this->getPasswordChanged(); - break; + case 14: return $this->getCreated(); - break; + case 15: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -1895,23 +1947,23 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['User'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['User'][$this->hashCode()] = true; $keys = UserTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getFirstName(), $keys[2] => $this->getLastName(), @@ -1928,21 +1980,21 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $keys[13] => $this->getPasswordChanged(), $keys[14] => $this->getCreated(), $keys[15] => $this->getUpdated(), - ); + ]; if ($result[$keys[12]] instanceof \DateTimeInterface) { - $result[$keys[12]] = $result[$keys[12]]->format('c'); + $result[$keys[12]] = $result[$keys[12]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[13]] instanceof \DateTimeInterface) { - $result[$keys[13]] = $result[$keys[13]]->format('c'); + $result[$keys[13]] = $result[$keys[13]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[14]] instanceof \DateTimeInterface) { - $result[$keys[14]] = $result[$keys[14]]->format('c'); + $result[$keys[14]] = $result[$keys[14]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[15]] instanceof \DateTimeInterface) { - $result[$keys[15]] = $result[$keys[15]]->format('c'); + $result[$keys[15]] = $result[$keys[15]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1952,6 +2004,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->collCalendarTokens) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'calendarTokens'; @@ -1966,6 +2019,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collCalendarTokens->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collComments) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'comments'; @@ -1980,6 +2034,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collComments->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collEvents) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'events'; @@ -1994,6 +2049,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collEvents->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collAvailabilities) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'availabilities'; @@ -2008,6 +2064,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collAvailabilities->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collNotifications) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'notifications'; @@ -2022,6 +2079,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collNotifications->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collSocialAuths) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'socialAuths'; @@ -2036,6 +2094,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collSocialAuths->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collStatistics) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'statistics'; @@ -2050,6 +2109,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collStatistics->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collSwaps) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'swaps'; @@ -2064,6 +2124,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collSwaps->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collUserRoles) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userRoles'; @@ -2078,6 +2139,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collUserRoles->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collUserPermissions) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'userPermissions'; @@ -2099,30 +2161,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\User + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = UserTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\User + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -2191,11 +2255,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = UserTableMap::getFieldNames($keyType); @@ -2247,6 +2311,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[15], $arr)) { $this->setUpdated($arr[$keys[15]]); } + + return $this; } /** @@ -2266,9 +2332,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\User The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -2282,9 +2348,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(UserTableMap::DATABASE_NAME); @@ -2344,13 +2410,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildUserQuery::create(); $criteria->add(UserTableMap::COL_ID, $this->id); @@ -2362,7 +2428,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -2392,19 +2458,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -2415,12 +2482,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\User (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\User (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setFirstName($this->getFirstName()); $copyObj->setLastName($this->getLastName()); @@ -2502,11 +2570,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addUserPermission($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -2518,11 +2587,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\User Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -2538,48 +2607,48 @@ public function copy($deepCopy = false) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('CalendarToken' == $relationName) { + if ('CalendarToken' === $relationName) { $this->initCalendarTokens(); return; } - if ('Comment' == $relationName) { + if ('Comment' === $relationName) { $this->initComments(); return; } - if ('Event' == $relationName) { + if ('Event' === $relationName) { $this->initEvents(); return; } - if ('Availability' == $relationName) { + if ('Availability' === $relationName) { $this->initAvailabilities(); return; } - if ('Notification' == $relationName) { + if ('Notification' === $relationName) { $this->initNotifications(); return; } - if ('SocialAuth' == $relationName) { + if ('SocialAuth' === $relationName) { $this->initSocialAuths(); return; } - if ('Statistic' == $relationName) { + if ('Statistic' === $relationName) { $this->initStatistics(); return; } - if ('Swap' == $relationName) { + if ('Swap' === $relationName) { $this->initSwaps(); return; } - if ('UserRole' == $relationName) { + if ('UserRole' === $relationName) { $this->initUserRoles(); return; } - if ('UserPermission' == $relationName) { + if ('UserPermission' === $relationName) { $this->initUserPermissions(); return; } @@ -2591,18 +2660,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addCalendarTokens() + * @return $this + * @see addCalendarTokens() */ public function clearCalendarTokens() { $this->collCalendarTokens = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collCalendarTokens collection loaded partially. + * + * @return void */ - public function resetPartialCalendarTokens($v = true) + public function resetPartialCalendarTokens($v = true): void { $this->collCalendarTokensPartial = $v; } @@ -2614,12 +2687,12 @@ public function resetPartialCalendarTokens($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initCalendarTokens($overrideExisting = true) + public function initCalendarTokens(bool $overrideExisting = true): void { if (null !== $this->collCalendarTokens && !$overrideExisting) { return; @@ -2640,18 +2713,28 @@ public function initCalendarTokens($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildCalendarToken[] List of ChildCalendarToken objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildCalendarToken objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getCalendarTokens(Criteria $criteria = null, ConnectionInterface $con = null) + public function getCalendarTokens(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collCalendarTokensPartial && !$this->isNew(); - if (null === $this->collCalendarTokens || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCalendarTokens) { + if (null === $this->collCalendarTokens || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initCalendarTokens(); + if (null === $this->collCalendarTokens) { + $this->initCalendarTokens(); + } else { + $collectionClassName = CalendarTokenTableMap::getTableMap()->getCollectionClassName(); + + $collCalendarTokens = new $collectionClassName; + $collCalendarTokens->setModel('\TechWilk\Rota\CalendarToken'); + + return $collCalendarTokens; + } } else { $collCalendarTokens = ChildCalendarTokenQuery::create(null, $criteria) ->filterByUser($this) @@ -2695,11 +2778,11 @@ public function getCalendarTokens(Criteria $criteria = null, ConnectionInterface * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $calendarTokens A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $calendarTokens A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setCalendarTokens(Collection $calendarTokens, ConnectionInterface $con = null) + public function setCalendarTokens(Collection $calendarTokens, ?ConnectionInterface $con = null) { /** @var ChildCalendarToken[] $calendarTokensToDelete */ $calendarTokensToDelete = $this->getCalendarTokens(new Criteria(), $con)->diff($calendarTokens); @@ -2725,13 +2808,13 @@ public function setCalendarTokens(Collection $calendarTokens, ConnectionInterfac /** * Returns the number of related CalendarToken objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related CalendarToken objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related CalendarToken objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countCalendarTokens(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countCalendarTokens(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collCalendarTokensPartial && !$this->isNew(); if (null === $this->collCalendarTokens || null !== $criteria || $partial) { @@ -2760,8 +2843,8 @@ public function countCalendarTokens(Criteria $criteria = null, $distinct = false * Method called to associate a ChildCalendarToken object to this object * through the ChildCalendarToken foreign key attribute. * - * @param ChildCalendarToken $l ChildCalendarToken - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildCalendarToken $l ChildCalendarToken + * @return $this The current object (for fluent API support) */ public function addCalendarToken(ChildCalendarToken $l) { @@ -2784,15 +2867,15 @@ public function addCalendarToken(ChildCalendarToken $l) /** * @param ChildCalendarToken $calendarToken The ChildCalendarToken object to add. */ - protected function doAddCalendarToken(ChildCalendarToken $calendarToken) + protected function doAddCalendarToken(ChildCalendarToken $calendarToken): void { $this->collCalendarTokens[]= $calendarToken; $calendarToken->setUser($this); } /** - * @param ChildCalendarToken $calendarToken The ChildCalendarToken object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildCalendarToken $calendarToken The ChildCalendarToken object to remove. + * @return $this The current object (for fluent API support) */ public function removeCalendarToken(ChildCalendarToken $calendarToken) { @@ -2816,18 +2899,22 @@ public function removeCalendarToken(ChildCalendarToken $calendarToken) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addComments() + * @return $this + * @see addComments() */ public function clearComments() { $this->collComments = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collComments collection loaded partially. + * + * @return void */ - public function resetPartialComments($v = true) + public function resetPartialComments($v = true): void { $this->collCommentsPartial = $v; } @@ -2839,12 +2926,12 @@ public function resetPartialComments($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initComments($overrideExisting = true) + public function initComments(bool $overrideExisting = true): void { if (null !== $this->collComments && !$overrideExisting) { return; @@ -2865,18 +2952,28 @@ public function initComments($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildComment[] List of ChildComment objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildComment objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getComments(Criteria $criteria = null, ConnectionInterface $con = null) + public function getComments(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collCommentsPartial && !$this->isNew(); - if (null === $this->collComments || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collComments) { + if (null === $this->collComments || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initComments(); + if (null === $this->collComments) { + $this->initComments(); + } else { + $collectionClassName = CommentTableMap::getTableMap()->getCollectionClassName(); + + $collComments = new $collectionClassName; + $collComments->setModel('\TechWilk\Rota\Comment'); + + return $collComments; + } } else { $collComments = ChildCommentQuery::create(null, $criteria) ->filterByUser($this) @@ -2920,11 +3017,11 @@ public function getComments(Criteria $criteria = null, ConnectionInterface $con * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $comments A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $comments A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setComments(Collection $comments, ConnectionInterface $con = null) + public function setComments(Collection $comments, ?ConnectionInterface $con = null) { /** @var ChildComment[] $commentsToDelete */ $commentsToDelete = $this->getComments(new Criteria(), $con)->diff($comments); @@ -2950,13 +3047,13 @@ public function setComments(Collection $comments, ConnectionInterface $con = nul /** * Returns the number of related Comment objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Comment objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Comment objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countComments(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countComments(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collCommentsPartial && !$this->isNew(); if (null === $this->collComments || null !== $criteria || $partial) { @@ -2985,8 +3082,8 @@ public function countComments(Criteria $criteria = null, $distinct = false, Conn * Method called to associate a ChildComment object to this object * through the ChildComment foreign key attribute. * - * @param ChildComment $l ChildComment - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildComment $l ChildComment + * @return $this The current object (for fluent API support) */ public function addComment(ChildComment $l) { @@ -3009,15 +3106,15 @@ public function addComment(ChildComment $l) /** * @param ChildComment $comment The ChildComment object to add. */ - protected function doAddComment(ChildComment $comment) + protected function doAddComment(ChildComment $comment): void { $this->collComments[]= $comment; $comment->setUser($this); } /** - * @param ChildComment $comment The ChildComment object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildComment $comment The ChildComment object to remove. + * @return $this The current object (for fluent API support) */ public function removeComment(ChildComment $comment) { @@ -3047,12 +3144,13 @@ public function removeComment(ChildComment $comment) * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildComment[] List of ChildComment objects + * @phpstan-return ObjectCollection&\Traversable List of ChildComment objects */ - public function getCommentsJoinEvent(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getCommentsJoinEvent(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildCommentQuery::create(null, $criteria); $query->joinWith('Event', $joinBehavior); @@ -3066,18 +3164,22 @@ public function getCommentsJoinEvent(Criteria $criteria = null, ConnectionInterf * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEvents() + * @return $this + * @see addEvents() */ public function clearEvents() { $this->collEvents = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEvents collection loaded partially. + * + * @return void */ - public function resetPartialEvents($v = true) + public function resetPartialEvents($v = true): void { $this->collEventsPartial = $v; } @@ -3089,12 +3191,12 @@ public function resetPartialEvents($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEvents($overrideExisting = true) + public function initEvents(bool $overrideExisting = true): void { if (null !== $this->collEvents && !$overrideExisting) { return; @@ -3115,18 +3217,28 @@ public function initEvents($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEvent[] List of ChildEvent objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEvents(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEvents(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventsPartial && !$this->isNew(); - if (null === $this->collEvents || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEvents) { + if (null === $this->collEvents || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEvents(); + if (null === $this->collEvents) { + $this->initEvents(); + } else { + $collectionClassName = EventTableMap::getTableMap()->getCollectionClassName(); + + $collEvents = new $collectionClassName; + $collEvents->setModel('\TechWilk\Rota\Event'); + + return $collEvents; + } } else { $collEvents = ChildEventQuery::create(null, $criteria) ->filterByUser($this) @@ -3170,11 +3282,11 @@ public function getEvents(Criteria $criteria = null, ConnectionInterface $con = * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $events A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $events A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEvents(Collection $events, ConnectionInterface $con = null) + public function setEvents(Collection $events, ?ConnectionInterface $con = null) { /** @var ChildEvent[] $eventsToDelete */ $eventsToDelete = $this->getEvents(new Criteria(), $con)->diff($events); @@ -3200,13 +3312,13 @@ public function setEvents(Collection $events, ConnectionInterface $con = null) /** * Returns the number of related Event objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Event objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Event objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEvents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEvents(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventsPartial && !$this->isNew(); if (null === $this->collEvents || null !== $criteria || $partial) { @@ -3235,8 +3347,8 @@ public function countEvents(Criteria $criteria = null, $distinct = false, Connec * Method called to associate a ChildEvent object to this object * through the ChildEvent foreign key attribute. * - * @param ChildEvent $l ChildEvent - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildEvent $l ChildEvent + * @return $this The current object (for fluent API support) */ public function addEvent(ChildEvent $l) { @@ -3259,15 +3371,15 @@ public function addEvent(ChildEvent $l) /** * @param ChildEvent $event The ChildEvent object to add. */ - protected function doAddEvent(ChildEvent $event) + protected function doAddEvent(ChildEvent $event): void { $this->collEvents[]= $event; $event->setUser($this); } /** - * @param ChildEvent $event The ChildEvent object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildEvent $event The ChildEvent object to remove. + * @return $this The current object (for fluent API support) */ public function removeEvent(ChildEvent $event) { @@ -3297,12 +3409,13 @@ public function removeEvent(ChildEvent $event) * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventType', $joinBehavior); @@ -3322,12 +3435,13 @@ public function getEventsJoinEventType(Criteria $criteria = null, ConnectionInte * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventSubType(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventSubType', $joinBehavior); @@ -3347,12 +3461,13 @@ public function getEventsJoinEventSubType(Criteria $criteria = null, ConnectionI * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinLocation(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('Location', $joinBehavior); @@ -3372,12 +3487,13 @@ public function getEventsJoinLocation(Criteria $criteria = null, ConnectionInter * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEvent[] List of ChildEvent objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEvent objects */ - public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventsJoinEventGroup(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventQuery::create(null, $criteria); $query->joinWith('EventGroup', $joinBehavior); @@ -3391,18 +3507,22 @@ public function getEventsJoinEventGroup(Criteria $criteria = null, ConnectionInt * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addAvailabilities() + * @return $this + * @see addAvailabilities() */ public function clearAvailabilities() { $this->collAvailabilities = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collAvailabilities collection loaded partially. + * + * @return void */ - public function resetPartialAvailabilities($v = true) + public function resetPartialAvailabilities($v = true): void { $this->collAvailabilitiesPartial = $v; } @@ -3414,12 +3534,12 @@ public function resetPartialAvailabilities($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initAvailabilities($overrideExisting = true) + public function initAvailabilities(bool $overrideExisting = true): void { if (null !== $this->collAvailabilities && !$overrideExisting) { return; @@ -3440,18 +3560,28 @@ public function initAvailabilities($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildAvailability[] List of ChildAvailability objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildAvailability objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getAvailabilities(Criteria $criteria = null, ConnectionInterface $con = null) + public function getAvailabilities(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collAvailabilitiesPartial && !$this->isNew(); - if (null === $this->collAvailabilities || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collAvailabilities) { + if (null === $this->collAvailabilities || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initAvailabilities(); + if (null === $this->collAvailabilities) { + $this->initAvailabilities(); + } else { + $collectionClassName = AvailabilityTableMap::getTableMap()->getCollectionClassName(); + + $collAvailabilities = new $collectionClassName; + $collAvailabilities->setModel('\TechWilk\Rota\Availability'); + + return $collAvailabilities; + } } else { $collAvailabilities = ChildAvailabilityQuery::create(null, $criteria) ->filterByUser($this) @@ -3495,11 +3625,11 @@ public function getAvailabilities(Criteria $criteria = null, ConnectionInterface * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $availabilities A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $availabilities A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setAvailabilities(Collection $availabilities, ConnectionInterface $con = null) + public function setAvailabilities(Collection $availabilities, ?ConnectionInterface $con = null) { /** @var ChildAvailability[] $availabilitiesToDelete */ $availabilitiesToDelete = $this->getAvailabilities(new Criteria(), $con)->diff($availabilities); @@ -3525,13 +3655,13 @@ public function setAvailabilities(Collection $availabilities, ConnectionInterfac /** * Returns the number of related Availability objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Availability objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Availability objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countAvailabilities(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countAvailabilities(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collAvailabilitiesPartial && !$this->isNew(); if (null === $this->collAvailabilities || null !== $criteria || $partial) { @@ -3560,8 +3690,8 @@ public function countAvailabilities(Criteria $criteria = null, $distinct = false * Method called to associate a ChildAvailability object to this object * through the ChildAvailability foreign key attribute. * - * @param ChildAvailability $l ChildAvailability - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildAvailability $l ChildAvailability + * @return $this The current object (for fluent API support) */ public function addAvailability(ChildAvailability $l) { @@ -3584,15 +3714,15 @@ public function addAvailability(ChildAvailability $l) /** * @param ChildAvailability $availability The ChildAvailability object to add. */ - protected function doAddAvailability(ChildAvailability $availability) + protected function doAddAvailability(ChildAvailability $availability): void { $this->collAvailabilities[]= $availability; $availability->setUser($this); } /** - * @param ChildAvailability $availability The ChildAvailability object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildAvailability $availability The ChildAvailability object to remove. + * @return $this The current object (for fluent API support) */ public function removeAvailability(ChildAvailability $availability) { @@ -3622,12 +3752,13 @@ public function removeAvailability(ChildAvailability $availability) * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildAvailability[] List of ChildAvailability objects + * @phpstan-return ObjectCollection&\Traversable List of ChildAvailability objects */ - public function getAvailabilitiesJoinEvent(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getAvailabilitiesJoinEvent(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildAvailabilityQuery::create(null, $criteria); $query->joinWith('Event', $joinBehavior); @@ -3641,18 +3772,22 @@ public function getAvailabilitiesJoinEvent(Criteria $criteria = null, Connection * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addNotifications() + * @return $this + * @see addNotifications() */ public function clearNotifications() { $this->collNotifications = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collNotifications collection loaded partially. + * + * @return void */ - public function resetPartialNotifications($v = true) + public function resetPartialNotifications($v = true): void { $this->collNotificationsPartial = $v; } @@ -3664,12 +3799,12 @@ public function resetPartialNotifications($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initNotifications($overrideExisting = true) + public function initNotifications(bool $overrideExisting = true): void { if (null !== $this->collNotifications && !$overrideExisting) { return; @@ -3690,18 +3825,28 @@ public function initNotifications($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildNotification[] List of ChildNotification objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildNotification objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getNotifications(Criteria $criteria = null, ConnectionInterface $con = null) + public function getNotifications(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collNotificationsPartial && !$this->isNew(); - if (null === $this->collNotifications || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collNotifications) { + if (null === $this->collNotifications || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initNotifications(); + if (null === $this->collNotifications) { + $this->initNotifications(); + } else { + $collectionClassName = NotificationTableMap::getTableMap()->getCollectionClassName(); + + $collNotifications = new $collectionClassName; + $collNotifications->setModel('\TechWilk\Rota\Notification'); + + return $collNotifications; + } } else { $collNotifications = ChildNotificationQuery::create(null, $criteria) ->filterByUser($this) @@ -3745,11 +3890,11 @@ public function getNotifications(Criteria $criteria = null, ConnectionInterface * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $notifications A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $notifications A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setNotifications(Collection $notifications, ConnectionInterface $con = null) + public function setNotifications(Collection $notifications, ?ConnectionInterface $con = null) { /** @var ChildNotification[] $notificationsToDelete */ $notificationsToDelete = $this->getNotifications(new Criteria(), $con)->diff($notifications); @@ -3775,13 +3920,13 @@ public function setNotifications(Collection $notifications, ConnectionInterface /** * Returns the number of related Notification objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Notification objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Notification objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countNotifications(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countNotifications(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collNotificationsPartial && !$this->isNew(); if (null === $this->collNotifications || null !== $criteria || $partial) { @@ -3810,8 +3955,8 @@ public function countNotifications(Criteria $criteria = null, $distinct = false, * Method called to associate a ChildNotification object to this object * through the ChildNotification foreign key attribute. * - * @param ChildNotification $l ChildNotification - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildNotification $l ChildNotification + * @return $this The current object (for fluent API support) */ public function addNotification(ChildNotification $l) { @@ -3834,15 +3979,15 @@ public function addNotification(ChildNotification $l) /** * @param ChildNotification $notification The ChildNotification object to add. */ - protected function doAddNotification(ChildNotification $notification) + protected function doAddNotification(ChildNotification $notification): void { $this->collNotifications[]= $notification; $notification->setUser($this); } /** - * @param ChildNotification $notification The ChildNotification object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildNotification $notification The ChildNotification object to remove. + * @return $this The current object (for fluent API support) */ public function removeNotification(ChildNotification $notification) { @@ -3866,18 +4011,22 @@ public function removeNotification(ChildNotification $notification) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addSocialAuths() + * @return $this + * @see addSocialAuths() */ public function clearSocialAuths() { $this->collSocialAuths = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collSocialAuths collection loaded partially. + * + * @return void */ - public function resetPartialSocialAuths($v = true) + public function resetPartialSocialAuths($v = true): void { $this->collSocialAuthsPartial = $v; } @@ -3889,12 +4038,12 @@ public function resetPartialSocialAuths($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initSocialAuths($overrideExisting = true) + public function initSocialAuths(bool $overrideExisting = true): void { if (null !== $this->collSocialAuths && !$overrideExisting) { return; @@ -3915,18 +4064,28 @@ public function initSocialAuths($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildSocialAuth[] List of ChildSocialAuth objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildSocialAuth objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getSocialAuths(Criteria $criteria = null, ConnectionInterface $con = null) + public function getSocialAuths(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collSocialAuthsPartial && !$this->isNew(); - if (null === $this->collSocialAuths || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collSocialAuths) { + if (null === $this->collSocialAuths || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initSocialAuths(); + if (null === $this->collSocialAuths) { + $this->initSocialAuths(); + } else { + $collectionClassName = SocialAuthTableMap::getTableMap()->getCollectionClassName(); + + $collSocialAuths = new $collectionClassName; + $collSocialAuths->setModel('\TechWilk\Rota\SocialAuth'); + + return $collSocialAuths; + } } else { $collSocialAuths = ChildSocialAuthQuery::create(null, $criteria) ->filterByUser($this) @@ -3970,11 +4129,11 @@ public function getSocialAuths(Criteria $criteria = null, ConnectionInterface $c * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $socialAuths A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $socialAuths A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setSocialAuths(Collection $socialAuths, ConnectionInterface $con = null) + public function setSocialAuths(Collection $socialAuths, ?ConnectionInterface $con = null) { /** @var ChildSocialAuth[] $socialAuthsToDelete */ $socialAuthsToDelete = $this->getSocialAuths(new Criteria(), $con)->diff($socialAuths); @@ -4003,13 +4162,13 @@ public function setSocialAuths(Collection $socialAuths, ConnectionInterface $con /** * Returns the number of related SocialAuth objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related SocialAuth objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related SocialAuth objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countSocialAuths(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countSocialAuths(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collSocialAuthsPartial && !$this->isNew(); if (null === $this->collSocialAuths || null !== $criteria || $partial) { @@ -4038,8 +4197,8 @@ public function countSocialAuths(Criteria $criteria = null, $distinct = false, C * Method called to associate a ChildSocialAuth object to this object * through the ChildSocialAuth foreign key attribute. * - * @param ChildSocialAuth $l ChildSocialAuth - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildSocialAuth $l ChildSocialAuth + * @return $this The current object (for fluent API support) */ public function addSocialAuth(ChildSocialAuth $l) { @@ -4062,15 +4221,15 @@ public function addSocialAuth(ChildSocialAuth $l) /** * @param ChildSocialAuth $socialAuth The ChildSocialAuth object to add. */ - protected function doAddSocialAuth(ChildSocialAuth $socialAuth) + protected function doAddSocialAuth(ChildSocialAuth $socialAuth): void { $this->collSocialAuths[]= $socialAuth; $socialAuth->setUser($this); } /** - * @param ChildSocialAuth $socialAuth The ChildSocialAuth object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildSocialAuth $socialAuth The ChildSocialAuth object to remove. + * @return $this The current object (for fluent API support) */ public function removeSocialAuth(ChildSocialAuth $socialAuth) { @@ -4094,18 +4253,22 @@ public function removeSocialAuth(ChildSocialAuth $socialAuth) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addStatistics() + * @return $this + * @see addStatistics() */ public function clearStatistics() { $this->collStatistics = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collStatistics collection loaded partially. + * + * @return void */ - public function resetPartialStatistics($v = true) + public function resetPartialStatistics($v = true): void { $this->collStatisticsPartial = $v; } @@ -4117,12 +4280,12 @@ public function resetPartialStatistics($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initStatistics($overrideExisting = true) + public function initStatistics(bool $overrideExisting = true): void { if (null !== $this->collStatistics && !$overrideExisting) { return; @@ -4143,18 +4306,28 @@ public function initStatistics($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildStatistic[] List of ChildStatistic objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildStatistic objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getStatistics(Criteria $criteria = null, ConnectionInterface $con = null) + public function getStatistics(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collStatisticsPartial && !$this->isNew(); - if (null === $this->collStatistics || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collStatistics) { + if (null === $this->collStatistics || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initStatistics(); + if (null === $this->collStatistics) { + $this->initStatistics(); + } else { + $collectionClassName = StatisticTableMap::getTableMap()->getCollectionClassName(); + + $collStatistics = new $collectionClassName; + $collStatistics->setModel('\TechWilk\Rota\Statistic'); + + return $collStatistics; + } } else { $collStatistics = ChildStatisticQuery::create(null, $criteria) ->filterByUser($this) @@ -4198,11 +4371,11 @@ public function getStatistics(Criteria $criteria = null, ConnectionInterface $co * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $statistics A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $statistics A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setStatistics(Collection $statistics, ConnectionInterface $con = null) + public function setStatistics(Collection $statistics, ?ConnectionInterface $con = null) { /** @var ChildStatistic[] $statisticsToDelete */ $statisticsToDelete = $this->getStatistics(new Criteria(), $con)->diff($statistics); @@ -4228,13 +4401,13 @@ public function setStatistics(Collection $statistics, ConnectionInterface $con = /** * Returns the number of related Statistic objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Statistic objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Statistic objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countStatistics(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countStatistics(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collStatisticsPartial && !$this->isNew(); if (null === $this->collStatistics || null !== $criteria || $partial) { @@ -4263,8 +4436,8 @@ public function countStatistics(Criteria $criteria = null, $distinct = false, Co * Method called to associate a ChildStatistic object to this object * through the ChildStatistic foreign key attribute. * - * @param ChildStatistic $l ChildStatistic - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildStatistic $l ChildStatistic + * @return $this The current object (for fluent API support) */ public function addStatistic(ChildStatistic $l) { @@ -4287,15 +4460,15 @@ public function addStatistic(ChildStatistic $l) /** * @param ChildStatistic $statistic The ChildStatistic object to add. */ - protected function doAddStatistic(ChildStatistic $statistic) + protected function doAddStatistic(ChildStatistic $statistic): void { $this->collStatistics[]= $statistic; $statistic->setUser($this); } /** - * @param ChildStatistic $statistic The ChildStatistic object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildStatistic $statistic The ChildStatistic object to remove. + * @return $this The current object (for fluent API support) */ public function removeStatistic(ChildStatistic $statistic) { @@ -4319,18 +4492,22 @@ public function removeStatistic(ChildStatistic $statistic) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addSwaps() + * @return $this + * @see addSwaps() */ public function clearSwaps() { $this->collSwaps = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collSwaps collection loaded partially. + * + * @return void */ - public function resetPartialSwaps($v = true) + public function resetPartialSwaps($v = true): void { $this->collSwapsPartial = $v; } @@ -4342,12 +4519,12 @@ public function resetPartialSwaps($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initSwaps($overrideExisting = true) + public function initSwaps(bool $overrideExisting = true): void { if (null !== $this->collSwaps && !$overrideExisting) { return; @@ -4368,18 +4545,28 @@ public function initSwaps($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildSwap[] List of ChildSwap objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getSwaps(Criteria $criteria = null, ConnectionInterface $con = null) + public function getSwaps(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collSwapsPartial && !$this->isNew(); - if (null === $this->collSwaps || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collSwaps) { + if (null === $this->collSwaps || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initSwaps(); + if (null === $this->collSwaps) { + $this->initSwaps(); + } else { + $collectionClassName = SwapTableMap::getTableMap()->getCollectionClassName(); + + $collSwaps = new $collectionClassName; + $collSwaps->setModel('\TechWilk\Rota\Swap'); + + return $collSwaps; + } } else { $collSwaps = ChildSwapQuery::create(null, $criteria) ->filterByUser($this) @@ -4423,11 +4610,11 @@ public function getSwaps(Criteria $criteria = null, ConnectionInterface $con = n * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $swaps A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $swaps A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setSwaps(Collection $swaps, ConnectionInterface $con = null) + public function setSwaps(Collection $swaps, ?ConnectionInterface $con = null) { /** @var ChildSwap[] $swapsToDelete */ $swapsToDelete = $this->getSwaps(new Criteria(), $con)->diff($swaps); @@ -4453,13 +4640,13 @@ public function setSwaps(Collection $swaps, ConnectionInterface $con = null) /** * Returns the number of related Swap objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Swap objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Swap objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countSwaps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countSwaps(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collSwapsPartial && !$this->isNew(); if (null === $this->collSwaps || null !== $criteria || $partial) { @@ -4488,8 +4675,8 @@ public function countSwaps(Criteria $criteria = null, $distinct = false, Connect * Method called to associate a ChildSwap object to this object * through the ChildSwap foreign key attribute. * - * @param ChildSwap $l ChildSwap - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildSwap $l ChildSwap + * @return $this The current object (for fluent API support) */ public function addSwap(ChildSwap $l) { @@ -4512,15 +4699,15 @@ public function addSwap(ChildSwap $l) /** * @param ChildSwap $swap The ChildSwap object to add. */ - protected function doAddSwap(ChildSwap $swap) + protected function doAddSwap(ChildSwap $swap): void { $this->collSwaps[]= $swap; $swap->setUser($this); } /** - * @param ChildSwap $swap The ChildSwap object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildSwap $swap The ChildSwap object to remove. + * @return $this The current object (for fluent API support) */ public function removeSwap(ChildSwap $swap) { @@ -4550,12 +4737,13 @@ public function removeSwap(ChildSwap $swap) * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsJoinEventPerson(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsJoinEventPerson(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('EventPerson', $joinBehavior); @@ -4575,12 +4763,13 @@ public function getSwapsJoinEventPerson(Criteria $criteria = null, ConnectionInt * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsJoinOldUserRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsJoinOldUserRole(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('OldUserRole', $joinBehavior); @@ -4600,12 +4789,13 @@ public function getSwapsJoinOldUserRole(Criteria $criteria = null, ConnectionInt * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsJoinNewUserRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsJoinNewUserRole(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('NewUserRole', $joinBehavior); @@ -4619,18 +4809,22 @@ public function getSwapsJoinNewUserRole(Criteria $criteria = null, ConnectionInt * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addUserRoles() + * @return $this + * @see addUserRoles() */ public function clearUserRoles() { $this->collUserRoles = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collUserRoles collection loaded partially. + * + * @return void */ - public function resetPartialUserRoles($v = true) + public function resetPartialUserRoles($v = true): void { $this->collUserRolesPartial = $v; } @@ -4642,12 +4836,12 @@ public function resetPartialUserRoles($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initUserRoles($overrideExisting = true) + public function initUserRoles(bool $overrideExisting = true): void { if (null !== $this->collUserRoles && !$overrideExisting) { return; @@ -4668,18 +4862,28 @@ public function initUserRoles($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildUserRole[] List of ChildUserRole objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildUserRole objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUserRoles(Criteria $criteria = null, ConnectionInterface $con = null) + public function getUserRoles(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collUserRolesPartial && !$this->isNew(); - if (null === $this->collUserRoles || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collUserRoles) { + if (null === $this->collUserRoles || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initUserRoles(); + if (null === $this->collUserRoles) { + $this->initUserRoles(); + } else { + $collectionClassName = UserRoleTableMap::getTableMap()->getCollectionClassName(); + + $collUserRoles = new $collectionClassName; + $collUserRoles->setModel('\TechWilk\Rota\UserRole'); + + return $collUserRoles; + } } else { $collUserRoles = ChildUserRoleQuery::create(null, $criteria) ->filterByUser($this) @@ -4723,11 +4927,11 @@ public function getUserRoles(Criteria $criteria = null, ConnectionInterface $con * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $userRoles A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $userRoles A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setUserRoles(Collection $userRoles, ConnectionInterface $con = null) + public function setUserRoles(Collection $userRoles, ?ConnectionInterface $con = null) { /** @var ChildUserRole[] $userRolesToDelete */ $userRolesToDelete = $this->getUserRoles(new Criteria(), $con)->diff($userRoles); @@ -4753,13 +4957,13 @@ public function setUserRoles(Collection $userRoles, ConnectionInterface $con = n /** * Returns the number of related UserRole objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related UserRole objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related UserRole objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countUserRoles(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countUserRoles(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collUserRolesPartial && !$this->isNew(); if (null === $this->collUserRoles || null !== $criteria || $partial) { @@ -4788,8 +4992,8 @@ public function countUserRoles(Criteria $criteria = null, $distinct = false, Con * Method called to associate a ChildUserRole object to this object * through the ChildUserRole foreign key attribute. * - * @param ChildUserRole $l ChildUserRole - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildUserRole $l ChildUserRole + * @return $this The current object (for fluent API support) */ public function addUserRole(ChildUserRole $l) { @@ -4812,15 +5016,15 @@ public function addUserRole(ChildUserRole $l) /** * @param ChildUserRole $userRole The ChildUserRole object to add. */ - protected function doAddUserRole(ChildUserRole $userRole) + protected function doAddUserRole(ChildUserRole $userRole): void { $this->collUserRoles[]= $userRole; $userRole->setUser($this); } /** - * @param ChildUserRole $userRole The ChildUserRole object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildUserRole $userRole The ChildUserRole object to remove. + * @return $this The current object (for fluent API support) */ public function removeUserRole(ChildUserRole $userRole) { @@ -4850,12 +5054,13 @@ public function removeUserRole(ChildUserRole $userRole) * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildUserRole[] List of ChildUserRole objects + * @phpstan-return ObjectCollection&\Traversable List of ChildUserRole objects */ - public function getUserRolesJoinRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getUserRolesJoinRole(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildUserRoleQuery::create(null, $criteria); $query->joinWith('Role', $joinBehavior); @@ -4869,18 +5074,22 @@ public function getUserRolesJoinRole(Criteria $criteria = null, ConnectionInterf * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addUserPermissions() + * @return $this + * @see addUserPermissions() */ public function clearUserPermissions() { $this->collUserPermissions = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collUserPermissions collection loaded partially. + * + * @return void */ - public function resetPartialUserPermissions($v = true) + public function resetPartialUserPermissions($v = true): void { $this->collUserPermissionsPartial = $v; } @@ -4892,12 +5101,12 @@ public function resetPartialUserPermissions($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initUserPermissions($overrideExisting = true) + public function initUserPermissions(bool $overrideExisting = true): void { if (null !== $this->collUserPermissions && !$overrideExisting) { return; @@ -4918,18 +5127,28 @@ public function initUserPermissions($overrideExisting = true) * If this ChildUser is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildUserPermission[] List of ChildUserPermission objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildUserPermission objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUserPermissions(Criteria $criteria = null, ConnectionInterface $con = null) + public function getUserPermissions(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collUserPermissionsPartial && !$this->isNew(); - if (null === $this->collUserPermissions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collUserPermissions) { + if (null === $this->collUserPermissions || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initUserPermissions(); + if (null === $this->collUserPermissions) { + $this->initUserPermissions(); + } else { + $collectionClassName = UserPermissionTableMap::getTableMap()->getCollectionClassName(); + + $collUserPermissions = new $collectionClassName; + $collUserPermissions->setModel('\TechWilk\Rota\UserPermission'); + + return $collUserPermissions; + } } else { $collUserPermissions = ChildUserPermissionQuery::create(null, $criteria) ->filterByUser($this) @@ -4973,11 +5192,11 @@ public function getUserPermissions(Criteria $criteria = null, ConnectionInterfac * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $userPermissions A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUser The current object (for fluent API support) + * @param Collection $userPermissions A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setUserPermissions(Collection $userPermissions, ConnectionInterface $con = null) + public function setUserPermissions(Collection $userPermissions, ?ConnectionInterface $con = null) { /** @var ChildUserPermission[] $userPermissionsToDelete */ $userPermissionsToDelete = $this->getUserPermissions(new Criteria(), $con)->diff($userPermissions); @@ -5003,13 +5222,13 @@ public function setUserPermissions(Collection $userPermissions, ConnectionInterf /** * Returns the number of related UserPermission objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related UserPermission objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related UserPermission objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countUserPermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countUserPermissions(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collUserPermissionsPartial && !$this->isNew(); if (null === $this->collUserPermissions || null !== $criteria || $partial) { @@ -5038,8 +5257,8 @@ public function countUserPermissions(Criteria $criteria = null, $distinct = fals * Method called to associate a ChildUserPermission object to this object * through the ChildUserPermission foreign key attribute. * - * @param ChildUserPermission $l ChildUserPermission - * @return $this|\TechWilk\Rota\User The current object (for fluent API support) + * @param ChildUserPermission $l ChildUserPermission + * @return $this The current object (for fluent API support) */ public function addUserPermission(ChildUserPermission $l) { @@ -5062,15 +5281,15 @@ public function addUserPermission(ChildUserPermission $l) /** * @param ChildUserPermission $userPermission The ChildUserPermission object to add. */ - protected function doAddUserPermission(ChildUserPermission $userPermission) + protected function doAddUserPermission(ChildUserPermission $userPermission): void { $this->collUserPermissions[]= $userPermission; $userPermission->setUser($this); } /** - * @param ChildUserPermission $userPermission The ChildUserPermission object to remove. - * @return $this|ChildUser The current object (for fluent API support) + * @param ChildUserPermission $userPermission The ChildUserPermission object to remove. + * @return $this The current object (for fluent API support) */ public function removeUserPermission(ChildUserPermission $userPermission) { @@ -5100,12 +5319,13 @@ public function removeUserPermission(ChildUserPermission $userPermission) * api reasonable. You can provide public methods for those you * actually need in User. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildUserPermission[] List of ChildUserPermission objects + * @phpstan-return ObjectCollection&\Traversable List of ChildUserPermission objects */ - public function getUserPermissionsJoinPermission(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getUserPermissionsJoinPermission(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildUserPermissionQuery::create(null, $criteria); $query->joinWith('Permission', $joinBehavior); @@ -5117,6 +5337,8 @@ public function getUserPermissionsJoinPermission(Criteria $criteria = null, Conn * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -5142,6 +5364,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -5150,9 +5374,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collCalendarTokens) { @@ -5217,6 +5442,7 @@ public function clearAllReferences($deep = false) $this->collSwaps = null; $this->collUserRoles = null; $this->collUserPermissions = null; + return $this; } /** @@ -5234,7 +5460,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildUser The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -5245,99 +5471,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -5347,7 +5553,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -5367,17 +5573,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/UserPermission.php b/generated-classes/TechWilk/Rota/Base/UserPermission.php index ef502dc1..3fad5bcf 100644 --- a/generated-classes/TechWilk/Rota/Base/UserPermission.php +++ b/generated-classes/TechWilk/Rota/Base/UserPermission.php @@ -20,7 +20,6 @@ use TechWilk\Rota\Permission as ChildPermission; use TechWilk\Rota\PermissionQuery as ChildPermissionQuery; use TechWilk\Rota\User as ChildUser; -use TechWilk\Rota\UserPermission as ChildUserPermission; use TechWilk\Rota\UserPermissionQuery as ChildUserPermissionQuery; use TechWilk\Rota\UserQuery as ChildUserQuery; use TechWilk\Rota\Map\UserPermissionTableMap; @@ -36,19 +35,21 @@ abstract class UserPermission implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\UserPermissionTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\UserPermissionTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -57,14 +58,14 @@ abstract class UserPermission implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -92,14 +93,14 @@ abstract class UserPermission implements ActiveRecordInterface /** * The value for the created field. * - * @var DateTime + * @var DateTime|null */ protected $created; /** * The value for the updated field. * - * @var DateTime + * @var DateTime|null */ protected $updated; @@ -117,7 +118,7 @@ abstract class UserPermission implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; @@ -127,7 +128,7 @@ abstract class UserPermission implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->userid = 0; $this->permissionid = 0; @@ -145,9 +146,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -155,10 +156,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -167,7 +168,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -177,9 +178,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -188,45 +189,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -235,10 +234,10 @@ public function resetModified($col = null) * obj is an instance of UserPermission, delegates to * equals(UserPermission). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -260,7 +259,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -268,10 +267,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -279,15 +278,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -296,12 +295,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|UserPermission The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -311,13 +310,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -328,24 +327,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -353,7 +355,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -394,12 +396,14 @@ public function getPermissionId() * Get the [optionally formatted] temporal [created] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getCreated($format = null) { @@ -414,12 +418,14 @@ public function getCreated($format = null) * Get the [optionally formatted] temporal [updated] column value. * * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. + * @param string|null $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * + * @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00. * - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value. * - * @throws PropelException - if unable to parse/validate the date/time value. + * @psalm-return ($format is null ? DateTime|null : string|null) */ public function getUpdated($format = null) { @@ -433,8 +439,8 @@ public function getUpdated($format = null) /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -448,13 +454,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -472,13 +478,13 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Set the value of [permissionid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setPermissionId($v) { @@ -496,14 +502,14 @@ public function setPermissionId($v) } return $this; - } // setPermissionId() + } /** * Sets the value of [created] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setCreated($v) { @@ -516,14 +522,14 @@ public function setCreated($v) } // if either are not null return $this; - } // setCreated() + } /** * Sets the value of [updated] column to a normalized version of the date/time value specified. * - * @param mixed $v string, integer (timestamp), or \DateTimeInterface value. + * @param string|integer|\DateTimeInterface|null $v string, integer (timestamp), or \DateTimeInterface value. * Empty strings are treated as NULL. - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function setUpdated($v) { @@ -536,7 +542,7 @@ public function setUpdated($v) } // if either are not null return $this; - } // setUpdated() + } /** * Indicates whether the columns in this object are only set to default values. @@ -544,21 +550,21 @@ public function setUpdated($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->userid !== 0) { - return false; - } + if ($this->userid !== 0) { + return false; + } - if ($this->permissionid !== 0) { - return false; - } + if ($this->permissionid !== 0) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -568,19 +574,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : UserPermissionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -601,8 +608,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = null; } $this->updated = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -610,6 +617,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 5; // 5 = UserPermissionTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\UserPermission'), 0, $e); } @@ -626,9 +634,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; @@ -636,19 +645,19 @@ public function ensureConsistency() if ($this->aPermission !== null && $this->permissionid !== $this->aPermission->getId()) { $this->aPermission = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -683,13 +692,13 @@ public function reload($deep = false, ConnectionInterface $con = null) /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see UserPermission::setDeleted() * @see UserPermission::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -719,12 +728,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -744,12 +753,13 @@ public function save(ConnectionInterface $con = null) if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - + $time = time(); + $highPrecision = \Propel\Runtime\Util\PropelDateTime::createHighPrecision(); if (!$this->isColumnModified(UserPermissionTableMap::COL_CREATED)) { - $this->setCreated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setCreated($highPrecision); } if (!$this->isColumnModified(UserPermissionTableMap::COL_UPDATED)) { - $this->setUpdated(\Propel\Runtime\Util\PropelDateTime::createHighPrecision()); + $this->setUpdated($highPrecision); } } else { $ret = $ret && $this->preUpdate($con); @@ -781,12 +791,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -823,22 +833,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[UserPermissionTableMap::COL_ID] = true; @@ -875,18 +886,23 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'permissionId': $stmt->bindValue($identifier, $this->permissionid, PDO::PARAM_INT); + break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; case 'updated': $stmt->bindValue($identifier, $this->updated ? $this->updated->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR); + break; } } @@ -909,12 +925,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -925,14 +941,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = UserPermissionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -944,30 +960,29 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getUserId(); - break; + case 2: return $this->getPermissionId(); - break; + case 3: return $this->getCreated(); - break; + case 4: return $this->getUpdated(); - break; + default: return null; - break; } // switch() } @@ -977,35 +992,35 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['UserPermission'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['UserPermission'][$this->hashCode()] = true; $keys = UserPermissionTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getPermissionId(), $keys[3] => $this->getCreated(), $keys[4] => $this->getUpdated(), - ); + ]; if ($result[$keys[3]] instanceof \DateTimeInterface) { - $result[$keys[3]] = $result[$keys[3]]->format('c'); + $result[$keys[3]] = $result[$keys[3]]->format('Y-m-d H:i:s.u'); } if ($result[$keys[4]] instanceof \DateTimeInterface) { - $result[$keys[4]] = $result[$keys[4]]->format('c'); + $result[$keys[4]] = $result[$keys[4]]->format('Y-m-d H:i:s.u'); } $virtualColumns = $this->virtualColumns; @@ -1015,6 +1030,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1026,9 +1042,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aPermission) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'permission'; @@ -1040,7 +1057,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Permission'; } - $result[$key] = $this->aPermission->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aPermission->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1050,30 +1067,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\UserPermission + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = UserPermissionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\UserPermission + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1109,11 +1128,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = UserPermissionTableMap::getFieldNames($keyType); @@ -1132,6 +1151,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[4], $arr)) { $this->setUpdated($arr[$keys[4]]); } + + return $this; } /** @@ -1151,9 +1172,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\UserPermission The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1167,9 +1188,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(UserPermissionTableMap::DATABASE_NAME); @@ -1196,13 +1217,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildUserPermissionQuery::create(); $criteria->add(UserPermissionTableMap::COL_ID, $this->id); @@ -1214,7 +1235,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1244,19 +1265,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1267,12 +1289,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\UserPermission (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\UserPermission (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setUserId($this->getUserId()); $copyObj->setPermissionId($this->getPermissionId()); @@ -1280,7 +1303,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->setUpdated($this->getUpdated()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1292,11 +1315,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\UserPermission Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1309,9 +1332,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { @@ -1337,11 +1360,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1360,9 +1383,9 @@ public function getUser(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildPermission object. * - * @param ChildPermission $v - * @return $this|\TechWilk\Rota\UserPermission The current object (for fluent API support) - * @throws PropelException + * @param ChildPermission $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setPermission(ChildPermission $v = null) { @@ -1388,11 +1411,11 @@ public function setPermission(ChildPermission $v = null) /** * Get the associated ChildPermission object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildPermission The associated ChildPermission object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getPermission(ConnectionInterface $con = null) + public function getPermission(?ConnectionInterface $con = null) { if ($this->aPermission === null && ($this->permissionid != 0)) { $this->aPermission = ChildPermissionQuery::create()->findPk($this->permissionid, $con); @@ -1412,6 +1435,8 @@ public function getPermission(ConnectionInterface $con = null) * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -1432,6 +1457,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -1440,15 +1467,17 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; $this->aPermission = null; + return $this; } /** @@ -1466,7 +1495,7 @@ public function __toString() /** * Mark the current object so that the update date doesn't get updated during next save * - * @return $this|ChildUserPermission The current object (for fluent API support) + * @return $this The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { @@ -1477,99 +1506,79 @@ public function keepUpdateDateUnchanged() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -1579,7 +1588,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -1599,17 +1608,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/UserPermissionQuery.php b/generated-classes/TechWilk/Rota/Base/UserPermissionQuery.php index d4447344..77c12ef0 100644 --- a/generated-classes/TechWilk/Rota/Base/UserPermissionQuery.php +++ b/generated-classes/TechWilk/Rota/Base/UserPermissionQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\UserPermissionTableMap; /** - * Base class that represents a query for the 'userPermissions' table. - * - * + * Base class that represents a query for the `userPermissions` table. * * @method ChildUserPermissionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildUserPermissionQuery orderByUserId($order = Criteria::ASC) Order by the userId column @@ -62,17 +61,17 @@ * * @method \TechWilk\Rota\UserQuery|\TechWilk\Rota\PermissionQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildUserPermission findOne(ConnectionInterface $con = null) Return the first ChildUserPermission matching the query - * @method ChildUserPermission findOneOrCreate(ConnectionInterface $con = null) Return the first ChildUserPermission matching the query, or a new ChildUserPermission object populated from the query conditions when no match is found + * @method ChildUserPermission|null findOne(?ConnectionInterface $con = null) Return the first ChildUserPermission matching the query + * @method ChildUserPermission findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildUserPermission matching the query, or a new ChildUserPermission object populated from the query conditions when no match is found * - * @method ChildUserPermission findOneById(int $id) Return the first ChildUserPermission filtered by the id column - * @method ChildUserPermission findOneByUserId(int $userId) Return the first ChildUserPermission filtered by the userId column - * @method ChildUserPermission findOneByPermissionId(int $permissionId) Return the first ChildUserPermission filtered by the permissionId column - * @method ChildUserPermission findOneByCreated(string $created) Return the first ChildUserPermission filtered by the created column - * @method ChildUserPermission findOneByUpdated(string $updated) Return the first ChildUserPermission filtered by the updated column * - - * @method ChildUserPermission requirePk($key, ConnectionInterface $con = null) Return the ChildUserPermission by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildUserPermission requireOne(ConnectionInterface $con = null) Return the first ChildUserPermission matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildUserPermission|null findOneById(int $id) Return the first ChildUserPermission filtered by the id column + * @method ChildUserPermission|null findOneByUserId(int $userId) Return the first ChildUserPermission filtered by the userId column + * @method ChildUserPermission|null findOneByPermissionId(int $permissionId) Return the first ChildUserPermission filtered by the permissionId column + * @method ChildUserPermission|null findOneByCreated(string $created) Return the first ChildUserPermission filtered by the created column + * @method ChildUserPermission|null findOneByUpdated(string $updated) Return the first ChildUserPermission filtered by the updated column + * + * @method ChildUserPermission requirePk($key, ?ConnectionInterface $con = null) Return the ChildUserPermission by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildUserPermission requireOne(?ConnectionInterface $con = null) Return the first ChildUserPermission matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildUserPermission requireOneById(int $id) Return the first ChildUserPermission filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUserPermission requireOneByUserId(int $userId) Return the first ChildUserPermission filtered by the userId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -80,14 +79,22 @@ * @method ChildUserPermission requireOneByCreated(string $created) Return the first ChildUserPermission filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUserPermission requireOneByUpdated(string $updated) Return the first ChildUserPermission filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildUserPermission[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildUserPermission objects based on current ModelCriteria - * @method ChildUserPermission[]|ObjectCollection findById(int $id) Return ChildUserPermission objects filtered by the id column - * @method ChildUserPermission[]|ObjectCollection findByUserId(int $userId) Return ChildUserPermission objects filtered by the userId column - * @method ChildUserPermission[]|ObjectCollection findByPermissionId(int $permissionId) Return ChildUserPermission objects filtered by the permissionId column - * @method ChildUserPermission[]|ObjectCollection findByCreated(string $created) Return ChildUserPermission objects filtered by the created column - * @method ChildUserPermission[]|ObjectCollection findByUpdated(string $updated) Return ChildUserPermission objects filtered by the updated column - * @method ChildUserPermission[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildUserPermission[]|Collection find(?ConnectionInterface $con = null) Return ChildUserPermission objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildUserPermission objects based on current ModelCriteria + * + * @method ChildUserPermission[]|Collection findById(int|array $id) Return ChildUserPermission objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildUserPermission objects filtered by the id column + * @method ChildUserPermission[]|Collection findByUserId(int|array $userId) Return ChildUserPermission objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserId(int|array $userId) Return ChildUserPermission objects filtered by the userId column + * @method ChildUserPermission[]|Collection findByPermissionId(int|array $permissionId) Return ChildUserPermission objects filtered by the permissionId column + * @psalm-method Collection&\Traversable findByPermissionId(int|array $permissionId) Return ChildUserPermission objects filtered by the permissionId column + * @method ChildUserPermission[]|Collection findByCreated(string|array $created) Return ChildUserPermission objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildUserPermission objects filtered by the created column + * @method ChildUserPermission[]|Collection findByUpdated(string|array $updated) Return ChildUserPermission objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildUserPermission objects filtered by the updated column * + * @method ChildUserPermission[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class UserPermissionQuery extends ModelCriteria { @@ -96,9 +103,9 @@ abstract class UserPermissionQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\UserPermissionQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\UserPermission', $modelAlias = null) { @@ -108,12 +115,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildUserPermissionQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildUserPermissionQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildUserPermissionQuery) { return $criteria; @@ -143,7 +150,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildUserPermission|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -175,8 +182,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -208,8 +215,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildUserPermission|array|mixed the result, formatted by the current formatter */ @@ -229,12 +236,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -251,25 +258,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(UserPermissionTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(UserPermissionTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(UserPermissionTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(UserPermissionTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -282,15 +295,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -310,7 +323,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(UserPermissionTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(UserPermissionTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -325,15 +340,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -353,7 +368,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(UserPermissionTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(UserPermissionTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -368,15 +385,15 @@ public function filterByUserId($userId = null, $comparison = null) * * @see filterByPermission() * - * @param mixed $permissionId The value to use as filter. + * @param mixed $permissionId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermissionId($permissionId = null, $comparison = null) + public function filterByPermissionId($permissionId = null, ?string $comparison = null) { if (is_array($permissionId)) { $useMinMax = false; @@ -396,7 +413,9 @@ public function filterByPermissionId($permissionId = null, $comparison = null) } } - return $this->addUsingAlias(UserPermissionTableMap::COL_PERMISSIONID, $permissionId, $comparison); + $this->addUsingAlias(UserPermissionTableMap::COL_PERMISSIONID, $permissionId, $comparison); + + return $this; } /** @@ -409,17 +428,17 @@ public function filterByPermissionId($permissionId = null, $comparison = null) * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -439,7 +458,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(UserPermissionTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(UserPermissionTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -452,17 +473,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -482,20 +503,22 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(UserPermissionTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(UserPermissionTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -505,8 +528,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(UserPermissionTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -515,12 +540,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -549,9 +574,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -562,17 +587,113 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Permission object * * @param \TechWilk\Rota\Permission|ObjectCollection $permission The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPermission($permission, $comparison = null) + public function filterByPermission($permission, ?string $comparison = null) { if ($permission instanceof \TechWilk\Rota\Permission) { return $this @@ -582,8 +703,10 @@ public function filterByPermission($permission, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(UserPermissionTableMap::COL_PERMISSIONID, $permission->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByPermission() only accepts arguments of type \TechWilk\Rota\Permission or Collection'); } @@ -592,12 +715,12 @@ public function filterByPermission($permission, $comparison = null) /** * Adds a JOIN clause to the query using the Permission relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinPermission($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinPermission(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Permission'); @@ -626,9 +749,9 @@ public function joinPermission($relationAlias = null, $joinType = Criteria::INNE * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\PermissionQuery A secondary query class using the current class as primary query */ @@ -639,12 +762,108 @@ public function usePermissionQuery($relationAlias = null, $joinType = Criteria:: ->useQuery($relationAlias ? $relationAlias : 'Permission', '\TechWilk\Rota\PermissionQuery'); } + /** + * Use the Permission relation Permission object + * + * @param callable(\TechWilk\Rota\PermissionQuery):\TechWilk\Rota\PermissionQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withPermissionQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->usePermissionQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Permission table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the EXISTS statement + */ + public function usePermissionExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useExistsQuery('Permission', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Permission table for a NOT EXISTS query. + * + * @see usePermissionExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the NOT EXISTS statement + */ + public function usePermissionNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useExistsQuery('Permission', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Permission table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the IN statement + */ + public function useInPermissionQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useInQuery('Permission', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Permission table for a NOT IN query. + * + * @see usePermissionInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\PermissionQuery The inner query object of the NOT IN statement + */ + public function useNotInPermissionQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\PermissionQuery */ + $q = $this->useInQuery('Permission', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildUserPermission $userPermission Object to remove from the list of results + * @param ChildUserPermission $userPermission Object to remove from the list of results * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($userPermission = null) { @@ -661,7 +880,7 @@ public function prune($userPermission = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserPermissionTableMap::DATABASE_NAME); @@ -686,12 +905,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserPermissionTableMap::DATABASE_NAME); @@ -721,64 +940,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(UserPermissionTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(UserPermissionTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(UserPermissionTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(UserPermissionTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(UserPermissionTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(UserPermissionTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(UserPermissionTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(UserPermissionTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(UserPermissionTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(UserPermissionTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildUserPermissionQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(UserPermissionTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(UserPermissionTableMap::COL_CREATED); + + return $this; } -} // UserPermissionQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/UserQuery.php b/generated-classes/TechWilk/Rota/Base/UserQuery.php index 1eafd78e..4f7764ef 100644 --- a/generated-classes/TechWilk/Rota/Base/UserQuery.php +++ b/generated-classes/TechWilk/Rota/Base/UserQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\UserTableMap; /** - * Base class that represents a query for the 'users' table. - * - * + * Base class that represents a query for the `users` table. * * @method ChildUserQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildUserQuery orderByFirstName($order = Criteria::ASC) Order by the firstName column @@ -164,28 +163,28 @@ * * @method \TechWilk\Rota\CalendarTokenQuery|\TechWilk\Rota\CommentQuery|\TechWilk\Rota\EventQuery|\TechWilk\Rota\AvailabilityQuery|\TechWilk\Rota\NotificationQuery|\TechWilk\Rota\SocialAuthQuery|\TechWilk\Rota\StatisticQuery|\TechWilk\Rota\SwapQuery|\TechWilk\Rota\UserRoleQuery|\TechWilk\Rota\UserPermissionQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildUser findOne(ConnectionInterface $con = null) Return the first ChildUser matching the query - * @method ChildUser findOneOrCreate(ConnectionInterface $con = null) Return the first ChildUser matching the query, or a new ChildUser object populated from the query conditions when no match is found + * @method ChildUser|null findOne(?ConnectionInterface $con = null) Return the first ChildUser matching the query + * @method ChildUser findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildUser matching the query, or a new ChildUser object populated from the query conditions when no match is found * - * @method ChildUser findOneById(int $id) Return the first ChildUser filtered by the id column - * @method ChildUser findOneByFirstName(string $firstName) Return the first ChildUser filtered by the firstName column - * @method ChildUser findOneByLastName(string $lastName) Return the first ChildUser filtered by the lastName column - * @method ChildUser findOneByUsername(string $username) Return the first ChildUser filtered by the username column - * @method ChildUser findOneByPassword(string $password) Return the first ChildUser filtered by the password column - * @method ChildUser findOneByIsAdmin(string $isAdmin) Return the first ChildUser filtered by the isAdmin column - * @method ChildUser findOneByEmail(\TechWilk\Rota\EmailAddress $email) Return the first ChildUser filtered by the email column - * @method ChildUser findOneByMobile(string $mobile) Return the first ChildUser filtered by the mobile column - * @method ChildUser findOneByIsOverviewRecipient(string $isOverviewRecipient) Return the first ChildUser filtered by the isOverviewRecipient column - * @method ChildUser findOneByRecieveReminderEmails(boolean $recieveReminderEmails) Return the first ChildUser filtered by the recieveReminderEmails column - * @method ChildUser findOneByIsBandAdmin(string $isBandAdmin) Return the first ChildUser filtered by the isBandAdmin column - * @method ChildUser findOneByIsEventEditor(string $isEventEditor) Return the first ChildUser filtered by the isEventEditor column - * @method ChildUser findOneByLastLogin(string $lastLogin) Return the first ChildUser filtered by the lastLogin column - * @method ChildUser findOneByPasswordChanged(string $passwordChanged) Return the first ChildUser filtered by the passwordChanged column - * @method ChildUser findOneByCreated(string $created) Return the first ChildUser filtered by the created column - * @method ChildUser findOneByUpdated(string $updated) Return the first ChildUser filtered by the updated column * - - * @method ChildUser requirePk($key, ConnectionInterface $con = null) Return the ChildUser by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildUser requireOne(ConnectionInterface $con = null) Return the first ChildUser matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildUser|null findOneById(int $id) Return the first ChildUser filtered by the id column + * @method ChildUser|null findOneByFirstName(string $firstName) Return the first ChildUser filtered by the firstName column + * @method ChildUser|null findOneByLastName(string $lastName) Return the first ChildUser filtered by the lastName column + * @method ChildUser|null findOneByUsername(string $username) Return the first ChildUser filtered by the username column + * @method ChildUser|null findOneByPassword(string $password) Return the first ChildUser filtered by the password column + * @method ChildUser|null findOneByIsAdmin(string $isAdmin) Return the first ChildUser filtered by the isAdmin column + * @method ChildUser|null findOneByEmail(\TechWilk\Rota\EmailAddress $email) Return the first ChildUser filtered by the email column + * @method ChildUser|null findOneByMobile(string $mobile) Return the first ChildUser filtered by the mobile column + * @method ChildUser|null findOneByIsOverviewRecipient(string $isOverviewRecipient) Return the first ChildUser filtered by the isOverviewRecipient column + * @method ChildUser|null findOneByRecieveReminderEmails(boolean $recieveReminderEmails) Return the first ChildUser filtered by the recieveReminderEmails column + * @method ChildUser|null findOneByIsBandAdmin(string $isBandAdmin) Return the first ChildUser filtered by the isBandAdmin column + * @method ChildUser|null findOneByIsEventEditor(string $isEventEditor) Return the first ChildUser filtered by the isEventEditor column + * @method ChildUser|null findOneByLastLogin(string $lastLogin) Return the first ChildUser filtered by the lastLogin column + * @method ChildUser|null findOneByPasswordChanged(string $passwordChanged) Return the first ChildUser filtered by the passwordChanged column + * @method ChildUser|null findOneByCreated(string $created) Return the first ChildUser filtered by the created column + * @method ChildUser|null findOneByUpdated(string $updated) Return the first ChildUser filtered by the updated column + * + * @method ChildUser requirePk($key, ?ConnectionInterface $con = null) Return the ChildUser by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildUser requireOne(?ConnectionInterface $con = null) Return the first ChildUser matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildUser requireOneById(int $id) Return the first ChildUser filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUser requireOneByFirstName(string $firstName) Return the first ChildUser filtered by the firstName column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found @@ -204,25 +203,44 @@ * @method ChildUser requireOneByCreated(string $created) Return the first ChildUser filtered by the created column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUser requireOneByUpdated(string $updated) Return the first ChildUser filtered by the updated column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildUser[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildUser objects based on current ModelCriteria - * @method ChildUser[]|ObjectCollection findById(int $id) Return ChildUser objects filtered by the id column - * @method ChildUser[]|ObjectCollection findByFirstName(string $firstName) Return ChildUser objects filtered by the firstName column - * @method ChildUser[]|ObjectCollection findByLastName(string $lastName) Return ChildUser objects filtered by the lastName column - * @method ChildUser[]|ObjectCollection findByUsername(string $username) Return ChildUser objects filtered by the username column - * @method ChildUser[]|ObjectCollection findByPassword(string $password) Return ChildUser objects filtered by the password column - * @method ChildUser[]|ObjectCollection findByIsAdmin(string $isAdmin) Return ChildUser objects filtered by the isAdmin column - * @method ChildUser[]|ObjectCollection findByEmail(\TechWilk\Rota\EmailAddress $email) Return ChildUser objects filtered by the email column - * @method ChildUser[]|ObjectCollection findByMobile(string $mobile) Return ChildUser objects filtered by the mobile column - * @method ChildUser[]|ObjectCollection findByIsOverviewRecipient(string $isOverviewRecipient) Return ChildUser objects filtered by the isOverviewRecipient column - * @method ChildUser[]|ObjectCollection findByRecieveReminderEmails(boolean $recieveReminderEmails) Return ChildUser objects filtered by the recieveReminderEmails column - * @method ChildUser[]|ObjectCollection findByIsBandAdmin(string $isBandAdmin) Return ChildUser objects filtered by the isBandAdmin column - * @method ChildUser[]|ObjectCollection findByIsEventEditor(string $isEventEditor) Return ChildUser objects filtered by the isEventEditor column - * @method ChildUser[]|ObjectCollection findByLastLogin(string $lastLogin) Return ChildUser objects filtered by the lastLogin column - * @method ChildUser[]|ObjectCollection findByPasswordChanged(string $passwordChanged) Return ChildUser objects filtered by the passwordChanged column - * @method ChildUser[]|ObjectCollection findByCreated(string $created) Return ChildUser objects filtered by the created column - * @method ChildUser[]|ObjectCollection findByUpdated(string $updated) Return ChildUser objects filtered by the updated column - * @method ChildUser[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildUser[]|Collection find(?ConnectionInterface $con = null) Return ChildUser objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildUser objects based on current ModelCriteria + * + * @method ChildUser[]|Collection findById(int|array $id) Return ChildUser objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildUser objects filtered by the id column + * @method ChildUser[]|Collection findByFirstName(string|array $firstName) Return ChildUser objects filtered by the firstName column + * @psalm-method Collection&\Traversable findByFirstName(string|array $firstName) Return ChildUser objects filtered by the firstName column + * @method ChildUser[]|Collection findByLastName(string|array $lastName) Return ChildUser objects filtered by the lastName column + * @psalm-method Collection&\Traversable findByLastName(string|array $lastName) Return ChildUser objects filtered by the lastName column + * @method ChildUser[]|Collection findByUsername(string|array $username) Return ChildUser objects filtered by the username column + * @psalm-method Collection&\Traversable findByUsername(string|array $username) Return ChildUser objects filtered by the username column + * @method ChildUser[]|Collection findByPassword(string|array $password) Return ChildUser objects filtered by the password column + * @psalm-method Collection&\Traversable findByPassword(string|array $password) Return ChildUser objects filtered by the password column + * @method ChildUser[]|Collection findByIsAdmin(string|array $isAdmin) Return ChildUser objects filtered by the isAdmin column + * @psalm-method Collection&\Traversable findByIsAdmin(string|array $isAdmin) Return ChildUser objects filtered by the isAdmin column + * @method ChildUser[]|Collection findByEmail(\TechWilk\Rota\EmailAddress|array<\TechWilk\Rota\EmailAddress> $email) Return ChildUser objects filtered by the email column + * @psalm-method Collection&\Traversable findByEmail(\TechWilk\Rota\EmailAddress|array<\TechWilk\Rota\EmailAddress> $email) Return ChildUser objects filtered by the email column + * @method ChildUser[]|Collection findByMobile(string|array $mobile) Return ChildUser objects filtered by the mobile column + * @psalm-method Collection&\Traversable findByMobile(string|array $mobile) Return ChildUser objects filtered by the mobile column + * @method ChildUser[]|Collection findByIsOverviewRecipient(string|array $isOverviewRecipient) Return ChildUser objects filtered by the isOverviewRecipient column + * @psalm-method Collection&\Traversable findByIsOverviewRecipient(string|array $isOverviewRecipient) Return ChildUser objects filtered by the isOverviewRecipient column + * @method ChildUser[]|Collection findByRecieveReminderEmails(boolean|array $recieveReminderEmails) Return ChildUser objects filtered by the recieveReminderEmails column + * @psalm-method Collection&\Traversable findByRecieveReminderEmails(boolean|array $recieveReminderEmails) Return ChildUser objects filtered by the recieveReminderEmails column + * @method ChildUser[]|Collection findByIsBandAdmin(string|array $isBandAdmin) Return ChildUser objects filtered by the isBandAdmin column + * @psalm-method Collection&\Traversable findByIsBandAdmin(string|array $isBandAdmin) Return ChildUser objects filtered by the isBandAdmin column + * @method ChildUser[]|Collection findByIsEventEditor(string|array $isEventEditor) Return ChildUser objects filtered by the isEventEditor column + * @psalm-method Collection&\Traversable findByIsEventEditor(string|array $isEventEditor) Return ChildUser objects filtered by the isEventEditor column + * @method ChildUser[]|Collection findByLastLogin(string|array $lastLogin) Return ChildUser objects filtered by the lastLogin column + * @psalm-method Collection&\Traversable findByLastLogin(string|array $lastLogin) Return ChildUser objects filtered by the lastLogin column + * @method ChildUser[]|Collection findByPasswordChanged(string|array $passwordChanged) Return ChildUser objects filtered by the passwordChanged column + * @psalm-method Collection&\Traversable findByPasswordChanged(string|array $passwordChanged) Return ChildUser objects filtered by the passwordChanged column + * @method ChildUser[]|Collection findByCreated(string|array $created) Return ChildUser objects filtered by the created column + * @psalm-method Collection&\Traversable findByCreated(string|array $created) Return ChildUser objects filtered by the created column + * @method ChildUser[]|Collection findByUpdated(string|array $updated) Return ChildUser objects filtered by the updated column + * @psalm-method Collection&\Traversable findByUpdated(string|array $updated) Return ChildUser objects filtered by the updated column * + * @method ChildUser[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class UserQuery extends ModelCriteria { @@ -231,9 +249,9 @@ abstract class UserQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\UserQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\User', $modelAlias = null) { @@ -243,12 +261,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildUserQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildUserQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildUserQuery) { return $criteria; @@ -278,7 +296,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildUser|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -310,8 +328,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -343,8 +361,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildUser|array|mixed the result, formatted by the current formatter */ @@ -364,12 +382,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -386,25 +404,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(UserTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(UserTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(UserTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(UserTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -417,15 +441,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -445,7 +469,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(UserTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -455,14 +481,15 @@ public function filterById($id = null, $comparison = null) * * $query->filterByFirstName('fooValue'); // WHERE firstName = 'fooValue' * $query->filterByFirstName('%fooValue%', Criteria::LIKE); // WHERE firstName LIKE '%fooValue%' + * $query->filterByFirstName(['foo', 'bar']); // WHERE firstName IN ('foo', 'bar') * * - * @param string $firstName The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $firstName The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByFirstName($firstName = null, $comparison = null) + public function filterByFirstName($firstName = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($firstName)) { @@ -470,7 +497,9 @@ public function filterByFirstName($firstName = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_FIRSTNAME, $firstName, $comparison); + $this->addUsingAlias(UserTableMap::COL_FIRSTNAME, $firstName, $comparison); + + return $this; } /** @@ -480,14 +509,15 @@ public function filterByFirstName($firstName = null, $comparison = null) * * $query->filterByLastName('fooValue'); // WHERE lastName = 'fooValue' * $query->filterByLastName('%fooValue%', Criteria::LIKE); // WHERE lastName LIKE '%fooValue%' + * $query->filterByLastName(['foo', 'bar']); // WHERE lastName IN ('foo', 'bar') * * - * @param string $lastName The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $lastName The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLastName($lastName = null, $comparison = null) + public function filterByLastName($lastName = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($lastName)) { @@ -495,7 +525,9 @@ public function filterByLastName($lastName = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_LASTNAME, $lastName, $comparison); + $this->addUsingAlias(UserTableMap::COL_LASTNAME, $lastName, $comparison); + + return $this; } /** @@ -505,14 +537,15 @@ public function filterByLastName($lastName = null, $comparison = null) * * $query->filterByUsername('fooValue'); // WHERE username = 'fooValue' * $query->filterByUsername('%fooValue%', Criteria::LIKE); // WHERE username LIKE '%fooValue%' + * $query->filterByUsername(['foo', 'bar']); // WHERE username IN ('foo', 'bar') * * - * @param string $username The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $username The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUsername($username = null, $comparison = null) + public function filterByUsername($username = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($username)) { @@ -520,7 +553,9 @@ public function filterByUsername($username = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_USERNAME, $username, $comparison); + $this->addUsingAlias(UserTableMap::COL_USERNAME, $username, $comparison); + + return $this; } /** @@ -530,14 +565,15 @@ public function filterByUsername($username = null, $comparison = null) * * $query->filterByPassword('fooValue'); // WHERE password = 'fooValue' * $query->filterByPassword('%fooValue%', Criteria::LIKE); // WHERE password LIKE '%fooValue%' + * $query->filterByPassword(['foo', 'bar']); // WHERE password IN ('foo', 'bar') * * - * @param string $password The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $password The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPassword($password = null, $comparison = null) + public function filterByPassword($password = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($password)) { @@ -545,7 +581,9 @@ public function filterByPassword($password = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_PASSWORD, $password, $comparison); + $this->addUsingAlias(UserTableMap::COL_PASSWORD, $password, $comparison); + + return $this; } /** @@ -555,14 +593,15 @@ public function filterByPassword($password = null, $comparison = null) * * $query->filterByIsAdmin('fooValue'); // WHERE isAdmin = 'fooValue' * $query->filterByIsAdmin('%fooValue%', Criteria::LIKE); // WHERE isAdmin LIKE '%fooValue%' + * $query->filterByIsAdmin(['foo', 'bar']); // WHERE isAdmin IN ('foo', 'bar') * * - * @param string $isAdmin The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $isAdmin The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByIsAdmin($isAdmin = null, $comparison = null) + public function filterByIsAdmin($isAdmin = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($isAdmin)) { @@ -570,7 +609,9 @@ public function filterByIsAdmin($isAdmin = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_ISADMIN, $isAdmin, $comparison); + $this->addUsingAlias(UserTableMap::COL_ISADMIN, $isAdmin, $comparison); + + return $this; } /** @@ -580,14 +621,15 @@ public function filterByIsAdmin($isAdmin = null, $comparison = null) * * $query->filterByEmail('fooValue'); // WHERE email = 'fooValue' * $query->filterByEmail('%fooValue%', Criteria::LIKE); // WHERE email LIKE '%fooValue%' + * $query->filterByEmail(['foo', 'bar']); // WHERE email IN ('foo', 'bar') * * - * @param string $email The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $email The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEmail($email = null, $comparison = null) + public function filterByEmail($email = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($email)) { @@ -595,7 +637,9 @@ public function filterByEmail($email = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_EMAIL, $email, $comparison); + $this->addUsingAlias(UserTableMap::COL_EMAIL, $email, $comparison); + + return $this; } /** @@ -605,14 +649,15 @@ public function filterByEmail($email = null, $comparison = null) * * $query->filterByMobile('fooValue'); // WHERE mobile = 'fooValue' * $query->filterByMobile('%fooValue%', Criteria::LIKE); // WHERE mobile LIKE '%fooValue%' + * $query->filterByMobile(['foo', 'bar']); // WHERE mobile IN ('foo', 'bar') * * - * @param string $mobile The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $mobile The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByMobile($mobile = null, $comparison = null) + public function filterByMobile($mobile = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($mobile)) { @@ -620,7 +665,9 @@ public function filterByMobile($mobile = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_MOBILE, $mobile, $comparison); + $this->addUsingAlias(UserTableMap::COL_MOBILE, $mobile, $comparison); + + return $this; } /** @@ -630,14 +677,15 @@ public function filterByMobile($mobile = null, $comparison = null) * * $query->filterByIsOverviewRecipient('fooValue'); // WHERE isOverviewRecipient = 'fooValue' * $query->filterByIsOverviewRecipient('%fooValue%', Criteria::LIKE); // WHERE isOverviewRecipient LIKE '%fooValue%' + * $query->filterByIsOverviewRecipient(['foo', 'bar']); // WHERE isOverviewRecipient IN ('foo', 'bar') * * - * @param string $isOverviewRecipient The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $isOverviewRecipient The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByIsOverviewRecipient($isOverviewRecipient = null, $comparison = null) + public function filterByIsOverviewRecipient($isOverviewRecipient = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($isOverviewRecipient)) { @@ -645,7 +693,9 @@ public function filterByIsOverviewRecipient($isOverviewRecipient = null, $compar } } - return $this->addUsingAlias(UserTableMap::COL_ISOVERVIEWRECIPIENT, $isOverviewRecipient, $comparison); + $this->addUsingAlias(UserTableMap::COL_ISOVERVIEWRECIPIENT, $isOverviewRecipient, $comparison); + + return $this; } /** @@ -657,22 +707,24 @@ public function filterByIsOverviewRecipient($isOverviewRecipient = null, $compar * $query->filterByRecieveReminderEmails('yes'); // WHERE recieveReminderEmails = true * * - * @param boolean|string $recieveReminderEmails The value to use as filter. + * @param bool|string $recieveReminderEmails The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRecieveReminderEmails($recieveReminderEmails = null, $comparison = null) + public function filterByRecieveReminderEmails($recieveReminderEmails = null, ?string $comparison = null) { if (is_string($recieveReminderEmails)) { - $recieveReminderEmails = in_array(strtolower($recieveReminderEmails), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $recieveReminderEmails = in_array(strtolower($recieveReminderEmails), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(UserTableMap::COL_RECIEVEREMINDEREMAILS, $recieveReminderEmails, $comparison); + $this->addUsingAlias(UserTableMap::COL_RECIEVEREMINDEREMAILS, $recieveReminderEmails, $comparison); + + return $this; } /** @@ -682,14 +734,15 @@ public function filterByRecieveReminderEmails($recieveReminderEmails = null, $co * * $query->filterByIsBandAdmin('fooValue'); // WHERE isBandAdmin = 'fooValue' * $query->filterByIsBandAdmin('%fooValue%', Criteria::LIKE); // WHERE isBandAdmin LIKE '%fooValue%' + * $query->filterByIsBandAdmin(['foo', 'bar']); // WHERE isBandAdmin IN ('foo', 'bar') * * - * @param string $isBandAdmin The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $isBandAdmin The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByIsBandAdmin($isBandAdmin = null, $comparison = null) + public function filterByIsBandAdmin($isBandAdmin = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($isBandAdmin)) { @@ -697,7 +750,9 @@ public function filterByIsBandAdmin($isBandAdmin = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_ISBANDADMIN, $isBandAdmin, $comparison); + $this->addUsingAlias(UserTableMap::COL_ISBANDADMIN, $isBandAdmin, $comparison); + + return $this; } /** @@ -707,14 +762,15 @@ public function filterByIsBandAdmin($isBandAdmin = null, $comparison = null) * * $query->filterByIsEventEditor('fooValue'); // WHERE isEventEditor = 'fooValue' * $query->filterByIsEventEditor('%fooValue%', Criteria::LIKE); // WHERE isEventEditor LIKE '%fooValue%' + * $query->filterByIsEventEditor(['foo', 'bar']); // WHERE isEventEditor IN ('foo', 'bar') * * - * @param string $isEventEditor The value to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|string[] $isEventEditor The value to use as filter. + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByIsEventEditor($isEventEditor = null, $comparison = null) + public function filterByIsEventEditor($isEventEditor = null, ?string $comparison = null) { if (null === $comparison) { if (is_array($isEventEditor)) { @@ -722,7 +778,9 @@ public function filterByIsEventEditor($isEventEditor = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_ISEVENTEDITOR, $isEventEditor, $comparison); + $this->addUsingAlias(UserTableMap::COL_ISEVENTEDITOR, $isEventEditor, $comparison); + + return $this; } /** @@ -735,17 +793,17 @@ public function filterByIsEventEditor($isEventEditor = null, $comparison = null) * $query->filterByLastLogin(array('max' => 'yesterday')); // WHERE lastLogin > '2011-03-13' * * - * @param mixed $lastLogin The value to use as filter. + * @param mixed $lastLogin The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByLastLogin($lastLogin = null, $comparison = null) + public function filterByLastLogin($lastLogin = null, ?string $comparison = null) { if (is_array($lastLogin)) { $useMinMax = false; @@ -765,7 +823,9 @@ public function filterByLastLogin($lastLogin = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_LASTLOGIN, $lastLogin, $comparison); + $this->addUsingAlias(UserTableMap::COL_LASTLOGIN, $lastLogin, $comparison); + + return $this; } /** @@ -778,17 +838,17 @@ public function filterByLastLogin($lastLogin = null, $comparison = null) * $query->filterByPasswordChanged(array('max' => 'yesterday')); // WHERE passwordChanged > '2011-03-13' * * - * @param mixed $passwordChanged The value to use as filter. + * @param mixed $passwordChanged The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByPasswordChanged($passwordChanged = null, $comparison = null) + public function filterByPasswordChanged($passwordChanged = null, ?string $comparison = null) { if (is_array($passwordChanged)) { $useMinMax = false; @@ -808,7 +868,9 @@ public function filterByPasswordChanged($passwordChanged = null, $comparison = n } } - return $this->addUsingAlias(UserTableMap::COL_PASSWORDCHANGED, $passwordChanged, $comparison); + $this->addUsingAlias(UserTableMap::COL_PASSWORDCHANGED, $passwordChanged, $comparison); + + return $this; } /** @@ -821,17 +883,17 @@ public function filterByPasswordChanged($passwordChanged = null, $comparison = n * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13' * * - * @param mixed $created The value to use as filter. + * @param mixed $created The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCreated($created = null, $comparison = null) + public function filterByCreated($created = null, ?string $comparison = null) { if (is_array($created)) { $useMinMax = false; @@ -851,7 +913,9 @@ public function filterByCreated($created = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_CREATED, $created, $comparison); + $this->addUsingAlias(UserTableMap::COL_CREATED, $created, $comparison); + + return $this; } /** @@ -864,17 +928,17 @@ public function filterByCreated($created = null, $comparison = null) * $query->filterByUpdated(array('max' => 'yesterday')); // WHERE updated > '2011-03-13' * * - * @param mixed $updated The value to use as filter. + * @param mixed $updated The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUpdated($updated = null, $comparison = null) + public function filterByUpdated($updated = null, ?string $comparison = null) { if (is_array($updated)) { $useMinMax = false; @@ -894,27 +958,33 @@ public function filterByUpdated($updated = null, $comparison = null) } } - return $this->addUsingAlias(UserTableMap::COL_UPDATED, $updated, $comparison); + $this->addUsingAlias(UserTableMap::COL_UPDATED, $updated, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\CalendarToken object * * @param \TechWilk\Rota\CalendarToken|ObjectCollection $calendarToken the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByCalendarToken($calendarToken, $comparison = null) + public function filterByCalendarToken($calendarToken, ?string $comparison = null) { if ($calendarToken instanceof \TechWilk\Rota\CalendarToken) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $calendarToken->getUserid(), $comparison); + + return $this; } elseif ($calendarToken instanceof ObjectCollection) { - return $this + $this ->useCalendarTokenQuery() ->filterByPrimaryKeys($calendarToken->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByCalendarToken() only accepts arguments of type \TechWilk\Rota\CalendarToken or Collection'); } @@ -923,12 +993,12 @@ public function filterByCalendarToken($calendarToken, $comparison = null) /** * Adds a JOIN clause to the query using the CalendarToken relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinCalendarToken($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinCalendarToken(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('CalendarToken'); @@ -957,9 +1027,9 @@ public function joinCalendarToken($relationAlias = null, $joinType = Criteria::I * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\CalendarTokenQuery A secondary query class using the current class as primary query */ @@ -970,24 +1040,124 @@ public function useCalendarTokenQuery($relationAlias = null, $joinType = Criteri ->useQuery($relationAlias ? $relationAlias : 'CalendarToken', '\TechWilk\Rota\CalendarTokenQuery'); } + /** + * Use the CalendarToken relation CalendarToken object + * + * @param callable(\TechWilk\Rota\CalendarTokenQuery):\TechWilk\Rota\CalendarTokenQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withCalendarTokenQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useCalendarTokenQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to CalendarToken table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\CalendarTokenQuery The inner query object of the EXISTS statement + */ + public function useCalendarTokenExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\CalendarTokenQuery */ + $q = $this->useExistsQuery('CalendarToken', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to CalendarToken table for a NOT EXISTS query. + * + * @see useCalendarTokenExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\CalendarTokenQuery The inner query object of the NOT EXISTS statement + */ + public function useCalendarTokenNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\CalendarTokenQuery */ + $q = $this->useExistsQuery('CalendarToken', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to CalendarToken table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\CalendarTokenQuery The inner query object of the IN statement + */ + public function useInCalendarTokenQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\CalendarTokenQuery */ + $q = $this->useInQuery('CalendarToken', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to CalendarToken table for a NOT IN query. + * + * @see useCalendarTokenInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\CalendarTokenQuery The inner query object of the NOT IN statement + */ + public function useNotInCalendarTokenQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\CalendarTokenQuery */ + $q = $this->useInQuery('CalendarToken', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Comment object * * @param \TechWilk\Rota\Comment|ObjectCollection $comment the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByComment($comment, $comparison = null) + public function filterByComment($comment, ?string $comparison = null) { if ($comment instanceof \TechWilk\Rota\Comment) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $comment->getUserId(), $comparison); + + return $this; } elseif ($comment instanceof ObjectCollection) { - return $this + $this ->useCommentQuery() ->filterByPrimaryKeys($comment->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByComment() only accepts arguments of type \TechWilk\Rota\Comment or Collection'); } @@ -996,12 +1166,12 @@ public function filterByComment($comment, $comparison = null) /** * Adds a JOIN clause to the query using the Comment relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinComment($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinComment(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Comment'); @@ -1030,9 +1200,9 @@ public function joinComment($relationAlias = null, $joinType = Criteria::INNER_J * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\CommentQuery A secondary query class using the current class as primary query */ @@ -1043,24 +1213,124 @@ public function useCommentQuery($relationAlias = null, $joinType = Criteria::INN ->useQuery($relationAlias ? $relationAlias : 'Comment', '\TechWilk\Rota\CommentQuery'); } + /** + * Use the Comment relation Comment object + * + * @param callable(\TechWilk\Rota\CommentQuery):\TechWilk\Rota\CommentQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withCommentQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useCommentQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Comment table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the EXISTS statement + */ + public function useCommentExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useExistsQuery('Comment', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Comment table for a NOT EXISTS query. + * + * @see useCommentExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the NOT EXISTS statement + */ + public function useCommentNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useExistsQuery('Comment', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Comment table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the IN statement + */ + public function useInCommentQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useInQuery('Comment', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Comment table for a NOT IN query. + * + * @see useCommentInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\CommentQuery The inner query object of the NOT IN statement + */ + public function useNotInCommentQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\CommentQuery */ + $q = $this->useInQuery('Comment', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Event object * * @param \TechWilk\Rota\Event|ObjectCollection $event the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEvent($event, $comparison = null) + public function filterByEvent($event, ?string $comparison = null) { if ($event instanceof \TechWilk\Rota\Event) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $event->getCreatedBy(), $comparison); + + return $this; } elseif ($event instanceof ObjectCollection) { - return $this + $this ->useEventQuery() ->filterByPrimaryKeys($event->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEvent() only accepts arguments of type \TechWilk\Rota\Event or Collection'); } @@ -1069,12 +1339,12 @@ public function filterByEvent($event, $comparison = null) /** * Adds a JOIN clause to the query using the Event relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEvent(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Event'); @@ -1103,9 +1373,9 @@ public function joinEvent($relationAlias = null, $joinType = Criteria::INNER_JOI * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventQuery A secondary query class using the current class as primary query */ @@ -1116,24 +1386,124 @@ public function useEventQuery($relationAlias = null, $joinType = Criteria::INNER ->useQuery($relationAlias ? $relationAlias : 'Event', '\TechWilk\Rota\EventQuery'); } + /** + * Use the Event relation Event object + * + * @param callable(\TechWilk\Rota\EventQuery):\TechWilk\Rota\EventQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Event table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventQuery The inner query object of the EXISTS statement + */ + public function useEventExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Event table for a NOT EXISTS query. + * + * @see useEventExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT EXISTS statement + */ + public function useEventNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useExistsQuery('Event', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Event table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventQuery The inner query object of the IN statement + */ + public function useInEventQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Event table for a NOT IN query. + * + * @see useEventInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventQuery The inner query object of the NOT IN statement + */ + public function useNotInEventQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventQuery */ + $q = $this->useInQuery('Event', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Availability object * * @param \TechWilk\Rota\Availability|ObjectCollection $availability the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByAvailability($availability, $comparison = null) + public function filterByAvailability($availability, ?string $comparison = null) { if ($availability instanceof \TechWilk\Rota\Availability) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $availability->getUserId(), $comparison); + + return $this; } elseif ($availability instanceof ObjectCollection) { - return $this + $this ->useAvailabilityQuery() ->filterByPrimaryKeys($availability->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByAvailability() only accepts arguments of type \TechWilk\Rota\Availability or Collection'); } @@ -1142,12 +1512,12 @@ public function filterByAvailability($availability, $comparison = null) /** * Adds a JOIN clause to the query using the Availability relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinAvailability($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinAvailability(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Availability'); @@ -1176,9 +1546,9 @@ public function joinAvailability($relationAlias = null, $joinType = Criteria::IN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\AvailabilityQuery A secondary query class using the current class as primary query */ @@ -1189,24 +1559,124 @@ public function useAvailabilityQuery($relationAlias = null, $joinType = Criteria ->useQuery($relationAlias ? $relationAlias : 'Availability', '\TechWilk\Rota\AvailabilityQuery'); } + /** + * Use the Availability relation Availability object + * + * @param callable(\TechWilk\Rota\AvailabilityQuery):\TechWilk\Rota\AvailabilityQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withAvailabilityQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useAvailabilityQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Availability table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the EXISTS statement + */ + public function useAvailabilityExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useExistsQuery('Availability', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Availability table for a NOT EXISTS query. + * + * @see useAvailabilityExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the NOT EXISTS statement + */ + public function useAvailabilityNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useExistsQuery('Availability', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Availability table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the IN statement + */ + public function useInAvailabilityQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useInQuery('Availability', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Availability table for a NOT IN query. + * + * @see useAvailabilityInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\AvailabilityQuery The inner query object of the NOT IN statement + */ + public function useNotInAvailabilityQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\AvailabilityQuery */ + $q = $this->useInQuery('Availability', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Notification object * * @param \TechWilk\Rota\Notification|ObjectCollection $notification the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByNotification($notification, $comparison = null) + public function filterByNotification($notification, ?string $comparison = null) { if ($notification instanceof \TechWilk\Rota\Notification) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $notification->getUserId(), $comparison); + + return $this; } elseif ($notification instanceof ObjectCollection) { - return $this + $this ->useNotificationQuery() ->filterByPrimaryKeys($notification->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByNotification() only accepts arguments of type \TechWilk\Rota\Notification or Collection'); } @@ -1215,12 +1685,12 @@ public function filterByNotification($notification, $comparison = null) /** * Adds a JOIN clause to the query using the Notification relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinNotification($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinNotification(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Notification'); @@ -1249,9 +1719,9 @@ public function joinNotification($relationAlias = null, $joinType = Criteria::IN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\NotificationQuery A secondary query class using the current class as primary query */ @@ -1262,24 +1732,124 @@ public function useNotificationQuery($relationAlias = null, $joinType = Criteria ->useQuery($relationAlias ? $relationAlias : 'Notification', '\TechWilk\Rota\NotificationQuery'); } + /** + * Use the Notification relation Notification object + * + * @param callable(\TechWilk\Rota\NotificationQuery):\TechWilk\Rota\NotificationQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withNotificationQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useNotificationQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Notification table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the EXISTS statement + */ + public function useNotificationExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useExistsQuery('Notification', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Notification table for a NOT EXISTS query. + * + * @see useNotificationExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the NOT EXISTS statement + */ + public function useNotificationNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useExistsQuery('Notification', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Notification table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the IN statement + */ + public function useInNotificationQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useInQuery('Notification', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Notification table for a NOT IN query. + * + * @see useNotificationInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\NotificationQuery The inner query object of the NOT IN statement + */ + public function useNotInNotificationQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\NotificationQuery */ + $q = $this->useInQuery('Notification', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\SocialAuth object * * @param \TechWilk\Rota\SocialAuth|ObjectCollection $socialAuth the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySocialAuth($socialAuth, $comparison = null) + public function filterBySocialAuth($socialAuth, ?string $comparison = null) { if ($socialAuth instanceof \TechWilk\Rota\SocialAuth) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $socialAuth->getUserId(), $comparison); + + return $this; } elseif ($socialAuth instanceof ObjectCollection) { - return $this + $this ->useSocialAuthQuery() ->filterByPrimaryKeys($socialAuth->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterBySocialAuth() only accepts arguments of type \TechWilk\Rota\SocialAuth or Collection'); } @@ -1288,12 +1858,12 @@ public function filterBySocialAuth($socialAuth, $comparison = null) /** * Adds a JOIN clause to the query using the SocialAuth relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinSocialAuth($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinSocialAuth(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('SocialAuth'); @@ -1322,9 +1892,9 @@ public function joinSocialAuth($relationAlias = null, $joinType = Criteria::INNE * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\SocialAuthQuery A secondary query class using the current class as primary query */ @@ -1335,24 +1905,124 @@ public function useSocialAuthQuery($relationAlias = null, $joinType = Criteria:: ->useQuery($relationAlias ? $relationAlias : 'SocialAuth', '\TechWilk\Rota\SocialAuthQuery'); } + /** + * Use the SocialAuth relation SocialAuth object + * + * @param callable(\TechWilk\Rota\SocialAuthQuery):\TechWilk\Rota\SocialAuthQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withSocialAuthQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useSocialAuthQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to SocialAuth table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\SocialAuthQuery The inner query object of the EXISTS statement + */ + public function useSocialAuthExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\SocialAuthQuery */ + $q = $this->useExistsQuery('SocialAuth', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to SocialAuth table for a NOT EXISTS query. + * + * @see useSocialAuthExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SocialAuthQuery The inner query object of the NOT EXISTS statement + */ + public function useSocialAuthNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SocialAuthQuery */ + $q = $this->useExistsQuery('SocialAuth', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to SocialAuth table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\SocialAuthQuery The inner query object of the IN statement + */ + public function useInSocialAuthQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\SocialAuthQuery */ + $q = $this->useInQuery('SocialAuth', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to SocialAuth table for a NOT IN query. + * + * @see useSocialAuthInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SocialAuthQuery The inner query object of the NOT IN statement + */ + public function useNotInSocialAuthQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SocialAuthQuery */ + $q = $this->useInQuery('SocialAuth', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Statistic object * * @param \TechWilk\Rota\Statistic|ObjectCollection $statistic the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByStatistic($statistic, $comparison = null) + public function filterByStatistic($statistic, ?string $comparison = null) { if ($statistic instanceof \TechWilk\Rota\Statistic) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $statistic->getUserId(), $comparison); + + return $this; } elseif ($statistic instanceof ObjectCollection) { - return $this + $this ->useStatisticQuery() ->filterByPrimaryKeys($statistic->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByStatistic() only accepts arguments of type \TechWilk\Rota\Statistic or Collection'); } @@ -1361,12 +2031,12 @@ public function filterByStatistic($statistic, $comparison = null) /** * Adds a JOIN clause to the query using the Statistic relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinStatistic($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinStatistic(?string $relationAlias = null, ?string $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Statistic'); @@ -1395,9 +2065,9 @@ public function joinStatistic($relationAlias = null, $joinType = Criteria::LEFT_ * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\StatisticQuery A secondary query class using the current class as primary query */ @@ -1408,24 +2078,124 @@ public function useStatisticQuery($relationAlias = null, $joinType = Criteria::L ->useQuery($relationAlias ? $relationAlias : 'Statistic', '\TechWilk\Rota\StatisticQuery'); } + /** + * Use the Statistic relation Statistic object + * + * @param callable(\TechWilk\Rota\StatisticQuery):\TechWilk\Rota\StatisticQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withStatisticQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::LEFT_JOIN + ) { + $relatedQuery = $this->useStatisticQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Statistic table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\StatisticQuery The inner query object of the EXISTS statement + */ + public function useStatisticExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\StatisticQuery */ + $q = $this->useExistsQuery('Statistic', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Statistic table for a NOT EXISTS query. + * + * @see useStatisticExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\StatisticQuery The inner query object of the NOT EXISTS statement + */ + public function useStatisticNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\StatisticQuery */ + $q = $this->useExistsQuery('Statistic', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Statistic table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\StatisticQuery The inner query object of the IN statement + */ + public function useInStatisticQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\StatisticQuery */ + $q = $this->useInQuery('Statistic', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Statistic table for a NOT IN query. + * + * @see useStatisticInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\StatisticQuery The inner query object of the NOT IN statement + */ + public function useNotInStatisticQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\StatisticQuery */ + $q = $this->useInQuery('Statistic', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Swap object * * @param \TechWilk\Rota\Swap|ObjectCollection $swap the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySwap($swap, $comparison = null) + public function filterBySwap($swap, ?string $comparison = null) { if ($swap instanceof \TechWilk\Rota\Swap) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $swap->getRequestedBy(), $comparison); + + return $this; } elseif ($swap instanceof ObjectCollection) { - return $this + $this ->useSwapQuery() ->filterByPrimaryKeys($swap->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterBySwap() only accepts arguments of type \TechWilk\Rota\Swap or Collection'); } @@ -1434,12 +2204,12 @@ public function filterBySwap($swap, $comparison = null) /** * Adds a JOIN clause to the query using the Swap relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinSwap($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinSwap(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Swap'); @@ -1468,9 +2238,9 @@ public function joinSwap($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\SwapQuery A secondary query class using the current class as primary query */ @@ -1481,24 +2251,124 @@ public function useSwapQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'Swap', '\TechWilk\Rota\SwapQuery'); } + /** + * Use the Swap relation Swap object + * + * @param callable(\TechWilk\Rota\SwapQuery):\TechWilk\Rota\SwapQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withSwapQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useSwapQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Swap table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the EXISTS statement + */ + public function useSwapExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('Swap', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Swap table for a NOT EXISTS query. + * + * @see useSwapExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT EXISTS statement + */ + public function useSwapNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('Swap', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Swap table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the IN statement + */ + public function useInSwapQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('Swap', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Swap table for a NOT IN query. + * + * @see useSwapInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT IN statement + */ + public function useNotInSwapQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('Swap', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\UserRole object * * @param \TechWilk\Rota\UserRole|ObjectCollection $userRole the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserRole($userRole, $comparison = null) + public function filterByUserRole($userRole, ?string $comparison = null) { if ($userRole instanceof \TechWilk\Rota\UserRole) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $userRole->getUserId(), $comparison); + + return $this; } elseif ($userRole instanceof ObjectCollection) { - return $this + $this ->useUserRoleQuery() ->filterByPrimaryKeys($userRole->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByUserRole() only accepts arguments of type \TechWilk\Rota\UserRole or Collection'); } @@ -1507,12 +2377,12 @@ public function filterByUserRole($userRole, $comparison = null) /** * Adds a JOIN clause to the query using the UserRole relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUserRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUserRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('UserRole'); @@ -1541,9 +2411,9 @@ public function joinUserRole($relationAlias = null, $joinType = Criteria::INNER_ * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserRoleQuery A secondary query class using the current class as primary query */ @@ -1554,24 +2424,124 @@ public function useUserRoleQuery($relationAlias = null, $joinType = Criteria::IN ->useQuery($relationAlias ? $relationAlias : 'UserRole', '\TechWilk\Rota\UserRoleQuery'); } + /** + * Use the UserRole relation UserRole object + * + * @param callable(\TechWilk\Rota\UserRoleQuery):\TechWilk\Rota\UserRoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to UserRole table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the EXISTS statement + */ + public function useUserRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('UserRole', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to UserRole table for a NOT EXISTS query. + * + * @see useUserRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT EXISTS statement + */ + public function useUserRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useExistsQuery('UserRole', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to UserRole table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the IN statement + */ + public function useInUserRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('UserRole', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to UserRole table for a NOT IN query. + * + * @see useUserRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserRoleQuery The inner query object of the NOT IN statement + */ + public function useNotInUserRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserRoleQuery */ + $q = $this->useInQuery('UserRole', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\UserPermission object * * @param \TechWilk\Rota\UserPermission|ObjectCollection $userPermission the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserPermission($userPermission, $comparison = null) + public function filterByUserPermission($userPermission, ?string $comparison = null) { if ($userPermission instanceof \TechWilk\Rota\UserPermission) { - return $this + $this ->addUsingAlias(UserTableMap::COL_ID, $userPermission->getUserId(), $comparison); + + return $this; } elseif ($userPermission instanceof ObjectCollection) { - return $this + $this ->useUserPermissionQuery() ->filterByPrimaryKeys($userPermission->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByUserPermission() only accepts arguments of type \TechWilk\Rota\UserPermission or Collection'); } @@ -1580,12 +2550,12 @@ public function filterByUserPermission($userPermission, $comparison = null) /** * Adds a JOIN clause to the query using the UserPermission relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUserPermission($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUserPermission(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('UserPermission'); @@ -1614,9 +2584,9 @@ public function joinUserPermission($relationAlias = null, $joinType = Criteria:: * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserPermissionQuery A secondary query class using the current class as primary query */ @@ -1627,12 +2597,108 @@ public function useUserPermissionQuery($relationAlias = null, $joinType = Criter ->useQuery($relationAlias ? $relationAlias : 'UserPermission', '\TechWilk\Rota\UserPermissionQuery'); } + /** + * Use the UserPermission relation UserPermission object + * + * @param callable(\TechWilk\Rota\UserPermissionQuery):\TechWilk\Rota\UserPermissionQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserPermissionQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserPermissionQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to UserPermission table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the EXISTS statement + */ + public function useUserPermissionExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useExistsQuery('UserPermission', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to UserPermission table for a NOT EXISTS query. + * + * @see useUserPermissionExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the NOT EXISTS statement + */ + public function useUserPermissionNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useExistsQuery('UserPermission', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to UserPermission table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the IN statement + */ + public function useInUserPermissionQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useInQuery('UserPermission', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to UserPermission table for a NOT IN query. + * + * @see useUserPermissionInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserPermissionQuery The inner query object of the NOT IN statement + */ + public function useNotInUserPermissionQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserPermissionQuery */ + $q = $this->useInQuery('UserPermission', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildUser $user Object to remove from the list of results + * @param ChildUser $user Object to remove from the list of results * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($user = null) { @@ -1649,7 +2715,7 @@ public function prune($user = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); @@ -1674,12 +2740,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); @@ -1709,64 +2775,77 @@ public function delete(ConnectionInterface $con = null) /** * Filter by the latest updated * - * @param int $nbDays Maximum age of the latest update in days + * @param int $nbDays Maximum age of the latest update in days * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(UserTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(UserTableMap::COL_UPDATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by update date desc * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(UserTableMap::COL_UPDATED); + $this->addDescendingOrderByColumn(UserTableMap::COL_UPDATED); + + return $this; } /** * Order by update date asc * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(UserTableMap::COL_UPDATED); + $this->addAscendingOrderByColumn(UserTableMap::COL_UPDATED); + + return $this; } /** * Order by create date desc * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(UserTableMap::COL_CREATED); + $this->addDescendingOrderByColumn(UserTableMap::COL_CREATED); + + return $this; } /** * Filter by the latest created * - * @param int $nbDays Maximum age of in days + * @param int $nbDays Maximum age of in days * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(UserTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + $this->addUsingAlias(UserTableMap::COL_CREATED, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + + return $this; } /** * Order by create date asc * - * @return $this|ChildUserQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(UserTableMap::COL_CREATED); + $this->addAscendingOrderByColumn(UserTableMap::COL_CREATED); + + return $this; } -} // UserQuery + +} diff --git a/generated-classes/TechWilk/Rota/Base/UserRole.php b/generated-classes/TechWilk/Rota/Base/UserRole.php index 6c54fa5d..a6ce4fe3 100644 --- a/generated-classes/TechWilk/Rota/Base/UserRole.php +++ b/generated-classes/TechWilk/Rota/Base/UserRole.php @@ -41,19 +41,21 @@ abstract class UserRole implements ActiveRecordInterface { /** * TableMap class name + * + * @var string */ - const TABLE_MAP = '\\TechWilk\\Rota\\Map\\UserRoleTableMap'; + public const TABLE_MAP = '\\TechWilk\\Rota\\Map\\UserRoleTableMap'; /** * attribute to determine if this object has previously been saved. - * @var boolean + * @var bool */ protected $new = true; /** * attribute to determine whether this object has been deleted. - * @var boolean + * @var bool */ protected $deleted = false; @@ -62,14 +64,14 @@ abstract class UserRole implements ActiveRecordInterface * Tracking modified columns allows us to only update modified columns. * @var array */ - protected $modifiedColumns = array(); + protected $modifiedColumns = []; /** * The (virtual) columns that are added at runtime * The formatters can add supplementary columns based on a resultset * @var array */ - protected $virtualColumns = array(); + protected $virtualColumns = []; /** * The value for the id field. @@ -114,18 +116,21 @@ abstract class UserRole implements ActiveRecordInterface /** * @var ObjectCollection|ChildEventPerson[] Collection to store aggregation of ChildEventPerson objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildEventPerson objects. */ protected $collEventpeople; protected $collEventpeoplePartial; /** * @var ObjectCollection|ChildSwap[] Collection to store aggregation of ChildSwap objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildSwap objects. */ protected $collSwapsRelatedByOldUserRoleId; protected $collSwapsRelatedByOldUserRoleIdPartial; /** * @var ObjectCollection|ChildSwap[] Collection to store aggregation of ChildSwap objects. + * @phpstan-var ObjectCollection&\Traversable Collection to store aggregation of ChildSwap objects. */ protected $collSwapsRelatedByNewUserRoleId; protected $collSwapsRelatedByNewUserRoleIdPartial; @@ -134,25 +139,28 @@ abstract class UserRole implements ActiveRecordInterface * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * - * @var boolean + * @var bool */ protected $alreadyInSave = false; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildEventPerson[] + * @phpstan-var ObjectCollection&\Traversable */ protected $eventpeopleScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildSwap[] + * @phpstan-var ObjectCollection&\Traversable */ protected $swapsRelatedByOldUserRoleIdScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection|ChildSwap[] + * @phpstan-var ObjectCollection&\Traversable */ protected $swapsRelatedByNewUserRoleIdScheduledForDeletion = null; @@ -162,7 +170,7 @@ abstract class UserRole implements ActiveRecordInterface * equivalent initialization method). * @see __construct() */ - public function applyDefaultValues() + public function applyDefaultValues(): void { $this->userid = 0; $this->roleid = 0; @@ -181,9 +189,9 @@ public function __construct() /** * Returns whether the object has been modified. * - * @return boolean True if the object has been modified. + * @return bool True if the object has been modified. */ - public function isModified() + public function isModified(): bool { return !!$this->modifiedColumns; } @@ -191,10 +199,10 @@ public function isModified() /** * Has specified column been modified? * - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID - * @return boolean True if $col has been modified. + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return bool True if $col has been modified. */ - public function isColumnModified($col) + public function isColumnModified(string $col): bool { return $this->modifiedColumns && isset($this->modifiedColumns[$col]); } @@ -203,7 +211,7 @@ public function isColumnModified($col) * Get the columns that have been modified in this object. * @return array A unique list of the modified column names for this object. */ - public function getModifiedColumns() + public function getModifiedColumns(): array { return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; } @@ -213,9 +221,9 @@ public function getModifiedColumns() * be false, if the object was retrieved from storage or was created * and then saved. * - * @return boolean true, if the object has never been persisted. + * @return bool True, if the object has never been persisted. */ - public function isNew() + public function isNew(): bool { return $this->new; } @@ -224,45 +232,43 @@ public function isNew() * Setter for the isNew attribute. This method will be called * by Propel-generated children and objects. * - * @param boolean $b the state of the object. + * @param bool $b the state of the object. */ - public function setNew($b) + public function setNew(bool $b): void { - $this->new = (boolean) $b; + $this->new = $b; } /** * Whether this object has been deleted. - * @return boolean The deleted state of this object. + * @return bool The deleted state of this object. */ - public function isDeleted() + public function isDeleted(): bool { return $this->deleted; } /** * Specify whether this object has been deleted. - * @param boolean $b The deleted state of this object. + * @param bool $b The deleted state of this object. * @return void */ - public function setDeleted($b) + public function setDeleted(bool $b): void { - $this->deleted = (boolean) $b; + $this->deleted = $b; } /** * Sets the modified state for the object to be false. - * @param string $col If supplied, only the specified column is reset. + * @param string $col If supplied, only the specified column is reset. * @return void */ - public function resetModified($col = null) + public function resetModified(?string $col = null): void { if (null !== $col) { - if (isset($this->modifiedColumns[$col])) { - unset($this->modifiedColumns[$col]); - } + unset($this->modifiedColumns[$col]); } else { - $this->modifiedColumns = array(); + $this->modifiedColumns = []; } } @@ -271,10 +277,10 @@ public function resetModified($col = null) * obj is an instance of UserRole, delegates to * equals(UserRole). Otherwise, returns false. * - * @param mixed $obj The object to compare to. - * @return boolean Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return bool Whether equal to the object specified. */ - public function equals($obj) + public function equals($obj): bool { if (!$obj instanceof static) { return false; @@ -296,7 +302,7 @@ public function equals($obj) * * @return array */ - public function getVirtualColumns() + public function getVirtualColumns(): array { return $this->virtualColumns; } @@ -304,10 +310,10 @@ public function getVirtualColumns() /** * Checks the existence of a virtual column in this object * - * @param string $name The virtual column name - * @return boolean + * @param string $name The virtual column name + * @return bool */ - public function hasVirtualColumn($name) + public function hasVirtualColumn(string $name): bool { return array_key_exists($name, $this->virtualColumns); } @@ -315,15 +321,15 @@ public function hasVirtualColumn($name) /** * Get the value of a virtual column in this object * - * @param string $name The virtual column name + * @param string $name The virtual column name * @return mixed * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getVirtualColumn($name) + public function getVirtualColumn(string $name) { if (!$this->hasVirtualColumn($name)) { - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + throw new PropelException(sprintf('Cannot get value of nonexistent virtual column `%s`.', $name)); } return $this->virtualColumns[$name]; @@ -332,12 +338,12 @@ public function getVirtualColumn($name) /** * Set the value of a virtual column in this object * - * @param string $name The virtual column name - * @param mixed $value The value to give to the virtual column + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column * - * @return $this|UserRole The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function setVirtualColumn($name, $value) + public function setVirtualColumn(string $name, $value) { $this->virtualColumns[$name] = $value; @@ -347,13 +353,13 @@ public function setVirtualColumn($name, $value) /** * Logs a message using Propel::log(). * - * @param string $msg - * @param int $priority One of the Propel::LOG_* logging levels - * @return boolean + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return void */ - protected function log($msg, $priority = Propel::LOG_INFO) + protected function log(string $msg, int $priority = Propel::LOG_INFO): void { - return Propel::log(get_class($this) . ': ' . $msg, $priority); + Propel::log(get_class($this) . ': ' . $msg, $priority); } /** @@ -364,24 +370,27 @@ protected function log($msg, $priority = Propel::LOG_INFO) * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * * - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. - * @return string The exported data + * @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. + * @return string The exported data */ - public function exportTo($parser, $includeLazyLoadColumns = true) + public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME): string { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); } - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, array(), true)); } /** * Clean up internal collections prior to serializing * Avoids recursive loops that turn into segmentation faults when serializing + * + * @return array */ - public function __sleep() + public function __sleep(): array { $this->clearAllReferences(); @@ -389,7 +398,7 @@ public function __sleep() $propertyNames = []; $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); - foreach ($serializableProperties as $property) { + foreach($serializableProperties as $property) { $propertyNames[] = $property->getName(); } @@ -449,8 +458,8 @@ public function isReserve() /** * Set the value of [id] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setId($v) { @@ -464,13 +473,13 @@ public function setId($v) } return $this; - } // setId() + } /** * Set the value of [userid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setUserId($v) { @@ -488,13 +497,13 @@ public function setUserId($v) } return $this; - } // setUserId() + } /** * Set the value of [roleid] column. * - * @param int $v new value - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param int $v New value + * @return $this The current object (for fluent API support) */ public function setRoleId($v) { @@ -512,7 +521,7 @@ public function setRoleId($v) } return $this; - } // setRoleId() + } /** * Sets the value of the [reserve] column. @@ -521,8 +530,8 @@ public function setRoleId($v) * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). * - * @param boolean|integer|string $v The new value - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param bool|integer|string $v The new value + * @return $this The current object (for fluent API support) */ public function setReserve($v) { @@ -540,7 +549,7 @@ public function setReserve($v) } return $this; - } // setReserve() + } /** * Indicates whether the columns in this object are only set to default values. @@ -548,25 +557,25 @@ public function setReserve($v) * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * - * @return boolean Whether the columns in this object are only been set with default values. + * @return bool Whether the columns in this object are only been set with default values. */ - public function hasOnlyDefaultValues() + public function hasOnlyDefaultValues(): bool { - if ($this->userid !== 0) { - return false; - } + if ($this->userid !== 0) { + return false; + } - if ($this->roleid !== 0) { - return false; - } + if ($this->roleid !== 0) { + return false; + } - if ($this->reserve !== false) { - return false; - } + if ($this->reserve !== false) { + return false; + } // otherwise, everything was equal, so return TRUE return true; - } // hasOnlyDefaultValues() + } /** * Hydrates (populates) the object variables with values from the database resultset. @@ -576,19 +585,20 @@ public function hasOnlyDefaultValues() * for results of JOIN queries where the resultset row includes columns from two or * more tables. * - * @param array $row The row returned by DataFetcher->fetch(). - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param bool $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + * @return int next starting column + * @throws \Propel\Runtime\Exception\PropelException - Any caught Exception will be rewrapped as a PropelException. */ - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + public function hydrate(array $row, int $startcol = 0, bool $rehydrate = false, string $indexType = TableMap::TYPE_NUM): int { try { + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : UserRoleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; @@ -600,8 +610,8 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : UserRoleTableMap::translateFieldName('Reserve', TableMap::TYPE_PHPNAME, $indexType)]; $this->reserve = (null !== $col) ? (boolean) $col : null; - $this->resetModified(); + $this->resetModified(); $this->setNew(false); if ($rehydrate) { @@ -609,6 +619,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta } return $startcol + 4; // 4 = UserRoleTableMap::NUM_HYDRATE_COLUMNS. + } catch (Exception $e) { throw new PropelException(sprintf('Error populating %s object', '\\TechWilk\\Rota\\UserRole'), 0, $e); } @@ -625,9 +636,10 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function ensureConsistency() + public function ensureConsistency(): void { if ($this->aUser !== null && $this->userid !== $this->aUser->getId()) { $this->aUser = null; @@ -635,19 +647,19 @@ public function ensureConsistency() if ($this->aRole !== null && $this->roleid !== $this->aRole->getId()) { $this->aRole = null; } - } // ensureConsistency + } /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @param bool $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + * @throws \Propel\Runtime\Exception\PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ - public function reload($deep = false, ConnectionInterface $con = null) + public function reload(bool $deep = false, ?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); @@ -681,19 +693,20 @@ public function reload($deep = false, ConnectionInterface $con = null) $this->collSwapsRelatedByOldUserRoleId = null; $this->collSwapsRelatedByNewUserRoleId = null; + } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see UserRole::setDeleted() * @see UserRole::isDeleted() */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): void { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); @@ -723,12 +736,12 @@ public function delete(ConnectionInterface $con = null) * method. This method wraps all precipitate database operations in a * single transaction. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - public function save(ConnectionInterface $con = null) + public function save(?ConnectionInterface $con = null): int { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); @@ -773,12 +786,12 @@ public function save(ConnectionInterface $con = null) * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * - * @param ConnectionInterface $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws \Propel\Runtime\Exception\PropelException * @see save() */ - protected function doSave(ConnectionInterface $con) + protected function doSave(ConnectionInterface $con): int { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { @@ -866,22 +879,23 @@ protected function doSave(ConnectionInterface $con) } $this->alreadyInSave = false; + } return $affectedRows; - } // doSave() + } /** * Insert the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException * @see doSave() */ - protected function doInsert(ConnectionInterface $con) + protected function doInsert(ConnectionInterface $con): void { - $modifiedColumns = array(); + $modifiedColumns = []; $index = 0; $this->modifiedColumns[UserRoleTableMap::COL_ID] = true; @@ -915,15 +929,19 @@ protected function doInsert(ConnectionInterface $con) switch ($columnName) { case 'id': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case 'userId': $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); + break; case 'roleId': $stmt->bindValue($identifier, $this->roleid, PDO::PARAM_INT); + break; case 'reserve': $stmt->bindValue($identifier, (int) $this->reserve, PDO::PARAM_INT); + break; } } @@ -946,12 +964,12 @@ protected function doInsert(ConnectionInterface $con) /** * Update the row in the database. * - * @param ConnectionInterface $con + * @param ConnectionInterface $con * - * @return Integer Number of updated rows + * @return int Number of updated rows * @see doSave() */ - protected function doUpdate(ConnectionInterface $con) + protected function doUpdate(ConnectionInterface $con): int { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); @@ -962,14 +980,14 @@ protected function doUpdate(ConnectionInterface $con) /** * Retrieves a field from the object by name passed in as a string. * - * @param string $name name - * @param string $type The type of fieldname the $name is of: + * @param string $name name + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @return mixed Value of field. */ - public function getByName($name, $type = TableMap::TYPE_PHPNAME) + public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME) { $pos = UserRoleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); @@ -981,27 +999,26 @@ public function getByName($name, $type = TableMap::TYPE_PHPNAME) * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema + * @param int $pos Position in XML schema * @return mixed Value of field at $pos */ - public function getByPosition($pos) + public function getByPosition(int $pos) { switch ($pos) { case 0: return $this->getId(); - break; + case 1: return $this->getUserId(); - break; + case 2: return $this->getRoleId(); - break; + case 3: return $this->getReserve(); - break; + default: return null; - break; } // switch() } @@ -1011,28 +1028,28 @@ public function getByPosition($pos) * You can specify the key type of the array by passing one of the class * type constants. * - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * @param bool $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param bool $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * - * @return array an associative array containing the field names (as keys) and field values + * @return array An associative array containing the field names (as keys) and field values */ - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + public function toArray(string $keyType = TableMap::TYPE_PHPNAME, bool $includeLazyLoadColumns = true, array $alreadyDumpedObjects = [], bool $includeForeignObjects = false): array { if (isset($alreadyDumpedObjects['UserRole'][$this->hashCode()])) { - return '*RECURSION*'; + return ['*RECURSION*']; } $alreadyDumpedObjects['UserRole'][$this->hashCode()] = true; $keys = UserRoleTableMap::getFieldNames($keyType); - $result = array( + $result = [ $keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getRoleId(), $keys[3] => $this->getReserve(), - ); + ]; $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; @@ -1040,6 +1057,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum if ($includeForeignObjects) { if (null !== $this->aUser) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'user'; @@ -1051,9 +1069,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'User'; } - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aRole) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'role'; @@ -1065,9 +1084,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $key = 'Role'; } - $result[$key] = $this->aRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $result[$key] = $this->aRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collEventpeople) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'eventpeople'; @@ -1082,6 +1102,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collEventpeople->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collSwapsRelatedByOldUserRoleId) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'swaps'; @@ -1096,6 +1117,7 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result[$key] = $this->collSwapsRelatedByOldUserRoleId->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collSwapsRelatedByNewUserRoleId) { + switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'swaps'; @@ -1117,30 +1139,32 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum /** * Sets a field from the object by name passed in as a string. * - * @param string $name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. - * @return $this|\TechWilk\Rota\UserRole + * @return $this */ - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + public function setByName(string $name, $value, string $type = TableMap::TYPE_PHPNAME) { $pos = UserRoleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); - return $this->setByPosition($pos, $value); + $this->setByPosition($pos, $value); + + return $this; } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return $this|\TechWilk\Rota\UserRole + * @param int $pos position in xml schema + * @param mixed $value field value + * @return $this */ - public function setByPosition($pos, $value) + public function setByPosition(int $pos, $value) { switch ($pos) { case 0: @@ -1173,11 +1197,11 @@ public function setByPosition($pos, $value) * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * The default key type is the column's TableMap::TYPE_PHPNAME. * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return $this */ - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME) { $keys = UserRoleTableMap::getFieldNames($keyType); @@ -1193,6 +1217,8 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[3], $arr)) { $this->setReserve($arr[$keys[3]]); } + + return $this; } /** @@ -1212,9 +1238,9 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) * @param string $data The source data to import from * @param string $keyType The type of keys the array uses. * - * @return $this|\TechWilk\Rota\UserRole The current object, for fluid interface + * @return $this The current object, for fluid interface */ - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) + public function importFrom($parser, string $data, string $keyType = TableMap::TYPE_PHPNAME) { if (!$parser instanceof AbstractParser) { $parser = AbstractParser::getParser($parser); @@ -1228,9 +1254,9 @@ public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) /** * Build a Criteria object containing the values of all modified columns in this object. * - * @return Criteria The Criteria object containing all modified values. + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values. */ - public function buildCriteria() + public function buildCriteria(): Criteria { $criteria = new Criteria(UserRoleTableMap::DATABASE_NAME); @@ -1254,13 +1280,13 @@ public function buildCriteria() * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. + * of whether they have been modified. * * @throws LogicException if no primary key is defined * - * @return Criteria The Criteria object containing value(s) for primary key(s). + * @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s). */ - public function buildPkeyCriteria() + public function buildPkeyCriteria(): Criteria { $criteria = ChildUserRoleQuery::create(); $criteria->add(UserRoleTableMap::COL_ID, $this->id); @@ -1272,7 +1298,7 @@ public function buildPkeyCriteria() * If the primary key is not null, return the hashcode of the * primary key. Otherwise, return the hash code of the object. * - * @return int Hashcode + * @return int|string Hashcode */ public function hashCode() { @@ -1302,19 +1328,20 @@ public function getPrimaryKey() /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param int|null $key Primary key. * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey(?int $key = null): void { $this->setId($key); } /** * Returns true if the primary key for this object is null. - * @return boolean + * + * @return bool */ - public function isPrimaryKeyNull() + public function isPrimaryKeyNull(): bool { return null === $this->getId(); } @@ -1325,12 +1352,13 @@ public function isPrimaryKeyNull() * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \TechWilk\Rota\UserRole (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException + * @param object $copyObj An object of \TechWilk\Rota\UserRole (or compatible) type. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws \Propel\Runtime\Exception\PropelException + * @return void */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true): void { $copyObj->setUserId($this->getUserId()); $copyObj->setRoleId($this->getRoleId()); @@ -1358,11 +1386,12 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) $copyObj->addSwapRelatedByNewUserRoleId($relObj->copy($deepCopy)); } } + } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(null); // this is a auto-increment column, so set to default value + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1374,11 +1403,11 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return \TechWilk\Rota\UserRole Clone of current object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function copy($deepCopy = false) + public function copy(bool $deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); @@ -1391,9 +1420,9 @@ public function copy($deepCopy = false) /** * Declares an association between this object and a ChildUser object. * - * @param ChildUser $v - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) - * @throws PropelException + * @param ChildUser $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setUser(ChildUser $v = null) { @@ -1419,11 +1448,11 @@ public function setUser(ChildUser $v = null) /** * Get the associated ChildUser object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildUser The associated ChildUser object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getUser(ConnectionInterface $con = null) + public function getUser(?ConnectionInterface $con = null) { if ($this->aUser === null && ($this->userid != 0)) { $this->aUser = ChildUserQuery::create()->findPk($this->userid, $con); @@ -1442,9 +1471,9 @@ public function getUser(ConnectionInterface $con = null) /** * Declares an association between this object and a ChildRole object. * - * @param ChildRole $v - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) - * @throws PropelException + * @param ChildRole $v + * @return $this The current object (for fluent API support) + * @throws \Propel\Runtime\Exception\PropelException */ public function setRole(ChildRole $v = null) { @@ -1470,11 +1499,11 @@ public function setRole(ChildRole $v = null) /** * Get the associated ChildRole object * - * @param ConnectionInterface $con Optional Connection object. + * @param ConnectionInterface $con Optional Connection object. * @return ChildRole The associated ChildRole object. - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function getRole(ConnectionInterface $con = null) + public function getRole(?ConnectionInterface $con = null) { if ($this->aRole === null && ($this->roleid != 0)) { $this->aRole = ChildRoleQuery::create()->findPk($this->roleid, $con); @@ -1496,20 +1525,20 @@ public function getRole(ConnectionInterface $con = null) * Avoids crafting an 'init[$relationName]s' method name * that wouldn't work when StandardEnglishPluralizer is used. * - * @param string $relationName The name of the relation to initialize + * @param string $relationName The name of the relation to initialize * @return void */ - public function initRelation($relationName) + public function initRelation($relationName): void { - if ('EventPerson' == $relationName) { + if ('EventPerson' === $relationName) { $this->initEventpeople(); return; } - if ('SwapRelatedByOldUserRoleId' == $relationName) { + if ('SwapRelatedByOldUserRoleId' === $relationName) { $this->initSwapsRelatedByOldUserRoleId(); return; } - if ('SwapRelatedByNewUserRoleId' == $relationName) { + if ('SwapRelatedByNewUserRoleId' === $relationName) { $this->initSwapsRelatedByNewUserRoleId(); return; } @@ -1521,18 +1550,22 @@ public function initRelation($relationName) * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addEventpeople() + * @return $this + * @see addEventpeople() */ public function clearEventpeople() { $this->collEventpeople = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collEventpeople collection loaded partially. + * + * @return void */ - public function resetPartialEventpeople($v = true) + public function resetPartialEventpeople($v = true): void { $this->collEventpeoplePartial = $v; } @@ -1544,12 +1577,12 @@ public function resetPartialEventpeople($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initEventpeople($overrideExisting = true) + public function initEventpeople(bool $overrideExisting = true): void { if (null !== $this->collEventpeople && !$overrideExisting) { return; @@ -1570,18 +1603,28 @@ public function initEventpeople($overrideExisting = true) * If this ChildUserRole is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildEventPerson[] List of ChildEventPerson objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildEventPerson objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getEventpeople(Criteria $criteria = null, ConnectionInterface $con = null) + public function getEventpeople(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collEventpeoplePartial && !$this->isNew(); - if (null === $this->collEventpeople || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collEventpeople) { + if (null === $this->collEventpeople || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initEventpeople(); + if (null === $this->collEventpeople) { + $this->initEventpeople(); + } else { + $collectionClassName = EventPersonTableMap::getTableMap()->getCollectionClassName(); + + $collEventpeople = new $collectionClassName; + $collEventpeople->setModel('\TechWilk\Rota\EventPerson'); + + return $collEventpeople; + } } else { $collEventpeople = ChildEventPersonQuery::create(null, $criteria) ->filterByUserRole($this) @@ -1625,11 +1668,11 @@ public function getEventpeople(Criteria $criteria = null, ConnectionInterface $c * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $eventpeople A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUserRole The current object (for fluent API support) + * @param Collection $eventpeople A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setEventpeople(Collection $eventpeople, ConnectionInterface $con = null) + public function setEventpeople(Collection $eventpeople, ?ConnectionInterface $con = null) { /** @var ChildEventPerson[] $eventpeopleToDelete */ $eventpeopleToDelete = $this->getEventpeople(new Criteria(), $con)->diff($eventpeople); @@ -1655,13 +1698,13 @@ public function setEventpeople(Collection $eventpeople, ConnectionInterface $con /** * Returns the number of related EventPerson objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related EventPerson objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related EventPerson objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countEventpeople(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countEventpeople(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collEventpeoplePartial && !$this->isNew(); if (null === $this->collEventpeople || null !== $criteria || $partial) { @@ -1690,8 +1733,8 @@ public function countEventpeople(Criteria $criteria = null, $distinct = false, C * Method called to associate a ChildEventPerson object to this object * through the ChildEventPerson foreign key attribute. * - * @param ChildEventPerson $l ChildEventPerson - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param ChildEventPerson $l ChildEventPerson + * @return $this The current object (for fluent API support) */ public function addEventPerson(ChildEventPerson $l) { @@ -1714,15 +1757,15 @@ public function addEventPerson(ChildEventPerson $l) /** * @param ChildEventPerson $eventPerson The ChildEventPerson object to add. */ - protected function doAddEventPerson(ChildEventPerson $eventPerson) + protected function doAddEventPerson(ChildEventPerson $eventPerson): void { $this->collEventpeople[]= $eventPerson; $eventPerson->setUserRole($this); } /** - * @param ChildEventPerson $eventPerson The ChildEventPerson object to remove. - * @return $this|ChildUserRole The current object (for fluent API support) + * @param ChildEventPerson $eventPerson The ChildEventPerson object to remove. + * @return $this The current object (for fluent API support) */ public function removeEventPerson(ChildEventPerson $eventPerson) { @@ -1752,12 +1795,13 @@ public function removeEventPerson(ChildEventPerson $eventPerson) * api reasonable. You can provide public methods for those you * actually need in UserRole. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildEventPerson[] List of ChildEventPerson objects + * @phpstan-return ObjectCollection&\Traversable List of ChildEventPerson objects */ - public function getEventpeopleJoinEvent(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getEventpeopleJoinEvent(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildEventPersonQuery::create(null, $criteria); $query->joinWith('Event', $joinBehavior); @@ -1771,18 +1815,22 @@ public function getEventpeopleJoinEvent(Criteria $criteria = null, ConnectionInt * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addSwapsRelatedByOldUserRoleId() + * @return $this + * @see addSwapsRelatedByOldUserRoleId() */ public function clearSwapsRelatedByOldUserRoleId() { $this->collSwapsRelatedByOldUserRoleId = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collSwapsRelatedByOldUserRoleId collection loaded partially. + * + * @return void */ - public function resetPartialSwapsRelatedByOldUserRoleId($v = true) + public function resetPartialSwapsRelatedByOldUserRoleId($v = true): void { $this->collSwapsRelatedByOldUserRoleIdPartial = $v; } @@ -1794,12 +1842,12 @@ public function resetPartialSwapsRelatedByOldUserRoleId($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initSwapsRelatedByOldUserRoleId($overrideExisting = true) + public function initSwapsRelatedByOldUserRoleId(bool $overrideExisting = true): void { if (null !== $this->collSwapsRelatedByOldUserRoleId && !$overrideExisting) { return; @@ -1820,18 +1868,28 @@ public function initSwapsRelatedByOldUserRoleId($overrideExisting = true) * If this ChildUserRole is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildSwap[] List of ChildSwap objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getSwapsRelatedByOldUserRoleId(Criteria $criteria = null, ConnectionInterface $con = null) + public function getSwapsRelatedByOldUserRoleId(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collSwapsRelatedByOldUserRoleIdPartial && !$this->isNew(); - if (null === $this->collSwapsRelatedByOldUserRoleId || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collSwapsRelatedByOldUserRoleId) { + if (null === $this->collSwapsRelatedByOldUserRoleId || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initSwapsRelatedByOldUserRoleId(); + if (null === $this->collSwapsRelatedByOldUserRoleId) { + $this->initSwapsRelatedByOldUserRoleId(); + } else { + $collectionClassName = SwapTableMap::getTableMap()->getCollectionClassName(); + + $collSwapsRelatedByOldUserRoleId = new $collectionClassName; + $collSwapsRelatedByOldUserRoleId->setModel('\TechWilk\Rota\Swap'); + + return $collSwapsRelatedByOldUserRoleId; + } } else { $collSwapsRelatedByOldUserRoleId = ChildSwapQuery::create(null, $criteria) ->filterByOldUserRole($this) @@ -1875,11 +1933,11 @@ public function getSwapsRelatedByOldUserRoleId(Criteria $criteria = null, Connec * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $swapsRelatedByOldUserRoleId A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUserRole The current object (for fluent API support) + * @param Collection $swapsRelatedByOldUserRoleId A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setSwapsRelatedByOldUserRoleId(Collection $swapsRelatedByOldUserRoleId, ConnectionInterface $con = null) + public function setSwapsRelatedByOldUserRoleId(Collection $swapsRelatedByOldUserRoleId, ?ConnectionInterface $con = null) { /** @var ChildSwap[] $swapsRelatedByOldUserRoleIdToDelete */ $swapsRelatedByOldUserRoleIdToDelete = $this->getSwapsRelatedByOldUserRoleId(new Criteria(), $con)->diff($swapsRelatedByOldUserRoleId); @@ -1905,13 +1963,13 @@ public function setSwapsRelatedByOldUserRoleId(Collection $swapsRelatedByOldUser /** * Returns the number of related Swap objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Swap objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Swap objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countSwapsRelatedByOldUserRoleId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countSwapsRelatedByOldUserRoleId(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collSwapsRelatedByOldUserRoleIdPartial && !$this->isNew(); if (null === $this->collSwapsRelatedByOldUserRoleId || null !== $criteria || $partial) { @@ -1940,8 +1998,8 @@ public function countSwapsRelatedByOldUserRoleId(Criteria $criteria = null, $dis * Method called to associate a ChildSwap object to this object * through the ChildSwap foreign key attribute. * - * @param ChildSwap $l ChildSwap - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param ChildSwap $l ChildSwap + * @return $this The current object (for fluent API support) */ public function addSwapRelatedByOldUserRoleId(ChildSwap $l) { @@ -1964,15 +2022,15 @@ public function addSwapRelatedByOldUserRoleId(ChildSwap $l) /** * @param ChildSwap $swapRelatedByOldUserRoleId The ChildSwap object to add. */ - protected function doAddSwapRelatedByOldUserRoleId(ChildSwap $swapRelatedByOldUserRoleId) + protected function doAddSwapRelatedByOldUserRoleId(ChildSwap $swapRelatedByOldUserRoleId): void { $this->collSwapsRelatedByOldUserRoleId[]= $swapRelatedByOldUserRoleId; $swapRelatedByOldUserRoleId->setOldUserRole($this); } /** - * @param ChildSwap $swapRelatedByOldUserRoleId The ChildSwap object to remove. - * @return $this|ChildUserRole The current object (for fluent API support) + * @param ChildSwap $swapRelatedByOldUserRoleId The ChildSwap object to remove. + * @return $this The current object (for fluent API support) */ public function removeSwapRelatedByOldUserRoleId(ChildSwap $swapRelatedByOldUserRoleId) { @@ -2002,12 +2060,13 @@ public function removeSwapRelatedByOldUserRoleId(ChildSwap $swapRelatedByOldUser * api reasonable. You can provide public methods for those you * actually need in UserRole. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsRelatedByOldUserRoleIdJoinEventPerson(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsRelatedByOldUserRoleIdJoinEventPerson(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('EventPerson', $joinBehavior); @@ -2027,12 +2086,13 @@ public function getSwapsRelatedByOldUserRoleIdJoinEventPerson(Criteria $criteria * api reasonable. You can provide public methods for those you * actually need in UserRole. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsRelatedByOldUserRoleIdJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsRelatedByOldUserRoleIdJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -2046,18 +2106,22 @@ public function getSwapsRelatedByOldUserRoleIdJoinUser(Criteria $criteria = null * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * - * @return void - * @see addSwapsRelatedByNewUserRoleId() + * @return $this + * @see addSwapsRelatedByNewUserRoleId() */ public function clearSwapsRelatedByNewUserRoleId() { $this->collSwapsRelatedByNewUserRoleId = null; // important to set this to NULL since that means it is uninitialized + + return $this; } /** * Reset is the collSwapsRelatedByNewUserRoleId collection loaded partially. + * + * @return void */ - public function resetPartialSwapsRelatedByNewUserRoleId($v = true) + public function resetPartialSwapsRelatedByNewUserRoleId($v = true): void { $this->collSwapsRelatedByNewUserRoleIdPartial = $v; } @@ -2069,12 +2133,12 @@ public function resetPartialSwapsRelatedByNewUserRoleId($v = true) * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * - * @param boolean $overrideExisting If set to true, the method call initializes + * @param bool $overrideExisting If set to true, the method call initializes * the collection even if it is not empty * * @return void */ - public function initSwapsRelatedByNewUserRoleId($overrideExisting = true) + public function initSwapsRelatedByNewUserRoleId(bool $overrideExisting = true): void { if (null !== $this->collSwapsRelatedByNewUserRoleId && !$overrideExisting) { return; @@ -2095,18 +2159,28 @@ public function initSwapsRelatedByNewUserRoleId($overrideExisting = true) * If this ChildUserRole is new, it will return * an empty collection or the current collection; the criteria is ignored on a new object. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object * @return ObjectCollection|ChildSwap[] List of ChildSwap objects - * @throws PropelException + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects + * @throws \Propel\Runtime\Exception\PropelException */ - public function getSwapsRelatedByNewUserRoleId(Criteria $criteria = null, ConnectionInterface $con = null) + public function getSwapsRelatedByNewUserRoleId(?Criteria $criteria = null, ?ConnectionInterface $con = null) { $partial = $this->collSwapsRelatedByNewUserRoleIdPartial && !$this->isNew(); - if (null === $this->collSwapsRelatedByNewUserRoleId || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collSwapsRelatedByNewUserRoleId) { + if (null === $this->collSwapsRelatedByNewUserRoleId || null !== $criteria || $partial) { + if ($this->isNew()) { // return empty collection - $this->initSwapsRelatedByNewUserRoleId(); + if (null === $this->collSwapsRelatedByNewUserRoleId) { + $this->initSwapsRelatedByNewUserRoleId(); + } else { + $collectionClassName = SwapTableMap::getTableMap()->getCollectionClassName(); + + $collSwapsRelatedByNewUserRoleId = new $collectionClassName; + $collSwapsRelatedByNewUserRoleId->setModel('\TechWilk\Rota\Swap'); + + return $collSwapsRelatedByNewUserRoleId; + } } else { $collSwapsRelatedByNewUserRoleId = ChildSwapQuery::create(null, $criteria) ->filterByNewUserRole($this) @@ -2150,11 +2224,11 @@ public function getSwapsRelatedByNewUserRoleId(Criteria $criteria = null, Connec * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $swapsRelatedByNewUserRoleId A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return $this|ChildUserRole The current object (for fluent API support) + * @param Collection $swapsRelatedByNewUserRoleId A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return $this The current object (for fluent API support) */ - public function setSwapsRelatedByNewUserRoleId(Collection $swapsRelatedByNewUserRoleId, ConnectionInterface $con = null) + public function setSwapsRelatedByNewUserRoleId(Collection $swapsRelatedByNewUserRoleId, ?ConnectionInterface $con = null) { /** @var ChildSwap[] $swapsRelatedByNewUserRoleIdToDelete */ $swapsRelatedByNewUserRoleIdToDelete = $this->getSwapsRelatedByNewUserRoleId(new Criteria(), $con)->diff($swapsRelatedByNewUserRoleId); @@ -2180,13 +2254,13 @@ public function setSwapsRelatedByNewUserRoleId(Collection $swapsRelatedByNewUser /** * Returns the number of related Swap objects. * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Swap objects. - * @throws PropelException + * @param Criteria $criteria + * @param bool $distinct + * @param ConnectionInterface $con + * @return int Count of related Swap objects. + * @throws \Propel\Runtime\Exception\PropelException */ - public function countSwapsRelatedByNewUserRoleId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countSwapsRelatedByNewUserRoleId(?Criteria $criteria = null, bool $distinct = false, ?ConnectionInterface $con = null): int { $partial = $this->collSwapsRelatedByNewUserRoleIdPartial && !$this->isNew(); if (null === $this->collSwapsRelatedByNewUserRoleId || null !== $criteria || $partial) { @@ -2215,8 +2289,8 @@ public function countSwapsRelatedByNewUserRoleId(Criteria $criteria = null, $dis * Method called to associate a ChildSwap object to this object * through the ChildSwap foreign key attribute. * - * @param ChildSwap $l ChildSwap - * @return $this|\TechWilk\Rota\UserRole The current object (for fluent API support) + * @param ChildSwap $l ChildSwap + * @return $this The current object (for fluent API support) */ public function addSwapRelatedByNewUserRoleId(ChildSwap $l) { @@ -2239,15 +2313,15 @@ public function addSwapRelatedByNewUserRoleId(ChildSwap $l) /** * @param ChildSwap $swapRelatedByNewUserRoleId The ChildSwap object to add. */ - protected function doAddSwapRelatedByNewUserRoleId(ChildSwap $swapRelatedByNewUserRoleId) + protected function doAddSwapRelatedByNewUserRoleId(ChildSwap $swapRelatedByNewUserRoleId): void { $this->collSwapsRelatedByNewUserRoleId[]= $swapRelatedByNewUserRoleId; $swapRelatedByNewUserRoleId->setNewUserRole($this); } /** - * @param ChildSwap $swapRelatedByNewUserRoleId The ChildSwap object to remove. - * @return $this|ChildUserRole The current object (for fluent API support) + * @param ChildSwap $swapRelatedByNewUserRoleId The ChildSwap object to remove. + * @return $this The current object (for fluent API support) */ public function removeSwapRelatedByNewUserRoleId(ChildSwap $swapRelatedByNewUserRoleId) { @@ -2277,12 +2351,13 @@ public function removeSwapRelatedByNewUserRoleId(ChildSwap $swapRelatedByNewUser * api reasonable. You can provide public methods for those you * actually need in UserRole. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsRelatedByNewUserRoleIdJoinEventPerson(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsRelatedByNewUserRoleIdJoinEventPerson(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('EventPerson', $joinBehavior); @@ -2302,12 +2377,13 @@ public function getSwapsRelatedByNewUserRoleIdJoinEventPerson(Criteria $criteria * api reasonable. You can provide public methods for those you * actually need in UserRole. * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return ObjectCollection|ChildSwap[] List of ChildSwap objects + * @phpstan-return ObjectCollection&\Traversable List of ChildSwap objects */ - public function getSwapsRelatedByNewUserRoleIdJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) + public function getSwapsRelatedByNewUserRoleIdJoinUser(?Criteria $criteria = null, ?ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSwapQuery::create(null, $criteria); $query->joinWith('User', $joinBehavior); @@ -2319,6 +2395,8 @@ public function getSwapsRelatedByNewUserRoleIdJoinUser(Criteria $criteria = null * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). + * + * @return $this */ public function clear() { @@ -2338,6 +2416,8 @@ public function clear() $this->resetModified(); $this->setNew(true); $this->setDeleted(false); + + return $this; } /** @@ -2346,9 +2426,10 @@ public function clear() * This method is used to reset all php object references (not the actual reference in the database). * Necessary for object serialisation. * - * @param boolean $deep Whether to also clear the references on all referrer objects. + * @param bool $deep Whether to also clear the references on all referrer objects. + * @return $this */ - public function clearAllReferences($deep = false) + public function clearAllReferences(bool $deep = false) { if ($deep) { if ($this->collEventpeople) { @@ -2373,6 +2454,7 @@ public function clearAllReferences($deep = false) $this->collSwapsRelatedByNewUserRoleId = null; $this->aUser = null; $this->aRole = null; + return $this; } /** @@ -2387,99 +2469,79 @@ public function __toString() /** * Code to be run before persisting the object - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preSave(ConnectionInterface $con = null) + public function preSave(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preSave')) { - return parent::preSave($con); - } - return true; + return true; } /** * Code to be run after persisting the object - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postSave(ConnectionInterface $con = null) + public function postSave(?ConnectionInterface $con = null): void { - if (is_callable('parent::postSave')) { - parent::postSave($con); - } - } + } /** * Code to be run before inserting to database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preInsert(ConnectionInterface $con = null) + public function preInsert(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preInsert')) { - return parent::preInsert($con); - } - return true; + return true; } /** * Code to be run after inserting to database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postInsert(ConnectionInterface $con = null) + public function postInsert(?ConnectionInterface $con = null): void { - if (is_callable('parent::postInsert')) { - parent::postInsert($con); - } - } + } /** * Code to be run before updating the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preUpdate(ConnectionInterface $con = null) + public function preUpdate(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preUpdate')) { - return parent::preUpdate($con); - } - return true; + return true; } /** * Code to be run after updating the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postUpdate(ConnectionInterface $con = null) + public function postUpdate(?ConnectionInterface $con = null): void { - if (is_callable('parent::postUpdate')) { - parent::postUpdate($con); - } - } + } /** * Code to be run before deleting the object in database - * @param ConnectionInterface $con - * @return boolean + * @param ConnectionInterface|null $con + * @return bool */ - public function preDelete(ConnectionInterface $con = null) + public function preDelete(?ConnectionInterface $con = null): bool { - if (is_callable('parent::preDelete')) { - return parent::preDelete($con); - } - return true; + return true; } /** * Code to be run after deleting the object in database - * @param ConnectionInterface $con + * @param ConnectionInterface|null $con + * @return void */ - public function postDelete(ConnectionInterface $con = null) + public function postDelete(?ConnectionInterface $con = null): void { - if (is_callable('parent::postDelete')) { - parent::postDelete($con); - } - } + } /** @@ -2489,7 +2551,7 @@ public function postDelete(ConnectionInterface $con = null) * Allows to define default __call() behavior if you overwrite __call() * * @param string $name - * @param mixed $params + * @param mixed $params * * @return array|string */ @@ -2509,17 +2571,21 @@ public function __call($name, $params) if (0 === strpos($name, 'from')) { $format = substr($name, 4); + $inputData = $params[0]; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->importFrom($format, reset($params)); + return $this->importFrom($format, $inputData, $keyType); } if (0 === strpos($name, 'to')) { $format = substr($name, 2); - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + $includeLazyLoadColumns = $params[0] ?? true; + $keyType = $params[1] ?? TableMap::TYPE_PHPNAME; - return $this->exportTo($format, $includeLazyLoadColumns); + return $this->exportTo($format, $includeLazyLoadColumns, $keyType); } throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); } + } diff --git a/generated-classes/TechWilk/Rota/Base/UserRoleQuery.php b/generated-classes/TechWilk/Rota/Base/UserRoleQuery.php index b230a312..cda641f1 100644 --- a/generated-classes/TechWilk/Rota/Base/UserRoleQuery.php +++ b/generated-classes/TechWilk/Rota/Base/UserRoleQuery.php @@ -8,6 +8,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; +use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; @@ -16,9 +17,7 @@ use TechWilk\Rota\Map\UserRoleTableMap; /** - * Base class that represents a query for the 'userRoles' table. - * - * + * Base class that represents a query for the `userRoles` table. * * @method ChildUserRoleQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildUserRoleQuery orderByUserId($order = Criteria::ASC) Order by the userId column @@ -88,31 +87,38 @@ * @method ChildUserRoleQuery rightJoinWithSwapRelatedByNewUserRoleId() Adds a RIGHT JOIN clause and with to the query using the SwapRelatedByNewUserRoleId relation * @method ChildUserRoleQuery innerJoinWithSwapRelatedByNewUserRoleId() Adds a INNER JOIN clause and with to the query using the SwapRelatedByNewUserRoleId relation * - * @method \TechWilk\Rota\UserQuery|\TechWilk\Rota\RoleQuery|\TechWilk\Rota\EventPersonQuery|\TechWilk\Rota\SwapQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria + * @method \TechWilk\Rota\UserQuery|\TechWilk\Rota\RoleQuery|\TechWilk\Rota\EventPersonQuery|\TechWilk\Rota\SwapQuery|\TechWilk\Rota\SwapQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria * - * @method ChildUserRole findOne(ConnectionInterface $con = null) Return the first ChildUserRole matching the query - * @method ChildUserRole findOneOrCreate(ConnectionInterface $con = null) Return the first ChildUserRole matching the query, or a new ChildUserRole object populated from the query conditions when no match is found + * @method ChildUserRole|null findOne(?ConnectionInterface $con = null) Return the first ChildUserRole matching the query + * @method ChildUserRole findOneOrCreate(?ConnectionInterface $con = null) Return the first ChildUserRole matching the query, or a new ChildUserRole object populated from the query conditions when no match is found * - * @method ChildUserRole findOneById(int $id) Return the first ChildUserRole filtered by the id column - * @method ChildUserRole findOneByUserId(int $userId) Return the first ChildUserRole filtered by the userId column - * @method ChildUserRole findOneByRoleId(int $roleId) Return the first ChildUserRole filtered by the roleId column - * @method ChildUserRole findOneByReserve(boolean $reserve) Return the first ChildUserRole filtered by the reserve column * - - * @method ChildUserRole requirePk($key, ConnectionInterface $con = null) Return the ChildUserRole by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found - * @method ChildUserRole requireOne(ConnectionInterface $con = null) Return the first ChildUserRole matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildUserRole|null findOneById(int $id) Return the first ChildUserRole filtered by the id column + * @method ChildUserRole|null findOneByUserId(int $userId) Return the first ChildUserRole filtered by the userId column + * @method ChildUserRole|null findOneByRoleId(int $roleId) Return the first ChildUserRole filtered by the roleId column + * @method ChildUserRole|null findOneByReserve(boolean $reserve) Return the first ChildUserRole filtered by the reserve column + * + * @method ChildUserRole requirePk($key, ?ConnectionInterface $con = null) Return the ChildUserRole by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found + * @method ChildUserRole requireOne(?ConnectionInterface $con = null) Return the first ChildUserRole matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * * @method ChildUserRole requireOneById(int $id) Return the first ChildUserRole filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUserRole requireOneByUserId(int $userId) Return the first ChildUserRole filtered by the userId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUserRole requireOneByRoleId(int $roleId) Return the first ChildUserRole filtered by the roleId column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * @method ChildUserRole requireOneByReserve(boolean $reserve) Return the first ChildUserRole filtered by the reserve column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found * - * @method ChildUserRole[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildUserRole objects based on current ModelCriteria - * @method ChildUserRole[]|ObjectCollection findById(int $id) Return ChildUserRole objects filtered by the id column - * @method ChildUserRole[]|ObjectCollection findByUserId(int $userId) Return ChildUserRole objects filtered by the userId column - * @method ChildUserRole[]|ObjectCollection findByRoleId(int $roleId) Return ChildUserRole objects filtered by the roleId column - * @method ChildUserRole[]|ObjectCollection findByReserve(boolean $reserve) Return ChildUserRole objects filtered by the reserve column - * @method ChildUserRole[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @method ChildUserRole[]|Collection find(?ConnectionInterface $con = null) Return ChildUserRole objects based on current ModelCriteria + * @psalm-method Collection&\Traversable find(?ConnectionInterface $con = null) Return ChildUserRole objects based on current ModelCriteria * + * @method ChildUserRole[]|Collection findById(int|array $id) Return ChildUserRole objects filtered by the id column + * @psalm-method Collection&\Traversable findById(int|array $id) Return ChildUserRole objects filtered by the id column + * @method ChildUserRole[]|Collection findByUserId(int|array $userId) Return ChildUserRole objects filtered by the userId column + * @psalm-method Collection&\Traversable findByUserId(int|array $userId) Return ChildUserRole objects filtered by the userId column + * @method ChildUserRole[]|Collection findByRoleId(int|array $roleId) Return ChildUserRole objects filtered by the roleId column + * @psalm-method Collection&\Traversable findByRoleId(int|array $roleId) Return ChildUserRole objects filtered by the roleId column + * @method ChildUserRole[]|Collection findByReserve(boolean|array $reserve) Return ChildUserRole objects filtered by the reserve column + * @psalm-method Collection&\Traversable findByReserve(boolean|array $reserve) Return ChildUserRole objects filtered by the reserve column + * + * @method ChildUserRole[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit + * @psalm-method \Propel\Runtime\Util\PropelModelPager&\Traversable paginate($page = 1, $maxPerPage = 10, ?ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit */ abstract class UserRoleQuery extends ModelCriteria { @@ -121,9 +127,9 @@ abstract class UserRoleQuery extends ModelCriteria /** * Initializes internal state of \TechWilk\Rota\Base\UserRoleQuery object. * - * @param string $dbName The database name - * @param string $modelName The phpName of a model, e.g. 'Book' - * @param string $modelAlias The alias for the model in this query, e.g. 'b' + * @param string $dbName The database name + * @param string $modelName The phpName of a model, e.g. 'Book' + * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\\UserRole', $modelAlias = null) { @@ -133,12 +139,12 @@ public function __construct($dbName = 'default', $modelName = '\\TechWilk\\Rota\ /** * Returns a new ChildUserRoleQuery object. * - * @param string $modelAlias The alias of a model in the query - * @param Criteria $criteria Optional Criteria to build the query from + * @param string $modelAlias The alias of a model in the query + * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildUserRoleQuery */ - public static function create($modelAlias = null, Criteria $criteria = null) + public static function create(?string $modelAlias = null, ?Criteria $criteria = null): Criteria { if ($criteria instanceof ChildUserRoleQuery) { return $criteria; @@ -168,7 +174,7 @@ public static function create($modelAlias = null, Criteria $criteria = null) * * @return ChildUserRole|array|mixed the result, formatted by the current formatter */ - public function findPk($key, ConnectionInterface $con = null) + public function findPk($key, ?ConnectionInterface $con = null) { if ($key === null) { return null; @@ -200,8 +206,8 @@ public function findPk($key, ConnectionInterface $con = null) * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @throws \Propel\Runtime\Exception\PropelException * @@ -233,8 +239,8 @@ protected function findPkSimple($key, ConnectionInterface $con) /** * Find object by primary key. * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object * * @return ChildUserRole|array|mixed the result, formatted by the current formatter */ @@ -254,12 +260,12 @@ protected function findPkComplex($key, ConnectionInterface $con) * * $objs = $c->findPks(array(12, 56, 832), $con); * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + * @return Collection|array|mixed the list of results, formatted by the current formatter */ - public function findPks($keys, ConnectionInterface $con = null) + public function findPks($keys, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); @@ -276,25 +282,31 @@ public function findPks($keys, ConnectionInterface $con = null) /** * Filter the query by primary key * - * @param mixed $key Primary key to use for the query + * @param mixed $key Primary key to use for the query * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(UserRoleTableMap::COL_ID, $key, Criteria::EQUAL); + + $this->addUsingAlias(UserRoleTableMap::COL_ID, $key, Criteria::EQUAL); + + return $this; } /** * Filter the query by a list of primary keys * - * @param array $keys The list of primary key to use for the query + * @param array|int $keys The list of primary key to use for the query * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(UserRoleTableMap::COL_ID, $keys, Criteria::IN); + + $this->addUsingAlias(UserRoleTableMap::COL_ID, $keys, Criteria::IN); + + return $this; } /** @@ -307,15 +319,15 @@ public function filterByPrimaryKeys($keys) * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @param mixed $id The value to use as filter. + * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterById($id = null, ?string $comparison = null) { if (is_array($id)) { $useMinMax = false; @@ -335,7 +347,9 @@ public function filterById($id = null, $comparison = null) } } - return $this->addUsingAlias(UserRoleTableMap::COL_ID, $id, $comparison); + $this->addUsingAlias(UserRoleTableMap::COL_ID, $id, $comparison); + + return $this; } /** @@ -350,15 +364,15 @@ public function filterById($id = null, $comparison = null) * * @see filterByUser() * - * @param mixed $userId The value to use as filter. + * @param mixed $userId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUserId($userId = null, $comparison = null) + public function filterByUserId($userId = null, ?string $comparison = null) { if (is_array($userId)) { $useMinMax = false; @@ -378,7 +392,9 @@ public function filterByUserId($userId = null, $comparison = null) } } - return $this->addUsingAlias(UserRoleTableMap::COL_USERID, $userId, $comparison); + $this->addUsingAlias(UserRoleTableMap::COL_USERID, $userId, $comparison); + + return $this; } /** @@ -393,15 +409,15 @@ public function filterByUserId($userId = null, $comparison = null) * * @see filterByRole() * - * @param mixed $roleId The value to use as filter. + * @param mixed $roleId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRoleId($roleId = null, $comparison = null) + public function filterByRoleId($roleId = null, ?string $comparison = null) { if (is_array($roleId)) { $useMinMax = false; @@ -421,7 +437,9 @@ public function filterByRoleId($roleId = null, $comparison = null) } } - return $this->addUsingAlias(UserRoleTableMap::COL_ROLEID, $roleId, $comparison); + $this->addUsingAlias(UserRoleTableMap::COL_ROLEID, $roleId, $comparison); + + return $this; } /** @@ -433,35 +451,37 @@ public function filterByRoleId($roleId = null, $comparison = null) * $query->filterByReserve('yes'); // WHERE reserve = true * * - * @param boolean|string $reserve The value to use as filter. + * @param bool|string $reserve The value to use as filter. * Non-boolean arguments are converted using the following rules: * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * * 0, '0', 'false', 'off', and 'no' are converted to boolean false * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByReserve($reserve = null, $comparison = null) + public function filterByReserve($reserve = null, ?string $comparison = null) { if (is_string($reserve)) { - $reserve = in_array(strtolower($reserve), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + $reserve = in_array(strtolower($reserve), array('false', 'off', '-', 'no', 'n', '0', ''), true) ? false : true; } - return $this->addUsingAlias(UserRoleTableMap::COL_RESERVE, $reserve, $comparison); + $this->addUsingAlias(UserRoleTableMap::COL_RESERVE, $reserve, $comparison); + + return $this; } /** * Filter the query by a related \TechWilk\Rota\User object * * @param \TechWilk\Rota\User|ObjectCollection $user The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByUser($user, $comparison = null) + public function filterByUser($user, ?string $comparison = null) { if ($user instanceof \TechWilk\Rota\User) { return $this @@ -471,8 +491,10 @@ public function filterByUser($user, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(UserRoleTableMap::COL_USERID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByUser() only accepts arguments of type \TechWilk\Rota\User or Collection'); } @@ -481,12 +503,12 @@ public function filterByUser($user, $comparison = null) /** * Adds a JOIN clause to the query using the User relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinUser(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('User'); @@ -515,9 +537,9 @@ public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\UserQuery A secondary query class using the current class as primary query */ @@ -528,17 +550,113 @@ public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'User', '\TechWilk\Rota\UserQuery'); } + /** + * Use the User relation User object + * + * @param callable(\TechWilk\Rota\UserQuery):\TechWilk\Rota\UserQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withUserQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useUserQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to User table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\UserQuery The inner query object of the EXISTS statement + */ + public function useUserExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to User table for a NOT EXISTS query. + * + * @see useUserExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT EXISTS statement + */ + public function useUserNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useExistsQuery('User', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to User table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\UserQuery The inner query object of the IN statement + */ + public function useInUserQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to User table for a NOT IN query. + * + * @see useUserInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\UserQuery The inner query object of the NOT IN statement + */ + public function useNotInUserQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\UserQuery */ + $q = $this->useInQuery('User', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Role object * * @param \TechWilk\Rota\Role|ObjectCollection $role The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * - * @return ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByRole($role, $comparison = null) + public function filterByRole($role, ?string $comparison = null) { if ($role instanceof \TechWilk\Rota\Role) { return $this @@ -548,8 +666,10 @@ public function filterByRole($role, $comparison = null) $comparison = Criteria::IN; } - return $this + $this ->addUsingAlias(UserRoleTableMap::COL_ROLEID, $role->toKeyValue('PrimaryKey', 'Id'), $comparison); + + return $this; } else { throw new PropelException('filterByRole() only accepts arguments of type \TechWilk\Rota\Role or Collection'); } @@ -558,12 +678,12 @@ public function filterByRole($role, $comparison = null) /** * Adds a JOIN clause to the query using the Role relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinRole($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinRole(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Role'); @@ -592,9 +712,9 @@ public function joinRole($relationAlias = null, $joinType = Criteria::INNER_JOIN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\RoleQuery A secondary query class using the current class as primary query */ @@ -605,24 +725,124 @@ public function useRoleQuery($relationAlias = null, $joinType = Criteria::INNER_ ->useQuery($relationAlias ? $relationAlias : 'Role', '\TechWilk\Rota\RoleQuery'); } + /** + * Use the Role relation Role object + * + * @param callable(\TechWilk\Rota\RoleQuery):\TechWilk\Rota\RoleQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withRoleQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useRoleQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to Role table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the EXISTS statement + */ + public function useRoleExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useExistsQuery('Role', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to Role table for a NOT EXISTS query. + * + * @see useRoleExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the NOT EXISTS statement + */ + public function useRoleNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useExistsQuery('Role', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to Role table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the IN statement + */ + public function useInRoleQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useInQuery('Role', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to Role table for a NOT IN query. + * + * @see useRoleInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\RoleQuery The inner query object of the NOT IN statement + */ + public function useNotInRoleQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\RoleQuery */ + $q = $this->useInQuery('Role', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\EventPerson object * * @param \TechWilk\Rota\EventPerson|ObjectCollection $eventPerson the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterByEventPerson($eventPerson, $comparison = null) + public function filterByEventPerson($eventPerson, ?string $comparison = null) { if ($eventPerson instanceof \TechWilk\Rota\EventPerson) { - return $this + $this ->addUsingAlias(UserRoleTableMap::COL_ID, $eventPerson->getUserRoleId(), $comparison); + + return $this; } elseif ($eventPerson instanceof ObjectCollection) { - return $this + $this ->useEventPersonQuery() ->filterByPrimaryKeys($eventPerson->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterByEventPerson() only accepts arguments of type \TechWilk\Rota\EventPerson or Collection'); } @@ -631,12 +851,12 @@ public function filterByEventPerson($eventPerson, $comparison = null) /** * Adds a JOIN clause to the query using the EventPerson relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinEventPerson($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinEventPerson(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('EventPerson'); @@ -665,9 +885,9 @@ public function joinEventPerson($relationAlias = null, $joinType = Criteria::INN * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\EventPersonQuery A secondary query class using the current class as primary query */ @@ -678,24 +898,124 @@ public function useEventPersonQuery($relationAlias = null, $joinType = Criteria: ->useQuery($relationAlias ? $relationAlias : 'EventPerson', '\TechWilk\Rota\EventPersonQuery'); } + /** + * Use the EventPerson relation EventPerson object + * + * @param callable(\TechWilk\Rota\EventPersonQuery):\TechWilk\Rota\EventPersonQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withEventPersonQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useEventPersonQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the relation to EventPerson table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the EXISTS statement + */ + public function useEventPersonExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useExistsQuery('EventPerson', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the relation to EventPerson table for a NOT EXISTS query. + * + * @see useEventPersonExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the NOT EXISTS statement + */ + public function useEventPersonNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useExistsQuery('EventPerson', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the relation to EventPerson table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the IN statement + */ + public function useInEventPersonQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useInQuery('EventPerson', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the relation to EventPerson table for a NOT IN query. + * + * @see useEventPersonInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\EventPersonQuery The inner query object of the NOT IN statement + */ + public function useNotInEventPersonQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\EventPersonQuery */ + $q = $this->useInQuery('EventPerson', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Swap object * * @param \TechWilk\Rota\Swap|ObjectCollection $swap the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySwapRelatedByOldUserRoleId($swap, $comparison = null) + public function filterBySwapRelatedByOldUserRoleId($swap, ?string $comparison = null) { if ($swap instanceof \TechWilk\Rota\Swap) { - return $this + $this ->addUsingAlias(UserRoleTableMap::COL_ID, $swap->getOldUserRoleId(), $comparison); + + return $this; } elseif ($swap instanceof ObjectCollection) { - return $this + $this ->useSwapRelatedByOldUserRoleIdQuery() ->filterByPrimaryKeys($swap->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterBySwapRelatedByOldUserRoleId() only accepts arguments of type \TechWilk\Rota\Swap or Collection'); } @@ -704,12 +1024,12 @@ public function filterBySwapRelatedByOldUserRoleId($swap, $comparison = null) /** * Adds a JOIN clause to the query using the SwapRelatedByOldUserRoleId relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinSwapRelatedByOldUserRoleId($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinSwapRelatedByOldUserRoleId(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('SwapRelatedByOldUserRoleId'); @@ -738,9 +1058,9 @@ public function joinSwapRelatedByOldUserRoleId($relationAlias = null, $joinType * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\SwapQuery A secondary query class using the current class as primary query */ @@ -751,24 +1071,124 @@ public function useSwapRelatedByOldUserRoleIdQuery($relationAlias = null, $joinT ->useQuery($relationAlias ? $relationAlias : 'SwapRelatedByOldUserRoleId', '\TechWilk\Rota\SwapQuery'); } + /** + * Use the SwapRelatedByOldUserRoleId relation Swap object + * + * @param callable(\TechWilk\Rota\SwapQuery):\TechWilk\Rota\SwapQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withSwapRelatedByOldUserRoleIdQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useSwapRelatedByOldUserRoleIdQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the SwapRelatedByOldUserRoleId relation to the Swap table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the EXISTS statement + */ + public function useSwapRelatedByOldUserRoleIdExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('SwapRelatedByOldUserRoleId', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the SwapRelatedByOldUserRoleId relation to the Swap table for a NOT EXISTS query. + * + * @see useSwapRelatedByOldUserRoleIdExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT EXISTS statement + */ + public function useSwapRelatedByOldUserRoleIdNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('SwapRelatedByOldUserRoleId', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the SwapRelatedByOldUserRoleId relation to the Swap table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the IN statement + */ + public function useInSwapRelatedByOldUserRoleIdQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('SwapRelatedByOldUserRoleId', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the SwapRelatedByOldUserRoleId relation to the Swap table for a NOT IN query. + * + * @see useSwapRelatedByOldUserRoleIdInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT IN statement + */ + public function useNotInSwapRelatedByOldUserRoleIdQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('SwapRelatedByOldUserRoleId', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Filter the query by a related \TechWilk\Rota\Swap object * * @param \TechWilk\Rota\Swap|ObjectCollection $swap the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @param string|null $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function filterBySwapRelatedByNewUserRoleId($swap, $comparison = null) + public function filterBySwapRelatedByNewUserRoleId($swap, ?string $comparison = null) { if ($swap instanceof \TechWilk\Rota\Swap) { - return $this + $this ->addUsingAlias(UserRoleTableMap::COL_ID, $swap->getNewUserRoleId(), $comparison); + + return $this; } elseif ($swap instanceof ObjectCollection) { - return $this + $this ->useSwapRelatedByNewUserRoleIdQuery() ->filterByPrimaryKeys($swap->getPrimaryKeys()) ->endUse(); + + return $this; } else { throw new PropelException('filterBySwapRelatedByNewUserRoleId() only accepts arguments of type \TechWilk\Rota\Swap or Collection'); } @@ -777,12 +1197,12 @@ public function filterBySwapRelatedByNewUserRoleId($swap, $comparison = null) /** * Adds a JOIN clause to the query using the SwapRelatedByNewUserRoleId relation * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string|null $relationAlias Optional alias for the relation + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ - public function joinSwapRelatedByNewUserRoleId($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinSwapRelatedByNewUserRoleId(?string $relationAlias = null, ?string $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('SwapRelatedByNewUserRoleId'); @@ -811,9 +1231,9 @@ public function joinSwapRelatedByNewUserRoleId($relationAlias = null, $joinType * * @see useQuery() * - * @param string $relationAlias optional alias for the relation, + * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \TechWilk\Rota\SwapQuery A secondary query class using the current class as primary query */ @@ -824,12 +1244,108 @@ public function useSwapRelatedByNewUserRoleIdQuery($relationAlias = null, $joinT ->useQuery($relationAlias ? $relationAlias : 'SwapRelatedByNewUserRoleId', '\TechWilk\Rota\SwapQuery'); } + /** + * Use the SwapRelatedByNewUserRoleId relation Swap object + * + * @param callable(\TechWilk\Rota\SwapQuery):\TechWilk\Rota\SwapQuery $callable A function working on the related query + * + * @param string|null $relationAlias optional alias for the relation + * + * @param string|null $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return $this + */ + public function withSwapRelatedByNewUserRoleIdQuery( + callable $callable, + string $relationAlias = null, + ?string $joinType = Criteria::INNER_JOIN + ) { + $relatedQuery = $this->useSwapRelatedByNewUserRoleIdQuery( + $relationAlias, + $joinType + ); + $callable($relatedQuery); + $relatedQuery->endUse(); + + return $this; + } + + /** + * Use the SwapRelatedByNewUserRoleId relation to the Swap table for an EXISTS query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * @param string $typeOfExists Either ExistsQueryCriterion::TYPE_EXISTS or ExistsQueryCriterion::TYPE_NOT_EXISTS + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the EXISTS statement + */ + public function useSwapRelatedByNewUserRoleIdExistsQuery($modelAlias = null, $queryClass = null, $typeOfExists = 'EXISTS') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('SwapRelatedByNewUserRoleId', $modelAlias, $queryClass, $typeOfExists); + return $q; + } + + /** + * Use the SwapRelatedByNewUserRoleId relation to the Swap table for a NOT EXISTS query. + * + * @see useSwapRelatedByNewUserRoleIdExistsQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the exists query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT EXISTS statement + */ + public function useSwapRelatedByNewUserRoleIdNotExistsQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useExistsQuery('SwapRelatedByNewUserRoleId', $modelAlias, $queryClass, 'NOT EXISTS'); + return $q; + } + + /** + * Use the SwapRelatedByNewUserRoleId relation to the Swap table for an IN query. + * + * @see \Propel\Runtime\ActiveQuery\ModelCriteria::useInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the IN query, like ExtendedBookQuery::class + * @param string $typeOfIn Criteria::IN or Criteria::NOT_IN + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the IN statement + */ + public function useInSwapRelatedByNewUserRoleIdQuery($modelAlias = null, $queryClass = null, $typeOfIn = 'IN') + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('SwapRelatedByNewUserRoleId', $modelAlias, $queryClass, $typeOfIn); + return $q; + } + + /** + * Use the SwapRelatedByNewUserRoleId relation to the Swap table for a NOT IN query. + * + * @see useSwapRelatedByNewUserRoleIdInQuery() + * + * @param string|null $modelAlias sets an alias for the nested query + * @param string|null $queryClass Allows to use a custom query class for the NOT IN query, like ExtendedBookQuery::class + * + * @return \TechWilk\Rota\SwapQuery The inner query object of the NOT IN statement + */ + public function useNotInSwapRelatedByNewUserRoleIdQuery($modelAlias = null, $queryClass = null) + { + /** @var $q \TechWilk\Rota\SwapQuery */ + $q = $this->useInQuery('SwapRelatedByNewUserRoleId', $modelAlias, $queryClass, 'NOT IN'); + return $q; + } + /** * Exclude object from result * - * @param ChildUserRole $userRole Object to remove from the list of results + * @param ChildUserRole $userRole Object to remove from the list of results * - * @return $this|ChildUserRoleQuery The current query, for fluid interface + * @return $this The current query, for fluid interface */ public function prune($userRole = null) { @@ -846,7 +1362,7 @@ public function prune($userRole = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public function doDeleteAll(ConnectionInterface $con = null) + public function doDeleteAll(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserRoleTableMap::DATABASE_NAME); @@ -871,12 +1387,12 @@ public function doDeleteAll(ConnectionInterface $con = null) * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public function delete(ConnectionInterface $con = null) + public function delete(?ConnectionInterface $con = null): int { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserRoleTableMap::DATABASE_NAME); @@ -900,4 +1416,5 @@ public function delete(ConnectionInterface $con = null) return $affectedRows; }); } -} // UserRoleQuery + +} diff --git a/generated-classes/TechWilk/Rota/Map/AvailabilityTableMap.php b/generated-classes/TechWilk/Rota/Map/AvailabilityTableMap.php index 2c629d56..e7121764 100644 --- a/generated-classes/TechWilk/Rota/Map/AvailabilityTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/AvailabilityTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Availability; use TechWilk\Rota\AvailabilityQuery; + /** * This class defines the structure of the 'availability' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class AvailabilityTableMap extends TableMap { @@ -33,109 +33,156 @@ class AvailabilityTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.AvailabilityTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.AvailabilityTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'availability'; + public const TABLE_NAME = 'availability'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Availability'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Availability'; + public const OM_CLASS = '\\TechWilk\\Rota\\Availability'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Availability'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Availability'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + public const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + public const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the id field */ - const COL_ID = 'availability.id'; + public const COL_ID = 'availability.id'; /** * the column name for the eventId field */ - const COL_EVENTID = 'availability.eventId'; + public const COL_EVENTID = 'availability.eventId'; /** * the column name for the userId field */ - const COL_USERID = 'availability.userId'; + public const COL_USERID = 'availability.userId'; /** * the column name for the available field */ - const COL_AVAILABLE = 'availability.available'; + public const COL_AVAILABLE = 'availability.available'; /** * the column name for the comment field */ - const COL_COMMENT = 'availability.comment'; + public const COL_COMMENT = 'availability.comment'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'EventId', 'UserId', 'Available', 'Comment', ), - self::TYPE_CAMELNAME => array('id', 'eventId', 'userId', 'available', 'comment', ), - self::TYPE_COLNAME => array(AvailabilityTableMap::COL_ID, AvailabilityTableMap::COL_EVENTID, AvailabilityTableMap::COL_USERID, AvailabilityTableMap::COL_AVAILABLE, AvailabilityTableMap::COL_COMMENT, ), - self::TYPE_FIELDNAME => array('id', 'eventId', 'userId', 'available', 'comment', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'EventId', 'UserId', 'Available', 'Comment', ], + self::TYPE_CAMELNAME => ['id', 'eventId', 'userId', 'available', 'comment', ], + self::TYPE_COLNAME => [AvailabilityTableMap::COL_ID, AvailabilityTableMap::COL_EVENTID, AvailabilityTableMap::COL_USERID, AvailabilityTableMap::COL_AVAILABLE, AvailabilityTableMap::COL_COMMENT, ], + self::TYPE_FIELDNAME => ['id', 'eventId', 'userId', 'available', 'comment', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'EventId' => 1, 'UserId' => 2, 'Available' => 3, 'Comment' => 4, ], + self::TYPE_CAMELNAME => ['id' => 0, 'eventId' => 1, 'userId' => 2, 'available' => 3, 'comment' => 4, ], + self::TYPE_COLNAME => [AvailabilityTableMap::COL_ID => 0, AvailabilityTableMap::COL_EVENTID => 1, AvailabilityTableMap::COL_USERID => 2, AvailabilityTableMap::COL_AVAILABLE => 3, AvailabilityTableMap::COL_COMMENT => 4, ], + self::TYPE_FIELDNAME => ['id' => 0, 'eventId' => 1, 'userId' => 2, 'available' => 3, 'comment' => 4, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'EventId' => 1, 'UserId' => 2, 'Available' => 3, 'Comment' => 4, ), - self::TYPE_CAMELNAME => array('id' => 0, 'eventId' => 1, 'userId' => 2, 'available' => 3, 'comment' => 4, ), - self::TYPE_COLNAME => array(AvailabilityTableMap::COL_ID => 0, AvailabilityTableMap::COL_EVENTID => 1, AvailabilityTableMap::COL_USERID => 2, AvailabilityTableMap::COL_AVAILABLE => 3, AvailabilityTableMap::COL_COMMENT => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'eventId' => 1, 'userId' => 2, 'available' => 3, 'comment' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Availability.Id' => 'ID', + 'id' => 'ID', + 'availability.id' => 'ID', + 'AvailabilityTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'EventId' => 'EVENTID', + 'Availability.EventId' => 'EVENTID', + 'eventId' => 'EVENTID', + 'availability.eventId' => 'EVENTID', + 'AvailabilityTableMap::COL_EVENTID' => 'EVENTID', + 'COL_EVENTID' => 'EVENTID', + 'UserId' => 'USERID', + 'Availability.UserId' => 'USERID', + 'userId' => 'USERID', + 'availability.userId' => 'USERID', + 'AvailabilityTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'Available' => 'AVAILABLE', + 'Availability.Available' => 'AVAILABLE', + 'available' => 'AVAILABLE', + 'availability.available' => 'AVAILABLE', + 'AvailabilityTableMap::COL_AVAILABLE' => 'AVAILABLE', + 'COL_AVAILABLE' => 'AVAILABLE', + 'Comment' => 'COMMENT', + 'Availability.Comment' => 'COMMENT', + 'comment' => 'COMMENT', + 'availability.comment' => 'COMMENT', + 'AvailabilityTableMap::COL_COMMENT' => 'COMMENT', + 'COL_COMMENT' => 'COMMENT', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('availability'); @@ -150,28 +197,30 @@ public function initialize() $this->addForeignKey('userId', 'UserId', 'INTEGER', 'users', 'id', true, null, null); $this->addColumn('available', 'Available', 'BOOLEAN', true, 1, true); $this->addColumn('comment', 'Comment', 'VARCHAR', false, 64, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':eventId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -179,14 +228,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -201,14 +250,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -225,10 +274,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? AvailabilityTableMap::CLASS_DEFAULT : AvailabilityTableMap::OM_CLASS; } @@ -236,17 +285,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Availability object, last column rank) + * @return array (Availability object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = AvailabilityTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = AvailabilityTableMap::getInstanceFromPool($key))) { @@ -262,7 +311,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: AvailabilityTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -270,13 +319,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -306,12 +355,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(AvailabilityTableMap::COL_ID); @@ -329,68 +379,86 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(AvailabilityTableMap::DATABASE_NAME)->getTable(AvailabilityTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(AvailabilityTableMap::COL_ID); + $criteria->removeSelectColumn(AvailabilityTableMap::COL_EVENTID); + $criteria->removeSelectColumn(AvailabilityTableMap::COL_USERID); + $criteria->removeSelectColumn(AvailabilityTableMap::COL_AVAILABLE); + $criteria->removeSelectColumn(AvailabilityTableMap::COL_COMMENT); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.eventId'); + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.available'); + $criteria->removeSelectColumn($alias . '.comment'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(AvailabilityTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(AvailabilityTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new AvailabilityTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(AvailabilityTableMap::DATABASE_NAME)->getTable(AvailabilityTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Availability or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Availability object or primary key or array of primary keys + * @param mixed $values Criteria or Availability object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(AvailabilityTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(AvailabilityTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Availability) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Availability) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(AvailabilityTableMap::DATABASE_NAME); - $criteria->add(AvailabilityTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(AvailabilityTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = AvailabilityQuery::create()->mergeWith($criteria); + $query = AvailabilityQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - AvailabilityTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + AvailabilityTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { AvailabilityTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the availability table. @@ -398,7 +466,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return AvailabilityQuery::create()->doDeleteAll($con); } @@ -406,13 +474,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Availability or Criteria object. * - * @param mixed $criteria Criteria or Availability object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Availability object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(AvailabilityTableMap::DATABASE_NAME); @@ -424,7 +492,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Availability object } - if ($criteria->containsKey(AvailabilityTableMap::COL_ID) && $criteria->keyContainsValue(AvailabilityTableMap::COL_ID)) { + if ($criteria->containsKey(AvailabilityTableMap::COL_ID) && $criteria->keyContainsValue(AvailabilityTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.AvailabilityTableMap::COL_ID.')'); } @@ -438,7 +506,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // AvailabilityTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -AvailabilityTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/CalendarTokenTableMap.php b/generated-classes/TechWilk/Rota/Map/CalendarTokenTableMap.php index 529b440a..61d1dad3 100644 --- a/generated-classes/TechWilk/Rota/Map/CalendarTokenTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/CalendarTokenTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\CalendarToken; use TechWilk\Rota\CalendarTokenQuery; + /** * This class defines the structure of the 'calendarTokens' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class CalendarTokenTableMap extends TableMap { @@ -33,134 +33,222 @@ class CalendarTokenTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.CalendarTokenTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.CalendarTokenTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'calendarTokens'; + public const TABLE_NAME = 'calendarTokens'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'CalendarToken'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\CalendarToken'; + public const OM_CLASS = '\\TechWilk\\Rota\\CalendarToken'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.CalendarToken'; + public const CLASS_DEFAULT = 'TechWilk.Rota.CalendarToken'; /** * The total number of columns */ - const NUM_COLUMNS = 10; + public const NUM_COLUMNS = 10; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 10; + public const NUM_HYDRATE_COLUMNS = 10; /** * the column name for the id field */ - const COL_ID = 'calendarTokens.id'; + public const COL_ID = 'calendarTokens.id'; /** * the column name for the token field */ - const COL_TOKEN = 'calendarTokens.token'; + public const COL_TOKEN = 'calendarTokens.token'; /** * the column name for the userId field */ - const COL_USERID = 'calendarTokens.userId'; + public const COL_USERID = 'calendarTokens.userId'; /** * the column name for the format field */ - const COL_FORMAT = 'calendarTokens.format'; + public const COL_FORMAT = 'calendarTokens.format'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'calendarTokens.description'; + public const COL_DESCRIPTION = 'calendarTokens.description'; /** * the column name for the revoked field */ - const COL_REVOKED = 'calendarTokens.revoked'; + public const COL_REVOKED = 'calendarTokens.revoked'; /** * the column name for the revokedDate field */ - const COL_REVOKEDDATE = 'calendarTokens.revokedDate'; + public const COL_REVOKEDDATE = 'calendarTokens.revokedDate'; /** * the column name for the lastFetched field */ - const COL_LASTFETCHED = 'calendarTokens.lastFetched'; + public const COL_LASTFETCHED = 'calendarTokens.lastFetched'; /** * the column name for the created field */ - const COL_CREATED = 'calendarTokens.created'; + public const COL_CREATED = 'calendarTokens.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'calendarTokens.updated'; + public const COL_UPDATED = 'calendarTokens.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Token', 'Userid', 'Format', 'Description', 'Revoked', 'RevokedDate', 'LastFetched', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'token', 'userid', 'format', 'description', 'revoked', 'revokedDate', 'lastFetched', 'created', 'updated', ), - self::TYPE_COLNAME => array(CalendarTokenTableMap::COL_ID, CalendarTokenTableMap::COL_TOKEN, CalendarTokenTableMap::COL_USERID, CalendarTokenTableMap::COL_FORMAT, CalendarTokenTableMap::COL_DESCRIPTION, CalendarTokenTableMap::COL_REVOKED, CalendarTokenTableMap::COL_REVOKEDDATE, CalendarTokenTableMap::COL_LASTFETCHED, CalendarTokenTableMap::COL_CREATED, CalendarTokenTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'token', 'userId', 'format', 'description', 'revoked', 'revokedDate', 'lastFetched', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Token', 'Userid', 'Format', 'Description', 'Revoked', 'RevokedDate', 'LastFetched', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'token', 'userid', 'format', 'description', 'revoked', 'revokedDate', 'lastFetched', 'created', 'updated', ], + self::TYPE_COLNAME => [CalendarTokenTableMap::COL_ID, CalendarTokenTableMap::COL_TOKEN, CalendarTokenTableMap::COL_USERID, CalendarTokenTableMap::COL_FORMAT, CalendarTokenTableMap::COL_DESCRIPTION, CalendarTokenTableMap::COL_REVOKED, CalendarTokenTableMap::COL_REVOKEDDATE, CalendarTokenTableMap::COL_LASTFETCHED, CalendarTokenTableMap::COL_CREATED, CalendarTokenTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'token', 'userId', 'format', 'description', 'revoked', 'revokedDate', 'lastFetched', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Token' => 1, 'Userid' => 2, 'Format' => 3, 'Description' => 4, 'Revoked' => 5, 'RevokedDate' => 6, 'LastFetched' => 7, 'Created' => 8, 'Updated' => 9, ), - self::TYPE_CAMELNAME => array('id' => 0, 'token' => 1, 'userid' => 2, 'format' => 3, 'description' => 4, 'revoked' => 5, 'revokedDate' => 6, 'lastFetched' => 7, 'created' => 8, 'updated' => 9, ), - self::TYPE_COLNAME => array(CalendarTokenTableMap::COL_ID => 0, CalendarTokenTableMap::COL_TOKEN => 1, CalendarTokenTableMap::COL_USERID => 2, CalendarTokenTableMap::COL_FORMAT => 3, CalendarTokenTableMap::COL_DESCRIPTION => 4, CalendarTokenTableMap::COL_REVOKED => 5, CalendarTokenTableMap::COL_REVOKEDDATE => 6, CalendarTokenTableMap::COL_LASTFETCHED => 7, CalendarTokenTableMap::COL_CREATED => 8, CalendarTokenTableMap::COL_UPDATED => 9, ), - self::TYPE_FIELDNAME => array('id' => 0, 'token' => 1, 'userId' => 2, 'format' => 3, 'description' => 4, 'revoked' => 5, 'revokedDate' => 6, 'lastFetched' => 7, 'created' => 8, 'updated' => 9, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Token' => 1, 'Userid' => 2, 'Format' => 3, 'Description' => 4, 'Revoked' => 5, 'RevokedDate' => 6, 'LastFetched' => 7, 'Created' => 8, 'Updated' => 9, ], + self::TYPE_CAMELNAME => ['id' => 0, 'token' => 1, 'userid' => 2, 'format' => 3, 'description' => 4, 'revoked' => 5, 'revokedDate' => 6, 'lastFetched' => 7, 'created' => 8, 'updated' => 9, ], + self::TYPE_COLNAME => [CalendarTokenTableMap::COL_ID => 0, CalendarTokenTableMap::COL_TOKEN => 1, CalendarTokenTableMap::COL_USERID => 2, CalendarTokenTableMap::COL_FORMAT => 3, CalendarTokenTableMap::COL_DESCRIPTION => 4, CalendarTokenTableMap::COL_REVOKED => 5, CalendarTokenTableMap::COL_REVOKEDDATE => 6, CalendarTokenTableMap::COL_LASTFETCHED => 7, CalendarTokenTableMap::COL_CREATED => 8, CalendarTokenTableMap::COL_UPDATED => 9, ], + self::TYPE_FIELDNAME => ['id' => 0, 'token' => 1, 'userId' => 2, 'format' => 3, 'description' => 4, 'revoked' => 5, 'revokedDate' => 6, 'lastFetched' => 7, 'created' => 8, 'updated' => 9, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'CalendarToken.Id' => 'ID', + 'id' => 'ID', + 'calendarToken.id' => 'ID', + 'CalendarTokenTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'calendarTokens.id' => 'ID', + 'Token' => 'TOKEN', + 'CalendarToken.Token' => 'TOKEN', + 'token' => 'TOKEN', + 'calendarToken.token' => 'TOKEN', + 'CalendarTokenTableMap::COL_TOKEN' => 'TOKEN', + 'COL_TOKEN' => 'TOKEN', + 'calendarTokens.token' => 'TOKEN', + 'Userid' => 'USERID', + 'CalendarToken.Userid' => 'USERID', + 'userid' => 'USERID', + 'calendarToken.userid' => 'USERID', + 'CalendarTokenTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'userId' => 'USERID', + 'calendarTokens.userId' => 'USERID', + 'Format' => 'FORMAT', + 'CalendarToken.Format' => 'FORMAT', + 'format' => 'FORMAT', + 'calendarToken.format' => 'FORMAT', + 'CalendarTokenTableMap::COL_FORMAT' => 'FORMAT', + 'COL_FORMAT' => 'FORMAT', + 'calendarTokens.format' => 'FORMAT', + 'Description' => 'DESCRIPTION', + 'CalendarToken.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'calendarToken.description' => 'DESCRIPTION', + 'CalendarTokenTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'calendarTokens.description' => 'DESCRIPTION', + 'Revoked' => 'REVOKED', + 'CalendarToken.Revoked' => 'REVOKED', + 'revoked' => 'REVOKED', + 'calendarToken.revoked' => 'REVOKED', + 'CalendarTokenTableMap::COL_REVOKED' => 'REVOKED', + 'COL_REVOKED' => 'REVOKED', + 'calendarTokens.revoked' => 'REVOKED', + 'RevokedDate' => 'REVOKEDDATE', + 'CalendarToken.RevokedDate' => 'REVOKEDDATE', + 'revokedDate' => 'REVOKEDDATE', + 'calendarToken.revokedDate' => 'REVOKEDDATE', + 'CalendarTokenTableMap::COL_REVOKEDDATE' => 'REVOKEDDATE', + 'COL_REVOKEDDATE' => 'REVOKEDDATE', + 'calendarTokens.revokedDate' => 'REVOKEDDATE', + 'LastFetched' => 'LASTFETCHED', + 'CalendarToken.LastFetched' => 'LASTFETCHED', + 'lastFetched' => 'LASTFETCHED', + 'calendarToken.lastFetched' => 'LASTFETCHED', + 'CalendarTokenTableMap::COL_LASTFETCHED' => 'LASTFETCHED', + 'COL_LASTFETCHED' => 'LASTFETCHED', + 'calendarTokens.lastFetched' => 'LASTFETCHED', + 'Created' => 'CREATED', + 'CalendarToken.Created' => 'CREATED', + 'created' => 'CREATED', + 'calendarToken.created' => 'CREATED', + 'CalendarTokenTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'calendarTokens.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'CalendarToken.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'calendarToken.updated' => 'UPDATED', + 'CalendarTokenTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'calendarTokens.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('calendarTokens'); @@ -180,34 +268,36 @@ public function initialize() $this->addColumn('lastFetched', 'LastFetched', 'TIMESTAMP', false, null, null); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -215,14 +305,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -237,14 +327,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -261,10 +351,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? CalendarTokenTableMap::CLASS_DEFAULT : CalendarTokenTableMap::OM_CLASS; } @@ -272,17 +362,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (CalendarToken object, last column rank) + * @return array (CalendarToken object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = CalendarTokenTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = CalendarTokenTableMap::getInstanceFromPool($key))) { @@ -298,7 +388,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: CalendarTokenTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -306,13 +396,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -342,12 +432,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(CalendarTokenTableMap::COL_ID); @@ -375,68 +466,96 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(CalendarTokenTableMap::DATABASE_NAME)->getTable(CalendarTokenTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_ID); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_TOKEN); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_USERID); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_FORMAT); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_REVOKED); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_REVOKEDDATE); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_LASTFETCHED); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_CREATED); + $criteria->removeSelectColumn(CalendarTokenTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.token'); + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.format'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.revoked'); + $criteria->removeSelectColumn($alias . '.revokedDate'); + $criteria->removeSelectColumn($alias . '.lastFetched'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(CalendarTokenTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(CalendarTokenTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new CalendarTokenTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(CalendarTokenTableMap::DATABASE_NAME)->getTable(CalendarTokenTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a CalendarToken or Criteria object OR a primary key value. * - * @param mixed $values Criteria or CalendarToken object or primary key or array of primary keys + * @param mixed $values Criteria or CalendarToken object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CalendarTokenTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CalendarTokenTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\CalendarToken) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\CalendarToken) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(CalendarTokenTableMap::DATABASE_NAME); - $criteria->add(CalendarTokenTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(CalendarTokenTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = CalendarTokenQuery::create()->mergeWith($criteria); + $query = CalendarTokenQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - CalendarTokenTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + CalendarTokenTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { CalendarTokenTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the calendarTokens table. @@ -444,7 +563,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return CalendarTokenQuery::create()->doDeleteAll($con); } @@ -452,13 +571,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a CalendarToken or Criteria object. * - * @param mixed $criteria Criteria or CalendarToken object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or CalendarToken object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CalendarTokenTableMap::DATABASE_NAME); @@ -470,7 +589,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from CalendarToken object } - if ($criteria->containsKey(CalendarTokenTableMap::COL_ID) && $criteria->keyContainsValue(CalendarTokenTableMap::COL_ID)) { + if ($criteria->containsKey(CalendarTokenTableMap::COL_ID) && $criteria->keyContainsValue(CalendarTokenTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.CalendarTokenTableMap::COL_ID.')'); } @@ -484,7 +603,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // CalendarTokenTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -CalendarTokenTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/CommentTableMap.php b/generated-classes/TechWilk/Rota/Map/CommentTableMap.php index 2d1ed78c..1effe5f4 100644 --- a/generated-classes/TechWilk/Rota/Map/CommentTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/CommentTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Comment; use TechWilk\Rota\CommentQuery; + /** * This class defines the structure of the 'comments' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class CommentTableMap extends TableMap { @@ -33,119 +33,185 @@ class CommentTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.CommentTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.CommentTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'comments'; + public const TABLE_NAME = 'comments'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Comment'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Comment'; + public const OM_CLASS = '\\TechWilk\\Rota\\Comment'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Comment'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Comment'; /** * The total number of columns */ - const NUM_COLUMNS = 7; + public const NUM_COLUMNS = 7; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; + public const NUM_HYDRATE_COLUMNS = 7; /** * the column name for the id field */ - const COL_ID = 'comments.id'; + public const COL_ID = 'comments.id'; /** * the column name for the eventId field */ - const COL_EVENTID = 'comments.eventId'; + public const COL_EVENTID = 'comments.eventId'; /** * the column name for the userId field */ - const COL_USERID = 'comments.userId'; + public const COL_USERID = 'comments.userId'; /** * the column name for the text field */ - const COL_TEXT = 'comments.text'; + public const COL_TEXT = 'comments.text'; /** * the column name for the removed field */ - const COL_REMOVED = 'comments.removed'; + public const COL_REMOVED = 'comments.removed'; /** * the column name for the created field */ - const COL_CREATED = 'comments.created'; + public const COL_CREATED = 'comments.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'comments.updated'; + public const COL_UPDATED = 'comments.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'EventId', 'UserId', 'Text', 'Removed', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'eventId', 'userId', 'text', 'removed', 'created', 'updated', ), - self::TYPE_COLNAME => array(CommentTableMap::COL_ID, CommentTableMap::COL_EVENTID, CommentTableMap::COL_USERID, CommentTableMap::COL_TEXT, CommentTableMap::COL_REMOVED, CommentTableMap::COL_CREATED, CommentTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'eventId', 'userId', 'text', 'removed', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'EventId', 'UserId', 'Text', 'Removed', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'eventId', 'userId', 'text', 'removed', 'created', 'updated', ], + self::TYPE_COLNAME => [CommentTableMap::COL_ID, CommentTableMap::COL_EVENTID, CommentTableMap::COL_USERID, CommentTableMap::COL_TEXT, CommentTableMap::COL_REMOVED, CommentTableMap::COL_CREATED, CommentTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'eventId', 'userId', 'text', 'removed', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'EventId' => 1, 'UserId' => 2, 'Text' => 3, 'Removed' => 4, 'Created' => 5, 'Updated' => 6, ), - self::TYPE_CAMELNAME => array('id' => 0, 'eventId' => 1, 'userId' => 2, 'text' => 3, 'removed' => 4, 'created' => 5, 'updated' => 6, ), - self::TYPE_COLNAME => array(CommentTableMap::COL_ID => 0, CommentTableMap::COL_EVENTID => 1, CommentTableMap::COL_USERID => 2, CommentTableMap::COL_TEXT => 3, CommentTableMap::COL_REMOVED => 4, CommentTableMap::COL_CREATED => 5, CommentTableMap::COL_UPDATED => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'eventId' => 1, 'userId' => 2, 'text' => 3, 'removed' => 4, 'created' => 5, 'updated' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'EventId' => 1, 'UserId' => 2, 'Text' => 3, 'Removed' => 4, 'Created' => 5, 'Updated' => 6, ], + self::TYPE_CAMELNAME => ['id' => 0, 'eventId' => 1, 'userId' => 2, 'text' => 3, 'removed' => 4, 'created' => 5, 'updated' => 6, ], + self::TYPE_COLNAME => [CommentTableMap::COL_ID => 0, CommentTableMap::COL_EVENTID => 1, CommentTableMap::COL_USERID => 2, CommentTableMap::COL_TEXT => 3, CommentTableMap::COL_REMOVED => 4, CommentTableMap::COL_CREATED => 5, CommentTableMap::COL_UPDATED => 6, ], + self::TYPE_FIELDNAME => ['id' => 0, 'eventId' => 1, 'userId' => 2, 'text' => 3, 'removed' => 4, 'created' => 5, 'updated' => 6, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Comment.Id' => 'ID', + 'id' => 'ID', + 'comment.id' => 'ID', + 'CommentTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'comments.id' => 'ID', + 'EventId' => 'EVENTID', + 'Comment.EventId' => 'EVENTID', + 'eventId' => 'EVENTID', + 'comment.eventId' => 'EVENTID', + 'CommentTableMap::COL_EVENTID' => 'EVENTID', + 'COL_EVENTID' => 'EVENTID', + 'comments.eventId' => 'EVENTID', + 'UserId' => 'USERID', + 'Comment.UserId' => 'USERID', + 'userId' => 'USERID', + 'comment.userId' => 'USERID', + 'CommentTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'comments.userId' => 'USERID', + 'Text' => 'TEXT', + 'Comment.Text' => 'TEXT', + 'text' => 'TEXT', + 'comment.text' => 'TEXT', + 'CommentTableMap::COL_TEXT' => 'TEXT', + 'COL_TEXT' => 'TEXT', + 'comments.text' => 'TEXT', + 'Removed' => 'REMOVED', + 'Comment.Removed' => 'REMOVED', + 'removed' => 'REMOVED', + 'comment.removed' => 'REMOVED', + 'CommentTableMap::COL_REMOVED' => 'REMOVED', + 'COL_REMOVED' => 'REMOVED', + 'comments.removed' => 'REMOVED', + 'Created' => 'CREATED', + 'Comment.Created' => 'CREATED', + 'created' => 'CREATED', + 'comment.created' => 'CREATED', + 'CommentTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'comments.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'Comment.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'comment.updated' => 'UPDATED', + 'CommentTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'comments.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('comments'); @@ -162,41 +228,43 @@ public function initialize() $this->addColumn('removed', 'Removed', 'BOOLEAN', false, 1, false); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':eventId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -204,14 +272,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -226,14 +294,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -250,10 +318,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? CommentTableMap::CLASS_DEFAULT : CommentTableMap::OM_CLASS; } @@ -261,17 +329,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Comment object, last column rank) + * @return array (Comment object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = CommentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = CommentTableMap::getInstanceFromPool($key))) { @@ -287,7 +355,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: CommentTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -295,13 +363,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -331,12 +399,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(CommentTableMap::COL_ID); @@ -358,68 +427,90 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(CommentTableMap::DATABASE_NAME)->getTable(CommentTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(CommentTableMap::COL_ID); + $criteria->removeSelectColumn(CommentTableMap::COL_EVENTID); + $criteria->removeSelectColumn(CommentTableMap::COL_USERID); + $criteria->removeSelectColumn(CommentTableMap::COL_TEXT); + $criteria->removeSelectColumn(CommentTableMap::COL_REMOVED); + $criteria->removeSelectColumn(CommentTableMap::COL_CREATED); + $criteria->removeSelectColumn(CommentTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.eventId'); + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.text'); + $criteria->removeSelectColumn($alias . '.removed'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(CommentTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(CommentTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new CommentTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(CommentTableMap::DATABASE_NAME)->getTable(CommentTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Comment or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Comment object or primary key or array of primary keys + * @param mixed $values Criteria or Comment object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CommentTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CommentTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Comment) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Comment) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(CommentTableMap::DATABASE_NAME); - $criteria->add(CommentTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(CommentTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = CommentQuery::create()->mergeWith($criteria); + $query = CommentQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - CommentTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + CommentTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { CommentTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the comments table. @@ -427,7 +518,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return CommentQuery::create()->doDeleteAll($con); } @@ -435,13 +526,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Comment or Criteria object. * - * @param mixed $criteria Criteria or Comment object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Comment object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CommentTableMap::DATABASE_NAME); @@ -453,7 +544,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Comment object } - if ($criteria->containsKey(CommentTableMap::COL_ID) && $criteria->keyContainsValue(CommentTableMap::COL_ID)) { + if ($criteria->containsKey(CommentTableMap::COL_ID) && $criteria->keyContainsValue(CommentTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.CommentTableMap::COL_ID.')'); } @@ -467,7 +558,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // CommentTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -CommentTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/DocumentTableMap.php b/generated-classes/TechWilk/Rota/Map/DocumentTableMap.php index 05174ffd..c5c3c838 100644 --- a/generated-classes/TechWilk/Rota/Map/DocumentTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/DocumentTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Document; use TechWilk\Rota\DocumentQuery; + /** * This class defines the structure of the 'documents' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class DocumentTableMap extends TableMap { @@ -33,109 +33,161 @@ class DocumentTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.DocumentTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.DocumentTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'documents'; + public const TABLE_NAME = 'documents'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Document'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Document'; + public const OM_CLASS = '\\TechWilk\\Rota\\Document'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Document'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Document'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + public const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + public const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the id field */ - const COL_ID = 'documents.id'; + public const COL_ID = 'documents.id'; /** * the column name for the title field */ - const COL_TITLE = 'documents.title'; + public const COL_TITLE = 'documents.title'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'documents.description'; + public const COL_DESCRIPTION = 'documents.description'; /** * the column name for the url field */ - const COL_URL = 'documents.url'; + public const COL_URL = 'documents.url'; /** * the column name for the link field */ - const COL_LINK = 'documents.link'; + public const COL_LINK = 'documents.link'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Title', 'Description', 'Url', 'Link', ), - self::TYPE_CAMELNAME => array('id', 'title', 'description', 'url', 'link', ), - self::TYPE_COLNAME => array(DocumentTableMap::COL_ID, DocumentTableMap::COL_TITLE, DocumentTableMap::COL_DESCRIPTION, DocumentTableMap::COL_URL, DocumentTableMap::COL_LINK, ), - self::TYPE_FIELDNAME => array('id', 'title', 'description', 'url', 'link', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Title', 'Description', 'Url', 'Link', ], + self::TYPE_CAMELNAME => ['id', 'title', 'description', 'url', 'link', ], + self::TYPE_COLNAME => [DocumentTableMap::COL_ID, DocumentTableMap::COL_TITLE, DocumentTableMap::COL_DESCRIPTION, DocumentTableMap::COL_URL, DocumentTableMap::COL_LINK, ], + self::TYPE_FIELDNAME => ['id', 'title', 'description', 'url', 'link', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Title' => 1, 'Description' => 2, 'Url' => 3, 'Link' => 4, ], + self::TYPE_CAMELNAME => ['id' => 0, 'title' => 1, 'description' => 2, 'url' => 3, 'link' => 4, ], + self::TYPE_COLNAME => [DocumentTableMap::COL_ID => 0, DocumentTableMap::COL_TITLE => 1, DocumentTableMap::COL_DESCRIPTION => 2, DocumentTableMap::COL_URL => 3, DocumentTableMap::COL_LINK => 4, ], + self::TYPE_FIELDNAME => ['id' => 0, 'title' => 1, 'description' => 2, 'url' => 3, 'link' => 4, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Description' => 2, 'Url' => 3, 'Link' => 4, ), - self::TYPE_CAMELNAME => array('id' => 0, 'title' => 1, 'description' => 2, 'url' => 3, 'link' => 4, ), - self::TYPE_COLNAME => array(DocumentTableMap::COL_ID => 0, DocumentTableMap::COL_TITLE => 1, DocumentTableMap::COL_DESCRIPTION => 2, DocumentTableMap::COL_URL => 3, DocumentTableMap::COL_LINK => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'description' => 2, 'url' => 3, 'link' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Document.Id' => 'ID', + 'id' => 'ID', + 'document.id' => 'ID', + 'DocumentTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'documents.id' => 'ID', + 'Title' => 'TITLE', + 'Document.Title' => 'TITLE', + 'title' => 'TITLE', + 'document.title' => 'TITLE', + 'DocumentTableMap::COL_TITLE' => 'TITLE', + 'COL_TITLE' => 'TITLE', + 'documents.title' => 'TITLE', + 'Description' => 'DESCRIPTION', + 'Document.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'document.description' => 'DESCRIPTION', + 'DocumentTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'documents.description' => 'DESCRIPTION', + 'Url' => 'URL', + 'Document.Url' => 'URL', + 'url' => 'URL', + 'document.url' => 'URL', + 'DocumentTableMap::COL_URL' => 'URL', + 'COL_URL' => 'URL', + 'documents.url' => 'URL', + 'Link' => 'LINK', + 'Document.Link' => 'LINK', + 'link' => 'LINK', + 'document.link' => 'LINK', + 'DocumentTableMap::COL_LINK' => 'LINK', + 'COL_LINK' => 'LINK', + 'documents.link' => 'LINK', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('documents'); @@ -150,14 +202,16 @@ public function initialize() $this->addColumn('description', 'Description', 'LONGVARCHAR', true, null, null); $this->addColumn('url', 'Url', 'VARCHAR', true, 127, ''); $this->addColumn('link', 'Link', 'LONGVARCHAR', true, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -165,14 +219,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -187,14 +241,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -211,10 +265,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? DocumentTableMap::CLASS_DEFAULT : DocumentTableMap::OM_CLASS; } @@ -222,17 +276,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Document object, last column rank) + * @return array (Document object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = DocumentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = DocumentTableMap::getInstanceFromPool($key))) { @@ -248,7 +302,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: DocumentTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -256,13 +310,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -292,12 +346,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(DocumentTableMap::COL_ID); @@ -315,68 +370,86 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(DocumentTableMap::DATABASE_NAME)->getTable(DocumentTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(DocumentTableMap::COL_ID); + $criteria->removeSelectColumn(DocumentTableMap::COL_TITLE); + $criteria->removeSelectColumn(DocumentTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(DocumentTableMap::COL_URL); + $criteria->removeSelectColumn(DocumentTableMap::COL_LINK); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.title'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.url'); + $criteria->removeSelectColumn($alias . '.link'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(DocumentTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(DocumentTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new DocumentTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(DocumentTableMap::DATABASE_NAME)->getTable(DocumentTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Document or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Document object or primary key or array of primary keys + * @param mixed $values Criteria or Document object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(DocumentTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(DocumentTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Document) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Document) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(DocumentTableMap::DATABASE_NAME); - $criteria->add(DocumentTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(DocumentTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = DocumentQuery::create()->mergeWith($criteria); + $query = DocumentQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - DocumentTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + DocumentTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { DocumentTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the documents table. @@ -384,7 +457,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return DocumentQuery::create()->doDeleteAll($con); } @@ -392,13 +465,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Document or Criteria object. * - * @param mixed $criteria Criteria or Document object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Document object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(DocumentTableMap::DATABASE_NAME); @@ -410,7 +483,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Document object } - if ($criteria->containsKey(DocumentTableMap::COL_ID) && $criteria->keyContainsValue(DocumentTableMap::COL_ID)) { + if ($criteria->containsKey(DocumentTableMap::COL_ID) && $criteria->keyContainsValue(DocumentTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.DocumentTableMap::COL_ID.')'); } @@ -424,7 +497,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // DocumentTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -DocumentTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/EmailTableMap.php b/generated-classes/TechWilk/Rota/Map/EmailTableMap.php index 88a61172..4e1d2336 100644 --- a/generated-classes/TechWilk/Rota/Map/EmailTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/EmailTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Email; use TechWilk\Rota\EmailQuery; + /** * This class defines the structure of the 'emails' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class EmailTableMap extends TableMap { @@ -33,119 +33,185 @@ class EmailTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.EmailTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.EmailTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'emails'; + public const TABLE_NAME = 'emails'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Email'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Email'; + public const OM_CLASS = '\\TechWilk\\Rota\\Email'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Email'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Email'; /** * The total number of columns */ - const NUM_COLUMNS = 7; + public const NUM_COLUMNS = 7; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; + public const NUM_HYDRATE_COLUMNS = 7; /** * the column name for the id field */ - const COL_ID = 'emails.id'; + public const COL_ID = 'emails.id'; /** * the column name for the emailTo field */ - const COL_EMAILTO = 'emails.emailTo'; + public const COL_EMAILTO = 'emails.emailTo'; /** * the column name for the emailBcc field */ - const COL_EMAILBCC = 'emails.emailBcc'; + public const COL_EMAILBCC = 'emails.emailBcc'; /** * the column name for the emailFrom field */ - const COL_EMAILFROM = 'emails.emailFrom'; + public const COL_EMAILFROM = 'emails.emailFrom'; /** * the column name for the subject field */ - const COL_SUBJECT = 'emails.subject'; + public const COL_SUBJECT = 'emails.subject'; /** * the column name for the message field */ - const COL_MESSAGE = 'emails.message'; + public const COL_MESSAGE = 'emails.message'; /** * the column name for the error field */ - const COL_ERROR = 'emails.error'; + public const COL_ERROR = 'emails.error'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'EmailTo', 'EmailBcc', 'EmailFrom', 'Subject', 'Message', 'Error', ), - self::TYPE_CAMELNAME => array('id', 'emailTo', 'emailBcc', 'emailFrom', 'subject', 'message', 'error', ), - self::TYPE_COLNAME => array(EmailTableMap::COL_ID, EmailTableMap::COL_EMAILTO, EmailTableMap::COL_EMAILBCC, EmailTableMap::COL_EMAILFROM, EmailTableMap::COL_SUBJECT, EmailTableMap::COL_MESSAGE, EmailTableMap::COL_ERROR, ), - self::TYPE_FIELDNAME => array('id', 'emailTo', 'emailBcc', 'emailFrom', 'subject', 'message', 'error', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'EmailTo', 'EmailBcc', 'EmailFrom', 'Subject', 'Message', 'Error', ], + self::TYPE_CAMELNAME => ['id', 'emailTo', 'emailBcc', 'emailFrom', 'subject', 'message', 'error', ], + self::TYPE_COLNAME => [EmailTableMap::COL_ID, EmailTableMap::COL_EMAILTO, EmailTableMap::COL_EMAILBCC, EmailTableMap::COL_EMAILFROM, EmailTableMap::COL_SUBJECT, EmailTableMap::COL_MESSAGE, EmailTableMap::COL_ERROR, ], + self::TYPE_FIELDNAME => ['id', 'emailTo', 'emailBcc', 'emailFrom', 'subject', 'message', 'error', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'EmailTo' => 1, 'EmailBcc' => 2, 'EmailFrom' => 3, 'Subject' => 4, 'Message' => 5, 'Error' => 6, ], + self::TYPE_CAMELNAME => ['id' => 0, 'emailTo' => 1, 'emailBcc' => 2, 'emailFrom' => 3, 'subject' => 4, 'message' => 5, 'error' => 6, ], + self::TYPE_COLNAME => [EmailTableMap::COL_ID => 0, EmailTableMap::COL_EMAILTO => 1, EmailTableMap::COL_EMAILBCC => 2, EmailTableMap::COL_EMAILFROM => 3, EmailTableMap::COL_SUBJECT => 4, EmailTableMap::COL_MESSAGE => 5, EmailTableMap::COL_ERROR => 6, ], + self::TYPE_FIELDNAME => ['id' => 0, 'emailTo' => 1, 'emailBcc' => 2, 'emailFrom' => 3, 'subject' => 4, 'message' => 5, 'error' => 6, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'EmailTo' => 1, 'EmailBcc' => 2, 'EmailFrom' => 3, 'Subject' => 4, 'Message' => 5, 'Error' => 6, ), - self::TYPE_CAMELNAME => array('id' => 0, 'emailTo' => 1, 'emailBcc' => 2, 'emailFrom' => 3, 'subject' => 4, 'message' => 5, 'error' => 6, ), - self::TYPE_COLNAME => array(EmailTableMap::COL_ID => 0, EmailTableMap::COL_EMAILTO => 1, EmailTableMap::COL_EMAILBCC => 2, EmailTableMap::COL_EMAILFROM => 3, EmailTableMap::COL_SUBJECT => 4, EmailTableMap::COL_MESSAGE => 5, EmailTableMap::COL_ERROR => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'emailTo' => 1, 'emailBcc' => 2, 'emailFrom' => 3, 'subject' => 4, 'message' => 5, 'error' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Email.Id' => 'ID', + 'id' => 'ID', + 'email.id' => 'ID', + 'EmailTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'emails.id' => 'ID', + 'EmailTo' => 'EMAILTO', + 'Email.EmailTo' => 'EMAILTO', + 'emailTo' => 'EMAILTO', + 'email.emailTo' => 'EMAILTO', + 'EmailTableMap::COL_EMAILTO' => 'EMAILTO', + 'COL_EMAILTO' => 'EMAILTO', + 'emails.emailTo' => 'EMAILTO', + 'EmailBcc' => 'EMAILBCC', + 'Email.EmailBcc' => 'EMAILBCC', + 'emailBcc' => 'EMAILBCC', + 'email.emailBcc' => 'EMAILBCC', + 'EmailTableMap::COL_EMAILBCC' => 'EMAILBCC', + 'COL_EMAILBCC' => 'EMAILBCC', + 'emails.emailBcc' => 'EMAILBCC', + 'EmailFrom' => 'EMAILFROM', + 'Email.EmailFrom' => 'EMAILFROM', + 'emailFrom' => 'EMAILFROM', + 'email.emailFrom' => 'EMAILFROM', + 'EmailTableMap::COL_EMAILFROM' => 'EMAILFROM', + 'COL_EMAILFROM' => 'EMAILFROM', + 'emails.emailFrom' => 'EMAILFROM', + 'Subject' => 'SUBJECT', + 'Email.Subject' => 'SUBJECT', + 'subject' => 'SUBJECT', + 'email.subject' => 'SUBJECT', + 'EmailTableMap::COL_SUBJECT' => 'SUBJECT', + 'COL_SUBJECT' => 'SUBJECT', + 'emails.subject' => 'SUBJECT', + 'Message' => 'MESSAGE', + 'Email.Message' => 'MESSAGE', + 'message' => 'MESSAGE', + 'email.message' => 'MESSAGE', + 'EmailTableMap::COL_MESSAGE' => 'MESSAGE', + 'COL_MESSAGE' => 'MESSAGE', + 'emails.message' => 'MESSAGE', + 'Error' => 'ERROR', + 'Email.Error' => 'ERROR', + 'error' => 'ERROR', + 'email.error' => 'ERROR', + 'EmailTableMap::COL_ERROR' => 'ERROR', + 'COL_ERROR' => 'ERROR', + 'emails.error' => 'ERROR', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('emails'); @@ -162,14 +228,16 @@ public function initialize() $this->addColumn('subject', 'Subject', 'VARCHAR', true, 150, null); $this->addColumn('message', 'Message', 'LONGVARCHAR', true, null, null); $this->addColumn('error', 'Error', 'LONGVARCHAR', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -177,14 +245,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -199,14 +267,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -223,10 +291,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? EmailTableMap::CLASS_DEFAULT : EmailTableMap::OM_CLASS; } @@ -234,17 +302,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Email object, last column rank) + * @return array (Email object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = EmailTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = EmailTableMap::getInstanceFromPool($key))) { @@ -260,7 +328,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: EmailTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -268,13 +336,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -304,12 +372,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(EmailTableMap::COL_ID); @@ -331,68 +400,90 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(EmailTableMap::DATABASE_NAME)->getTable(EmailTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(EmailTableMap::COL_ID); + $criteria->removeSelectColumn(EmailTableMap::COL_EMAILTO); + $criteria->removeSelectColumn(EmailTableMap::COL_EMAILBCC); + $criteria->removeSelectColumn(EmailTableMap::COL_EMAILFROM); + $criteria->removeSelectColumn(EmailTableMap::COL_SUBJECT); + $criteria->removeSelectColumn(EmailTableMap::COL_MESSAGE); + $criteria->removeSelectColumn(EmailTableMap::COL_ERROR); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.emailTo'); + $criteria->removeSelectColumn($alias . '.emailBcc'); + $criteria->removeSelectColumn($alias . '.emailFrom'); + $criteria->removeSelectColumn($alias . '.subject'); + $criteria->removeSelectColumn($alias . '.message'); + $criteria->removeSelectColumn($alias . '.error'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(EmailTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(EmailTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new EmailTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(EmailTableMap::DATABASE_NAME)->getTable(EmailTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Email or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Email object or primary key or array of primary keys + * @param mixed $values Criteria or Email object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(EmailTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(EmailTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Email) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Email) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(EmailTableMap::DATABASE_NAME); - $criteria->add(EmailTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(EmailTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = EmailQuery::create()->mergeWith($criteria); + $query = EmailQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - EmailTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + EmailTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { EmailTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the emails table. @@ -400,7 +491,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return EmailQuery::create()->doDeleteAll($con); } @@ -408,13 +499,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Email or Criteria object. * - * @param mixed $criteria Criteria or Email object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Email object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EmailTableMap::DATABASE_NAME); @@ -426,7 +517,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Email object } - if ($criteria->containsKey(EmailTableMap::COL_ID) && $criteria->keyContainsValue(EmailTableMap::COL_ID)) { + if ($criteria->containsKey(EmailTableMap::COL_ID) && $criteria->keyContainsValue(EmailTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.EmailTableMap::COL_ID.')'); } @@ -440,7 +531,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // EmailTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -EmailTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/EventGroupTableMap.php b/generated-classes/TechWilk/Rota/Map/EventGroupTableMap.php index d9823e5d..d5f336a9 100644 --- a/generated-classes/TechWilk/Rota/Map/EventGroupTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/EventGroupTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\EventGroup; use TechWilk\Rota\EventGroupQuery; + /** * This class defines the structure of the 'eventGroups' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class EventGroupTableMap extends TableMap { @@ -33,104 +33,149 @@ class EventGroupTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.EventGroupTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.EventGroupTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'eventGroups'; + public const TABLE_NAME = 'eventGroups'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'EventGroup'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\EventGroup'; + public const OM_CLASS = '\\TechWilk\\Rota\\EventGroup'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.EventGroup'; + public const CLASS_DEFAULT = 'TechWilk.Rota.EventGroup'; /** * The total number of columns */ - const NUM_COLUMNS = 4; + public const NUM_COLUMNS = 4; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 4; + public const NUM_HYDRATE_COLUMNS = 4; /** * the column name for the id field */ - const COL_ID = 'eventGroups.id'; + public const COL_ID = 'eventGroups.id'; /** * the column name for the name field */ - const COL_NAME = 'eventGroups.name'; + public const COL_NAME = 'eventGroups.name'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'eventGroups.description'; + public const COL_DESCRIPTION = 'eventGroups.description'; /** * the column name for the archived field */ - const COL_ARCHIVED = 'eventGroups.archived'; + public const COL_ARCHIVED = 'eventGroups.archived'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Description', 'Archived', ), - self::TYPE_CAMELNAME => array('id', 'name', 'description', 'archived', ), - self::TYPE_COLNAME => array(EventGroupTableMap::COL_ID, EventGroupTableMap::COL_NAME, EventGroupTableMap::COL_DESCRIPTION, EventGroupTableMap::COL_ARCHIVED, ), - self::TYPE_FIELDNAME => array('id', 'name', 'description', 'archived', ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Description', 'Archived', ], + self::TYPE_CAMELNAME => ['id', 'name', 'description', 'archived', ], + self::TYPE_COLNAME => [EventGroupTableMap::COL_ID, EventGroupTableMap::COL_NAME, EventGroupTableMap::COL_DESCRIPTION, EventGroupTableMap::COL_ARCHIVED, ], + self::TYPE_FIELDNAME => ['id', 'name', 'description', 'archived', ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Description' => 2, 'Archived' => 3, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'archived' => 3, ], + self::TYPE_COLNAME => [EventGroupTableMap::COL_ID => 0, EventGroupTableMap::COL_NAME => 1, EventGroupTableMap::COL_DESCRIPTION => 2, EventGroupTableMap::COL_ARCHIVED => 3, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'archived' => 3, ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Description' => 2, 'Archived' => 3, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'archived' => 3, ), - self::TYPE_COLNAME => array(EventGroupTableMap::COL_ID => 0, EventGroupTableMap::COL_NAME => 1, EventGroupTableMap::COL_DESCRIPTION => 2, EventGroupTableMap::COL_ARCHIVED => 3, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'archived' => 3, ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'EventGroup.Id' => 'ID', + 'id' => 'ID', + 'eventGroup.id' => 'ID', + 'EventGroupTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'eventGroups.id' => 'ID', + 'Name' => 'NAME', + 'EventGroup.Name' => 'NAME', + 'name' => 'NAME', + 'eventGroup.name' => 'NAME', + 'EventGroupTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'eventGroups.name' => 'NAME', + 'Description' => 'DESCRIPTION', + 'EventGroup.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'eventGroup.description' => 'DESCRIPTION', + 'EventGroupTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'eventGroups.description' => 'DESCRIPTION', + 'Archived' => 'ARCHIVED', + 'EventGroup.Archived' => 'ARCHIVED', + 'archived' => 'ARCHIVED', + 'eventGroup.archived' => 'ARCHIVED', + 'EventGroupTableMap::COL_ARCHIVED' => 'ARCHIVED', + 'COL_ARCHIVED' => 'ARCHIVED', + 'eventGroups.archived' => 'ARCHIVED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('eventGroups'); @@ -144,21 +189,23 @@ public function initialize() $this->addColumn('name', 'Name', 'VARCHAR', true, 128, ''); $this->addColumn('description', 'Description', 'LONGVARCHAR', true, null, null); $this->addColumn('archived', 'Archived', 'BOOLEAN', true, 1, false); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':eventGroup', 1 => ':id', ), ), null, null, 'Events', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -166,14 +213,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -188,14 +235,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -212,10 +259,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? EventGroupTableMap::CLASS_DEFAULT : EventGroupTableMap::OM_CLASS; } @@ -223,17 +270,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (EventGroup object, last column rank) + * @return array (EventGroup object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = EventGroupTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = EventGroupTableMap::getInstanceFromPool($key))) { @@ -249,7 +296,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: EventGroupTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -257,13 +304,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -293,12 +340,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(EventGroupTableMap::COL_ID); @@ -314,68 +362,84 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(EventGroupTableMap::DATABASE_NAME)->getTable(EventGroupTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(EventGroupTableMap::COL_ID); + $criteria->removeSelectColumn(EventGroupTableMap::COL_NAME); + $criteria->removeSelectColumn(EventGroupTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(EventGroupTableMap::COL_ARCHIVED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.archived'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(EventGroupTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(EventGroupTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new EventGroupTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(EventGroupTableMap::DATABASE_NAME)->getTable(EventGroupTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a EventGroup or Criteria object OR a primary key value. * - * @param mixed $values Criteria or EventGroup object or primary key or array of primary keys + * @param mixed $values Criteria or EventGroup object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(EventGroupTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(EventGroupTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\EventGroup) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\EventGroup) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(EventGroupTableMap::DATABASE_NAME); - $criteria->add(EventGroupTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(EventGroupTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = EventGroupQuery::create()->mergeWith($criteria); + $query = EventGroupQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - EventGroupTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + EventGroupTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { EventGroupTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the eventGroups table. @@ -383,7 +447,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return EventGroupQuery::create()->doDeleteAll($con); } @@ -391,13 +455,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a EventGroup or Criteria object. * - * @param mixed $criteria Criteria or EventGroup object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or EventGroup object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventGroupTableMap::DATABASE_NAME); @@ -409,7 +473,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from EventGroup object } - if ($criteria->containsKey(EventGroupTableMap::COL_ID) && $criteria->keyContainsValue(EventGroupTableMap::COL_ID)) { + if ($criteria->containsKey(EventGroupTableMap::COL_ID) && $criteria->keyContainsValue(EventGroupTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.EventGroupTableMap::COL_ID.')'); } @@ -423,7 +487,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // EventGroupTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -EventGroupTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/EventPersonTableMap.php b/generated-classes/TechWilk/Rota/Map/EventPersonTableMap.php index 15817f23..3726dd7c 100644 --- a/generated-classes/TechWilk/Rota/Map/EventPersonTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/EventPersonTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\EventPerson; use TechWilk\Rota\EventPersonQuery; + /** * This class defines the structure of the 'eventPeople' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class EventPersonTableMap extends TableMap { @@ -33,109 +33,161 @@ class EventPersonTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.EventPersonTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.EventPersonTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'eventPeople'; + public const TABLE_NAME = 'eventPeople'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'EventPerson'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\EventPerson'; + public const OM_CLASS = '\\TechWilk\\Rota\\EventPerson'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.EventPerson'; + public const CLASS_DEFAULT = 'TechWilk.Rota.EventPerson'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + public const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + public const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the id field */ - const COL_ID = 'eventPeople.id'; + public const COL_ID = 'eventPeople.id'; /** * the column name for the eventId field */ - const COL_EVENTID = 'eventPeople.eventId'; + public const COL_EVENTID = 'eventPeople.eventId'; /** * the column name for the userRoleId field */ - const COL_USERROLEID = 'eventPeople.userRoleId'; + public const COL_USERROLEID = 'eventPeople.userRoleId'; /** * the column name for the notified field */ - const COL_NOTIFIED = 'eventPeople.notified'; + public const COL_NOTIFIED = 'eventPeople.notified'; /** * the column name for the removed field */ - const COL_REMOVED = 'eventPeople.removed'; + public const COL_REMOVED = 'eventPeople.removed'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'EventId', 'UserRoleId', 'Notified', 'Removed', ), - self::TYPE_CAMELNAME => array('id', 'eventId', 'userRoleId', 'notified', 'removed', ), - self::TYPE_COLNAME => array(EventPersonTableMap::COL_ID, EventPersonTableMap::COL_EVENTID, EventPersonTableMap::COL_USERROLEID, EventPersonTableMap::COL_NOTIFIED, EventPersonTableMap::COL_REMOVED, ), - self::TYPE_FIELDNAME => array('id', 'eventId', 'userRoleId', 'notified', 'removed', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'EventId', 'UserRoleId', 'Notified', 'Removed', ], + self::TYPE_CAMELNAME => ['id', 'eventId', 'userRoleId', 'notified', 'removed', ], + self::TYPE_COLNAME => [EventPersonTableMap::COL_ID, EventPersonTableMap::COL_EVENTID, EventPersonTableMap::COL_USERROLEID, EventPersonTableMap::COL_NOTIFIED, EventPersonTableMap::COL_REMOVED, ], + self::TYPE_FIELDNAME => ['id', 'eventId', 'userRoleId', 'notified', 'removed', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'EventId' => 1, 'UserRoleId' => 2, 'Notified' => 3, 'Removed' => 4, ], + self::TYPE_CAMELNAME => ['id' => 0, 'eventId' => 1, 'userRoleId' => 2, 'notified' => 3, 'removed' => 4, ], + self::TYPE_COLNAME => [EventPersonTableMap::COL_ID => 0, EventPersonTableMap::COL_EVENTID => 1, EventPersonTableMap::COL_USERROLEID => 2, EventPersonTableMap::COL_NOTIFIED => 3, EventPersonTableMap::COL_REMOVED => 4, ], + self::TYPE_FIELDNAME => ['id' => 0, 'eventId' => 1, 'userRoleId' => 2, 'notified' => 3, 'removed' => 4, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'EventId' => 1, 'UserRoleId' => 2, 'Notified' => 3, 'Removed' => 4, ), - self::TYPE_CAMELNAME => array('id' => 0, 'eventId' => 1, 'userRoleId' => 2, 'notified' => 3, 'removed' => 4, ), - self::TYPE_COLNAME => array(EventPersonTableMap::COL_ID => 0, EventPersonTableMap::COL_EVENTID => 1, EventPersonTableMap::COL_USERROLEID => 2, EventPersonTableMap::COL_NOTIFIED => 3, EventPersonTableMap::COL_REMOVED => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'eventId' => 1, 'userRoleId' => 2, 'notified' => 3, 'removed' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'EventPerson.Id' => 'ID', + 'id' => 'ID', + 'eventPerson.id' => 'ID', + 'EventPersonTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'eventPeople.id' => 'ID', + 'EventId' => 'EVENTID', + 'EventPerson.EventId' => 'EVENTID', + 'eventId' => 'EVENTID', + 'eventPerson.eventId' => 'EVENTID', + 'EventPersonTableMap::COL_EVENTID' => 'EVENTID', + 'COL_EVENTID' => 'EVENTID', + 'eventPeople.eventId' => 'EVENTID', + 'UserRoleId' => 'USERROLEID', + 'EventPerson.UserRoleId' => 'USERROLEID', + 'userRoleId' => 'USERROLEID', + 'eventPerson.userRoleId' => 'USERROLEID', + 'EventPersonTableMap::COL_USERROLEID' => 'USERROLEID', + 'COL_USERROLEID' => 'USERROLEID', + 'eventPeople.userRoleId' => 'USERROLEID', + 'Notified' => 'NOTIFIED', + 'EventPerson.Notified' => 'NOTIFIED', + 'notified' => 'NOTIFIED', + 'eventPerson.notified' => 'NOTIFIED', + 'EventPersonTableMap::COL_NOTIFIED' => 'NOTIFIED', + 'COL_NOTIFIED' => 'NOTIFIED', + 'eventPeople.notified' => 'NOTIFIED', + 'Removed' => 'REMOVED', + 'EventPerson.Removed' => 'REMOVED', + 'removed' => 'REMOVED', + 'eventPerson.removed' => 'REMOVED', + 'EventPersonTableMap::COL_REMOVED' => 'REMOVED', + 'COL_REMOVED' => 'REMOVED', + 'eventPeople.removed' => 'REMOVED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('eventPeople'); @@ -150,35 +202,37 @@ public function initialize() $this->addForeignKey('userRoleId', 'UserRoleId', 'INTEGER', 'userRoles', 'id', true, null, 0); $this->addColumn('notified', 'Notified', 'SMALLINT', true, 1, 0); $this->addColumn('removed', 'Removed', 'SMALLINT', false, 1, 0); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':eventId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('UserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::MANY_TO_ONE, array( + $this->addRelation('UserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userRoleId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('Swap', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Swap', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':eventPersonId', 1 => ':id', ), ), null, null, 'Swaps', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -186,14 +240,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -208,14 +262,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -232,10 +286,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? EventPersonTableMap::CLASS_DEFAULT : EventPersonTableMap::OM_CLASS; } @@ -243,17 +297,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (EventPerson object, last column rank) + * @return array (EventPerson object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = EventPersonTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = EventPersonTableMap::getInstanceFromPool($key))) { @@ -269,7 +323,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: EventPersonTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -277,13 +331,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -313,12 +367,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(EventPersonTableMap::COL_ID); @@ -336,68 +391,86 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(EventPersonTableMap::DATABASE_NAME)->getTable(EventPersonTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(EventPersonTableMap::COL_ID); + $criteria->removeSelectColumn(EventPersonTableMap::COL_EVENTID); + $criteria->removeSelectColumn(EventPersonTableMap::COL_USERROLEID); + $criteria->removeSelectColumn(EventPersonTableMap::COL_NOTIFIED); + $criteria->removeSelectColumn(EventPersonTableMap::COL_REMOVED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.eventId'); + $criteria->removeSelectColumn($alias . '.userRoleId'); + $criteria->removeSelectColumn($alias . '.notified'); + $criteria->removeSelectColumn($alias . '.removed'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(EventPersonTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(EventPersonTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new EventPersonTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(EventPersonTableMap::DATABASE_NAME)->getTable(EventPersonTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a EventPerson or Criteria object OR a primary key value. * - * @param mixed $values Criteria or EventPerson object or primary key or array of primary keys + * @param mixed $values Criteria or EventPerson object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(EventPersonTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(EventPersonTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\EventPerson) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\EventPerson) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(EventPersonTableMap::DATABASE_NAME); - $criteria->add(EventPersonTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(EventPersonTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = EventPersonQuery::create()->mergeWith($criteria); + $query = EventPersonQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - EventPersonTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + EventPersonTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { EventPersonTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the eventPeople table. @@ -405,7 +478,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return EventPersonQuery::create()->doDeleteAll($con); } @@ -413,13 +486,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a EventPerson or Criteria object. * - * @param mixed $criteria Criteria or EventPerson object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or EventPerson object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventPersonTableMap::DATABASE_NAME); @@ -431,7 +504,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from EventPerson object } - if ($criteria->containsKey(EventPersonTableMap::COL_ID) && $criteria->keyContainsValue(EventPersonTableMap::COL_ID)) { + if ($criteria->containsKey(EventPersonTableMap::COL_ID) && $criteria->keyContainsValue(EventPersonTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.EventPersonTableMap::COL_ID.')'); } @@ -445,7 +518,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // EventPersonTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -EventPersonTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/EventSubTypeTableMap.php b/generated-classes/TechWilk/Rota/Map/EventSubTypeTableMap.php index e9d5cce9..28608722 100644 --- a/generated-classes/TechWilk/Rota/Map/EventSubTypeTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/EventSubTypeTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\EventSubType; use TechWilk\Rota\EventSubTypeQuery; + /** * This class defines the structure of the 'eventSubTypes' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class EventSubTypeTableMap extends TableMap { @@ -33,99 +33,137 @@ class EventSubTypeTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.EventSubTypeTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.EventSubTypeTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'eventSubTypes'; + public const TABLE_NAME = 'eventSubTypes'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'EventSubType'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\EventSubType'; + public const OM_CLASS = '\\TechWilk\\Rota\\EventSubType'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.EventSubType'; + public const CLASS_DEFAULT = 'TechWilk.Rota.EventSubType'; /** * The total number of columns */ - const NUM_COLUMNS = 3; + public const NUM_COLUMNS = 3; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 3; + public const NUM_HYDRATE_COLUMNS = 3; /** * the column name for the id field */ - const COL_ID = 'eventSubTypes.id'; + public const COL_ID = 'eventSubTypes.id'; /** * the column name for the name field */ - const COL_NAME = 'eventSubTypes.name'; + public const COL_NAME = 'eventSubTypes.name'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'eventSubTypes.description'; + public const COL_DESCRIPTION = 'eventSubTypes.description'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Description', ), - self::TYPE_CAMELNAME => array('id', 'name', 'description', ), - self::TYPE_COLNAME => array(EventSubTypeTableMap::COL_ID, EventSubTypeTableMap::COL_NAME, EventSubTypeTableMap::COL_DESCRIPTION, ), - self::TYPE_FIELDNAME => array('id', 'name', 'description', ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Description', ], + self::TYPE_CAMELNAME => ['id', 'name', 'description', ], + self::TYPE_COLNAME => [EventSubTypeTableMap::COL_ID, EventSubTypeTableMap::COL_NAME, EventSubTypeTableMap::COL_DESCRIPTION, ], + self::TYPE_FIELDNAME => ['id', 'name', 'description', ], + self::TYPE_NUM => [0, 1, 2, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Description' => 2, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'description' => 2, ], + self::TYPE_COLNAME => [EventSubTypeTableMap::COL_ID => 0, EventSubTypeTableMap::COL_NAME => 1, EventSubTypeTableMap::COL_DESCRIPTION => 2, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'description' => 2, ], + self::TYPE_NUM => [0, 1, 2, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Description' => 2, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'description' => 2, ), - self::TYPE_COLNAME => array(EventSubTypeTableMap::COL_ID => 0, EventSubTypeTableMap::COL_NAME => 1, EventSubTypeTableMap::COL_DESCRIPTION => 2, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'description' => 2, ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'EventSubType.Id' => 'ID', + 'id' => 'ID', + 'eventSubType.id' => 'ID', + 'EventSubTypeTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'eventSubTypes.id' => 'ID', + 'Name' => 'NAME', + 'EventSubType.Name' => 'NAME', + 'name' => 'NAME', + 'eventSubType.name' => 'NAME', + 'EventSubTypeTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'eventSubTypes.name' => 'NAME', + 'Description' => 'DESCRIPTION', + 'EventSubType.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'eventSubType.description' => 'DESCRIPTION', + 'EventSubTypeTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'eventSubTypes.description' => 'DESCRIPTION', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('eventSubTypes'); @@ -138,21 +176,23 @@ public function initialize() $this->addPrimaryKey('id', 'Id', 'INTEGER', true, 30, null); $this->addColumn('name', 'Name', 'VARCHAR', true, 128, ''); $this->addColumn('description', 'Description', 'LONGVARCHAR', true, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':subType', 1 => ':id', ), ), null, null, 'Events', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -160,14 +200,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -182,14 +222,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -206,10 +246,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? EventSubTypeTableMap::CLASS_DEFAULT : EventSubTypeTableMap::OM_CLASS; } @@ -217,17 +257,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (EventSubType object, last column rank) + * @return array (EventSubType object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = EventSubTypeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = EventSubTypeTableMap::getInstanceFromPool($key))) { @@ -243,7 +283,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: EventSubTypeTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -251,13 +291,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -287,12 +327,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(EventSubTypeTableMap::COL_ID); @@ -306,68 +347,82 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(EventSubTypeTableMap::DATABASE_NAME)->getTable(EventSubTypeTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(EventSubTypeTableMap::COL_ID); + $criteria->removeSelectColumn(EventSubTypeTableMap::COL_NAME); + $criteria->removeSelectColumn(EventSubTypeTableMap::COL_DESCRIPTION); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.description'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(EventSubTypeTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(EventSubTypeTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new EventSubTypeTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(EventSubTypeTableMap::DATABASE_NAME)->getTable(EventSubTypeTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a EventSubType or Criteria object OR a primary key value. * - * @param mixed $values Criteria or EventSubType object or primary key or array of primary keys + * @param mixed $values Criteria or EventSubType object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(EventSubTypeTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(EventSubTypeTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\EventSubType) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\EventSubType) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(EventSubTypeTableMap::DATABASE_NAME); - $criteria->add(EventSubTypeTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(EventSubTypeTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = EventSubTypeQuery::create()->mergeWith($criteria); + $query = EventSubTypeQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - EventSubTypeTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + EventSubTypeTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { EventSubTypeTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the eventSubTypes table. @@ -375,7 +430,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return EventSubTypeQuery::create()->doDeleteAll($con); } @@ -383,13 +438,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a EventSubType or Criteria object. * - * @param mixed $criteria Criteria or EventSubType object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or EventSubType object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventSubTypeTableMap::DATABASE_NAME); @@ -401,7 +456,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from EventSubType object } - if ($criteria->containsKey(EventSubTypeTableMap::COL_ID) && $criteria->keyContainsValue(EventSubTypeTableMap::COL_ID)) { + if ($criteria->containsKey(EventSubTypeTableMap::COL_ID) && $criteria->keyContainsValue(EventSubTypeTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.EventSubTypeTableMap::COL_ID.')'); } @@ -415,7 +470,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // EventSubTypeTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -EventSubTypeTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/EventTableMap.php b/generated-classes/TechWilk/Rota/Map/EventTableMap.php index 4c505ae9..6d7dd2d4 100644 --- a/generated-classes/TechWilk/Rota/Map/EventTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/EventTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Event; use TechWilk\Rota\EventQuery; + /** * This class defines the structure of the 'events' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class EventTableMap extends TableMap { @@ -33,164 +33,297 @@ class EventTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.EventTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.EventTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'events'; + public const TABLE_NAME = 'events'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Event'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Event'; + public const OM_CLASS = '\\TechWilk\\Rota\\Event'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Event'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Event'; /** * The total number of columns */ - const NUM_COLUMNS = 16; + public const NUM_COLUMNS = 16; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 16; + public const NUM_HYDRATE_COLUMNS = 16; /** * the column name for the id field */ - const COL_ID = 'events.id'; + public const COL_ID = 'events.id'; /** * the column name for the date field */ - const COL_DATE = 'events.date'; + public const COL_DATE = 'events.date'; /** * the column name for the name field */ - const COL_NAME = 'events.name'; + public const COL_NAME = 'events.name'; /** * the column name for the createdBy field */ - const COL_CREATEDBY = 'events.createdBy'; + public const COL_CREATEDBY = 'events.createdBy'; /** * the column name for the rehearsalDate field */ - const COL_REHEARSALDATE = 'events.rehearsalDate'; + public const COL_REHEARSALDATE = 'events.rehearsalDate'; /** * the column name for the type field */ - const COL_TYPE = 'events.type'; + public const COL_TYPE = 'events.type'; /** * the column name for the subType field */ - const COL_SUBTYPE = 'events.subType'; + public const COL_SUBTYPE = 'events.subType'; /** * the column name for the location field */ - const COL_LOCATION = 'events.location'; + public const COL_LOCATION = 'events.location'; /** * the column name for the notified field */ - const COL_NOTIFIED = 'events.notified'; + public const COL_NOTIFIED = 'events.notified'; /** * the column name for the rehearsal field */ - const COL_REHEARSAL = 'events.rehearsal'; + public const COL_REHEARSAL = 'events.rehearsal'; /** * the column name for the removed field */ - const COL_REMOVED = 'events.removed'; + public const COL_REMOVED = 'events.removed'; /** * the column name for the eventGroup field */ - const COL_EVENTGROUP = 'events.eventGroup'; + public const COL_EVENTGROUP = 'events.eventGroup'; /** * the column name for the sermonTitle field */ - const COL_SERMONTITLE = 'events.sermonTitle'; + public const COL_SERMONTITLE = 'events.sermonTitle'; /** * the column name for the bibleVerse field */ - const COL_BIBLEVERSE = 'events.bibleVerse'; + public const COL_BIBLEVERSE = 'events.bibleVerse'; /** * the column name for the created field */ - const COL_CREATED = 'events.created'; + public const COL_CREATED = 'events.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'events.updated'; + public const COL_UPDATED = 'events.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Date', 'Name', 'CreatedBy', 'RehearsalDate', 'EventTypeId', 'EventSubTypeId', 'LocationId', 'Notified', 'Rehearsal', 'Removed', 'EventGroupId', 'SermonTitle', 'BibleVerse', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'date', 'name', 'createdBy', 'rehearsalDate', 'eventTypeId', 'eventSubTypeId', 'locationId', 'notified', 'rehearsal', 'removed', 'eventGroupId', 'sermonTitle', 'bibleVerse', 'created', 'updated', ), - self::TYPE_COLNAME => array(EventTableMap::COL_ID, EventTableMap::COL_DATE, EventTableMap::COL_NAME, EventTableMap::COL_CREATEDBY, EventTableMap::COL_REHEARSALDATE, EventTableMap::COL_TYPE, EventTableMap::COL_SUBTYPE, EventTableMap::COL_LOCATION, EventTableMap::COL_NOTIFIED, EventTableMap::COL_REHEARSAL, EventTableMap::COL_REMOVED, EventTableMap::COL_EVENTGROUP, EventTableMap::COL_SERMONTITLE, EventTableMap::COL_BIBLEVERSE, EventTableMap::COL_CREATED, EventTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'date', 'name', 'createdBy', 'rehearsalDate', 'type', 'subType', 'location', 'notified', 'rehearsal', 'removed', 'eventGroup', 'sermonTitle', 'bibleVerse', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Date', 'Name', 'CreatedBy', 'RehearsalDate', 'EventTypeId', 'EventSubTypeId', 'LocationId', 'Notified', 'Rehearsal', 'Removed', 'EventGroupId', 'SermonTitle', 'BibleVerse', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'date', 'name', 'createdBy', 'rehearsalDate', 'eventTypeId', 'eventSubTypeId', 'locationId', 'notified', 'rehearsal', 'removed', 'eventGroupId', 'sermonTitle', 'bibleVerse', 'created', 'updated', ], + self::TYPE_COLNAME => [EventTableMap::COL_ID, EventTableMap::COL_DATE, EventTableMap::COL_NAME, EventTableMap::COL_CREATEDBY, EventTableMap::COL_REHEARSALDATE, EventTableMap::COL_TYPE, EventTableMap::COL_SUBTYPE, EventTableMap::COL_LOCATION, EventTableMap::COL_NOTIFIED, EventTableMap::COL_REHEARSAL, EventTableMap::COL_REMOVED, EventTableMap::COL_EVENTGROUP, EventTableMap::COL_SERMONTITLE, EventTableMap::COL_BIBLEVERSE, EventTableMap::COL_CREATED, EventTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'date', 'name', 'createdBy', 'rehearsalDate', 'type', 'subType', 'location', 'notified', 'rehearsal', 'removed', 'eventGroup', 'sermonTitle', 'bibleVerse', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Date' => 1, 'Name' => 2, 'CreatedBy' => 3, 'RehearsalDate' => 4, 'EventTypeId' => 5, 'EventSubTypeId' => 6, 'LocationId' => 7, 'Notified' => 8, 'Rehearsal' => 9, 'Removed' => 10, 'EventGroupId' => 11, 'SermonTitle' => 12, 'BibleVerse' => 13, 'Created' => 14, 'Updated' => 15, ), - self::TYPE_CAMELNAME => array('id' => 0, 'date' => 1, 'name' => 2, 'createdBy' => 3, 'rehearsalDate' => 4, 'eventTypeId' => 5, 'eventSubTypeId' => 6, 'locationId' => 7, 'notified' => 8, 'rehearsal' => 9, 'removed' => 10, 'eventGroupId' => 11, 'sermonTitle' => 12, 'bibleVerse' => 13, 'created' => 14, 'updated' => 15, ), - self::TYPE_COLNAME => array(EventTableMap::COL_ID => 0, EventTableMap::COL_DATE => 1, EventTableMap::COL_NAME => 2, EventTableMap::COL_CREATEDBY => 3, EventTableMap::COL_REHEARSALDATE => 4, EventTableMap::COL_TYPE => 5, EventTableMap::COL_SUBTYPE => 6, EventTableMap::COL_LOCATION => 7, EventTableMap::COL_NOTIFIED => 8, EventTableMap::COL_REHEARSAL => 9, EventTableMap::COL_REMOVED => 10, EventTableMap::COL_EVENTGROUP => 11, EventTableMap::COL_SERMONTITLE => 12, EventTableMap::COL_BIBLEVERSE => 13, EventTableMap::COL_CREATED => 14, EventTableMap::COL_UPDATED => 15, ), - self::TYPE_FIELDNAME => array('id' => 0, 'date' => 1, 'name' => 2, 'createdBy' => 3, 'rehearsalDate' => 4, 'type' => 5, 'subType' => 6, 'location' => 7, 'notified' => 8, 'rehearsal' => 9, 'removed' => 10, 'eventGroup' => 11, 'sermonTitle' => 12, 'bibleVerse' => 13, 'created' => 14, 'updated' => 15, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Date' => 1, 'Name' => 2, 'CreatedBy' => 3, 'RehearsalDate' => 4, 'EventTypeId' => 5, 'EventSubTypeId' => 6, 'LocationId' => 7, 'Notified' => 8, 'Rehearsal' => 9, 'Removed' => 10, 'EventGroupId' => 11, 'SermonTitle' => 12, 'BibleVerse' => 13, 'Created' => 14, 'Updated' => 15, ], + self::TYPE_CAMELNAME => ['id' => 0, 'date' => 1, 'name' => 2, 'createdBy' => 3, 'rehearsalDate' => 4, 'eventTypeId' => 5, 'eventSubTypeId' => 6, 'locationId' => 7, 'notified' => 8, 'rehearsal' => 9, 'removed' => 10, 'eventGroupId' => 11, 'sermonTitle' => 12, 'bibleVerse' => 13, 'created' => 14, 'updated' => 15, ], + self::TYPE_COLNAME => [EventTableMap::COL_ID => 0, EventTableMap::COL_DATE => 1, EventTableMap::COL_NAME => 2, EventTableMap::COL_CREATEDBY => 3, EventTableMap::COL_REHEARSALDATE => 4, EventTableMap::COL_TYPE => 5, EventTableMap::COL_SUBTYPE => 6, EventTableMap::COL_LOCATION => 7, EventTableMap::COL_NOTIFIED => 8, EventTableMap::COL_REHEARSAL => 9, EventTableMap::COL_REMOVED => 10, EventTableMap::COL_EVENTGROUP => 11, EventTableMap::COL_SERMONTITLE => 12, EventTableMap::COL_BIBLEVERSE => 13, EventTableMap::COL_CREATED => 14, EventTableMap::COL_UPDATED => 15, ], + self::TYPE_FIELDNAME => ['id' => 0, 'date' => 1, 'name' => 2, 'createdBy' => 3, 'rehearsalDate' => 4, 'type' => 5, 'subType' => 6, 'location' => 7, 'notified' => 8, 'rehearsal' => 9, 'removed' => 10, 'eventGroup' => 11, 'sermonTitle' => 12, 'bibleVerse' => 13, 'created' => 14, 'updated' => 15, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Event.Id' => 'ID', + 'id' => 'ID', + 'event.id' => 'ID', + 'EventTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'events.id' => 'ID', + 'Date' => 'DATE', + 'Event.Date' => 'DATE', + 'date' => 'DATE', + 'event.date' => 'DATE', + 'EventTableMap::COL_DATE' => 'DATE', + 'COL_DATE' => 'DATE', + 'events.date' => 'DATE', + 'Name' => 'NAME', + 'Event.Name' => 'NAME', + 'name' => 'NAME', + 'event.name' => 'NAME', + 'EventTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'events.name' => 'NAME', + 'CreatedBy' => 'CREATEDBY', + 'Event.CreatedBy' => 'CREATEDBY', + 'createdBy' => 'CREATEDBY', + 'event.createdBy' => 'CREATEDBY', + 'EventTableMap::COL_CREATEDBY' => 'CREATEDBY', + 'COL_CREATEDBY' => 'CREATEDBY', + 'events.createdBy' => 'CREATEDBY', + 'RehearsalDate' => 'REHEARSALDATE', + 'Event.RehearsalDate' => 'REHEARSALDATE', + 'rehearsalDate' => 'REHEARSALDATE', + 'event.rehearsalDate' => 'REHEARSALDATE', + 'EventTableMap::COL_REHEARSALDATE' => 'REHEARSALDATE', + 'COL_REHEARSALDATE' => 'REHEARSALDATE', + 'events.rehearsalDate' => 'REHEARSALDATE', + 'EventTypeId' => 'TYPE', + 'Event.EventTypeId' => 'TYPE', + 'eventTypeId' => 'TYPE', + 'event.eventTypeId' => 'TYPE', + 'EventTableMap::COL_TYPE' => 'TYPE', + 'COL_TYPE' => 'TYPE', + 'type' => 'TYPE', + 'events.type' => 'TYPE', + 'EventSubTypeId' => 'SUBTYPE', + 'Event.EventSubTypeId' => 'SUBTYPE', + 'eventSubTypeId' => 'SUBTYPE', + 'event.eventSubTypeId' => 'SUBTYPE', + 'EventTableMap::COL_SUBTYPE' => 'SUBTYPE', + 'COL_SUBTYPE' => 'SUBTYPE', + 'subType' => 'SUBTYPE', + 'events.subType' => 'SUBTYPE', + 'LocationId' => 'LOCATION', + 'Event.LocationId' => 'LOCATION', + 'locationId' => 'LOCATION', + 'event.locationId' => 'LOCATION', + 'EventTableMap::COL_LOCATION' => 'LOCATION', + 'COL_LOCATION' => 'LOCATION', + 'location' => 'LOCATION', + 'events.location' => 'LOCATION', + 'Notified' => 'NOTIFIED', + 'Event.Notified' => 'NOTIFIED', + 'notified' => 'NOTIFIED', + 'event.notified' => 'NOTIFIED', + 'EventTableMap::COL_NOTIFIED' => 'NOTIFIED', + 'COL_NOTIFIED' => 'NOTIFIED', + 'events.notified' => 'NOTIFIED', + 'Rehearsal' => 'REHEARSAL', + 'Event.Rehearsal' => 'REHEARSAL', + 'rehearsal' => 'REHEARSAL', + 'event.rehearsal' => 'REHEARSAL', + 'EventTableMap::COL_REHEARSAL' => 'REHEARSAL', + 'COL_REHEARSAL' => 'REHEARSAL', + 'events.rehearsal' => 'REHEARSAL', + 'Removed' => 'REMOVED', + 'Event.Removed' => 'REMOVED', + 'removed' => 'REMOVED', + 'event.removed' => 'REMOVED', + 'EventTableMap::COL_REMOVED' => 'REMOVED', + 'COL_REMOVED' => 'REMOVED', + 'events.removed' => 'REMOVED', + 'EventGroupId' => 'EVENTGROUP', + 'Event.EventGroupId' => 'EVENTGROUP', + 'eventGroupId' => 'EVENTGROUP', + 'event.eventGroupId' => 'EVENTGROUP', + 'EventTableMap::COL_EVENTGROUP' => 'EVENTGROUP', + 'COL_EVENTGROUP' => 'EVENTGROUP', + 'eventGroup' => 'EVENTGROUP', + 'events.eventGroup' => 'EVENTGROUP', + 'SermonTitle' => 'SERMONTITLE', + 'Event.SermonTitle' => 'SERMONTITLE', + 'sermonTitle' => 'SERMONTITLE', + 'event.sermonTitle' => 'SERMONTITLE', + 'EventTableMap::COL_SERMONTITLE' => 'SERMONTITLE', + 'COL_SERMONTITLE' => 'SERMONTITLE', + 'events.sermonTitle' => 'SERMONTITLE', + 'BibleVerse' => 'BIBLEVERSE', + 'Event.BibleVerse' => 'BIBLEVERSE', + 'bibleVerse' => 'BIBLEVERSE', + 'event.bibleVerse' => 'BIBLEVERSE', + 'EventTableMap::COL_BIBLEVERSE' => 'BIBLEVERSE', + 'COL_BIBLEVERSE' => 'BIBLEVERSE', + 'events.bibleVerse' => 'BIBLEVERSE', + 'Created' => 'CREATED', + 'Event.Created' => 'CREATED', + 'created' => 'CREATED', + 'event.created' => 'CREATED', + 'EventTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'events.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'Event.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'event.updated' => 'UPDATED', + 'EventTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'events.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('events'); @@ -216,83 +349,85 @@ public function initialize() $this->addColumn('bibleVerse', 'BibleVerse', 'VARCHAR', false, 64, null); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':createdBy', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('EventType', '\\TechWilk\\Rota\\EventType', RelationMap::MANY_TO_ONE, array( + $this->addRelation('EventType', '\\TechWilk\\Rota\\EventType', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':type', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('EventSubType', '\\TechWilk\\Rota\\EventSubType', RelationMap::MANY_TO_ONE, array( + $this->addRelation('EventSubType', '\\TechWilk\\Rota\\EventSubType', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':subType', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('Location', '\\TechWilk\\Rota\\Location', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Location', '\\TechWilk\\Rota\\Location', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':location', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('EventGroup', '\\TechWilk\\Rota\\EventGroup', RelationMap::MANY_TO_ONE, array( + $this->addRelation('EventGroup', '\\TechWilk\\Rota\\EventGroup', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':eventGroup', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('Comment', '\\TechWilk\\Rota\\Comment', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Comment', '\\TechWilk\\Rota\\Comment', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':eventId', 1 => ':id', ), ), null, null, 'Comments', false); - $this->addRelation('EventPerson', '\\TechWilk\\Rota\\EventPerson', RelationMap::ONE_TO_MANY, array( + $this->addRelation('EventPerson', '\\TechWilk\\Rota\\EventPerson', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':eventId', 1 => ':id', ), ), null, null, 'Eventpeople', false); - $this->addRelation('Availability', '\\TechWilk\\Rota\\Availability', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Availability', '\\TechWilk\\Rota\\Availability', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':eventId', 1 => ':id', ), ), null, null, 'Availabilities', false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -300,14 +435,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -322,14 +457,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -346,10 +481,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? EventTableMap::CLASS_DEFAULT : EventTableMap::OM_CLASS; } @@ -357,17 +492,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Event object, last column rank) + * @return array (Event object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = EventTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = EventTableMap::getInstanceFromPool($key))) { @@ -383,7 +518,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: EventTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -391,13 +526,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -427,12 +562,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(EventTableMap::COL_ID); @@ -472,68 +608,108 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(EventTableMap::DATABASE_NAME)->getTable(EventTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(EventTableMap::COL_ID); + $criteria->removeSelectColumn(EventTableMap::COL_DATE); + $criteria->removeSelectColumn(EventTableMap::COL_NAME); + $criteria->removeSelectColumn(EventTableMap::COL_CREATEDBY); + $criteria->removeSelectColumn(EventTableMap::COL_REHEARSALDATE); + $criteria->removeSelectColumn(EventTableMap::COL_TYPE); + $criteria->removeSelectColumn(EventTableMap::COL_SUBTYPE); + $criteria->removeSelectColumn(EventTableMap::COL_LOCATION); + $criteria->removeSelectColumn(EventTableMap::COL_NOTIFIED); + $criteria->removeSelectColumn(EventTableMap::COL_REHEARSAL); + $criteria->removeSelectColumn(EventTableMap::COL_REMOVED); + $criteria->removeSelectColumn(EventTableMap::COL_EVENTGROUP); + $criteria->removeSelectColumn(EventTableMap::COL_SERMONTITLE); + $criteria->removeSelectColumn(EventTableMap::COL_BIBLEVERSE); + $criteria->removeSelectColumn(EventTableMap::COL_CREATED); + $criteria->removeSelectColumn(EventTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.date'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.createdBy'); + $criteria->removeSelectColumn($alias . '.rehearsalDate'); + $criteria->removeSelectColumn($alias . '.type'); + $criteria->removeSelectColumn($alias . '.subType'); + $criteria->removeSelectColumn($alias . '.location'); + $criteria->removeSelectColumn($alias . '.notified'); + $criteria->removeSelectColumn($alias . '.rehearsal'); + $criteria->removeSelectColumn($alias . '.removed'); + $criteria->removeSelectColumn($alias . '.eventGroup'); + $criteria->removeSelectColumn($alias . '.sermonTitle'); + $criteria->removeSelectColumn($alias . '.bibleVerse'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(EventTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(EventTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new EventTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(EventTableMap::DATABASE_NAME)->getTable(EventTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Event or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Event object or primary key or array of primary keys + * @param mixed $values Criteria or Event object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(EventTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(EventTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Event) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Event) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(EventTableMap::DATABASE_NAME); - $criteria->add(EventTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(EventTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = EventQuery::create()->mergeWith($criteria); + $query = EventQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - EventTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + EventTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { EventTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the events table. @@ -541,7 +717,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return EventQuery::create()->doDeleteAll($con); } @@ -549,13 +725,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Event or Criteria object. * - * @param mixed $criteria Criteria or Event object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Event object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventTableMap::DATABASE_NAME); @@ -577,7 +753,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // EventTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -EventTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/EventTypeTableMap.php b/generated-classes/TechWilk/Rota/Map/EventTypeTableMap.php index 04f27928..fccf1867 100644 --- a/generated-classes/TechWilk/Rota/Map/EventTypeTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/EventTypeTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\EventType; use TechWilk\Rota\EventTypeQuery; + /** * This class defines the structure of the 'eventTypes' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class EventTypeTableMap extends TableMap { @@ -33,129 +33,210 @@ class EventTypeTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.EventTypeTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.EventTypeTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'eventTypes'; + public const TABLE_NAME = 'eventTypes'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'EventType'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\EventType'; + public const OM_CLASS = '\\TechWilk\\Rota\\EventType'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.EventType'; + public const CLASS_DEFAULT = 'TechWilk.Rota.EventType'; /** * The total number of columns */ - const NUM_COLUMNS = 9; + public const NUM_COLUMNS = 9; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 9; + public const NUM_HYDRATE_COLUMNS = 9; /** * the column name for the id field */ - const COL_ID = 'eventTypes.id'; + public const COL_ID = 'eventTypes.id'; /** * the column name for the name field */ - const COL_NAME = 'eventTypes.name'; + public const COL_NAME = 'eventTypes.name'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'eventTypes.description'; + public const COL_DESCRIPTION = 'eventTypes.description'; /** * the column name for the defaultDay field */ - const COL_DEFAULTDAY = 'eventTypes.defaultDay'; + public const COL_DEFAULTDAY = 'eventTypes.defaultDay'; /** * the column name for the defaultTime field */ - const COL_DEFAULTTIME = 'eventTypes.defaultTime'; + public const COL_DEFAULTTIME = 'eventTypes.defaultTime'; /** * the column name for the defaultRepitition field */ - const COL_DEFAULTREPITITION = 'eventTypes.defaultRepitition'; + public const COL_DEFAULTREPITITION = 'eventTypes.defaultRepitition'; /** * the column name for the defaultLocationId field */ - const COL_DEFAULTLOCATIONID = 'eventTypes.defaultLocationId'; + public const COL_DEFAULTLOCATIONID = 'eventTypes.defaultLocationId'; /** * the column name for the rehearsal field */ - const COL_REHEARSAL = 'eventTypes.rehearsal'; + public const COL_REHEARSAL = 'eventTypes.rehearsal'; /** * the column name for the groupformat field */ - const COL_GROUPFORMAT = 'eventTypes.groupformat'; + public const COL_GROUPFORMAT = 'eventTypes.groupformat'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Description', 'DefaultDay', 'DefaultTime', 'DefaultRepitition', 'DefaultLocationId', 'Rehearsal', 'GroupFormat', ), - self::TYPE_CAMELNAME => array('id', 'name', 'description', 'defaultDay', 'defaultTime', 'defaultRepitition', 'defaultLocationId', 'rehearsal', 'groupFormat', ), - self::TYPE_COLNAME => array(EventTypeTableMap::COL_ID, EventTypeTableMap::COL_NAME, EventTypeTableMap::COL_DESCRIPTION, EventTypeTableMap::COL_DEFAULTDAY, EventTypeTableMap::COL_DEFAULTTIME, EventTypeTableMap::COL_DEFAULTREPITITION, EventTypeTableMap::COL_DEFAULTLOCATIONID, EventTypeTableMap::COL_REHEARSAL, EventTypeTableMap::COL_GROUPFORMAT, ), - self::TYPE_FIELDNAME => array('id', 'name', 'description', 'defaultDay', 'defaultTime', 'defaultRepitition', 'defaultLocationId', 'rehearsal', 'groupformat', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Description', 'DefaultDay', 'DefaultTime', 'DefaultRepitition', 'DefaultLocationId', 'Rehearsal', 'GroupFormat', ], + self::TYPE_CAMELNAME => ['id', 'name', 'description', 'defaultDay', 'defaultTime', 'defaultRepitition', 'defaultLocationId', 'rehearsal', 'groupFormat', ], + self::TYPE_COLNAME => [EventTypeTableMap::COL_ID, EventTypeTableMap::COL_NAME, EventTypeTableMap::COL_DESCRIPTION, EventTypeTableMap::COL_DEFAULTDAY, EventTypeTableMap::COL_DEFAULTTIME, EventTypeTableMap::COL_DEFAULTREPITITION, EventTypeTableMap::COL_DEFAULTLOCATIONID, EventTypeTableMap::COL_REHEARSAL, EventTypeTableMap::COL_GROUPFORMAT, ], + self::TYPE_FIELDNAME => ['id', 'name', 'description', 'defaultDay', 'defaultTime', 'defaultRepitition', 'defaultLocationId', 'rehearsal', 'groupformat', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Description' => 2, 'DefaultDay' => 3, 'DefaultTime' => 4, 'DefaultRepitition' => 5, 'DefaultLocationId' => 6, 'Rehearsal' => 7, 'GroupFormat' => 8, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'defaultDay' => 3, 'defaultTime' => 4, 'defaultRepitition' => 5, 'defaultLocationId' => 6, 'rehearsal' => 7, 'groupFormat' => 8, ), - self::TYPE_COLNAME => array(EventTypeTableMap::COL_ID => 0, EventTypeTableMap::COL_NAME => 1, EventTypeTableMap::COL_DESCRIPTION => 2, EventTypeTableMap::COL_DEFAULTDAY => 3, EventTypeTableMap::COL_DEFAULTTIME => 4, EventTypeTableMap::COL_DEFAULTREPITITION => 5, EventTypeTableMap::COL_DEFAULTLOCATIONID => 6, EventTypeTableMap::COL_REHEARSAL => 7, EventTypeTableMap::COL_GROUPFORMAT => 8, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'defaultDay' => 3, 'defaultTime' => 4, 'defaultRepitition' => 5, 'defaultLocationId' => 6, 'rehearsal' => 7, 'groupformat' => 8, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Description' => 2, 'DefaultDay' => 3, 'DefaultTime' => 4, 'DefaultRepitition' => 5, 'DefaultLocationId' => 6, 'Rehearsal' => 7, 'GroupFormat' => 8, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'defaultDay' => 3, 'defaultTime' => 4, 'defaultRepitition' => 5, 'defaultLocationId' => 6, 'rehearsal' => 7, 'groupFormat' => 8, ], + self::TYPE_COLNAME => [EventTypeTableMap::COL_ID => 0, EventTypeTableMap::COL_NAME => 1, EventTypeTableMap::COL_DESCRIPTION => 2, EventTypeTableMap::COL_DEFAULTDAY => 3, EventTypeTableMap::COL_DEFAULTTIME => 4, EventTypeTableMap::COL_DEFAULTREPITITION => 5, EventTypeTableMap::COL_DEFAULTLOCATIONID => 6, EventTypeTableMap::COL_REHEARSAL => 7, EventTypeTableMap::COL_GROUPFORMAT => 8, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'defaultDay' => 3, 'defaultTime' => 4, 'defaultRepitition' => 5, 'defaultLocationId' => 6, 'rehearsal' => 7, 'groupformat' => 8, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'EventType.Id' => 'ID', + 'id' => 'ID', + 'eventType.id' => 'ID', + 'EventTypeTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'eventTypes.id' => 'ID', + 'Name' => 'NAME', + 'EventType.Name' => 'NAME', + 'name' => 'NAME', + 'eventType.name' => 'NAME', + 'EventTypeTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'eventTypes.name' => 'NAME', + 'Description' => 'DESCRIPTION', + 'EventType.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'eventType.description' => 'DESCRIPTION', + 'EventTypeTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'eventTypes.description' => 'DESCRIPTION', + 'DefaultDay' => 'DEFAULTDAY', + 'EventType.DefaultDay' => 'DEFAULTDAY', + 'defaultDay' => 'DEFAULTDAY', + 'eventType.defaultDay' => 'DEFAULTDAY', + 'EventTypeTableMap::COL_DEFAULTDAY' => 'DEFAULTDAY', + 'COL_DEFAULTDAY' => 'DEFAULTDAY', + 'eventTypes.defaultDay' => 'DEFAULTDAY', + 'DefaultTime' => 'DEFAULTTIME', + 'EventType.DefaultTime' => 'DEFAULTTIME', + 'defaultTime' => 'DEFAULTTIME', + 'eventType.defaultTime' => 'DEFAULTTIME', + 'EventTypeTableMap::COL_DEFAULTTIME' => 'DEFAULTTIME', + 'COL_DEFAULTTIME' => 'DEFAULTTIME', + 'eventTypes.defaultTime' => 'DEFAULTTIME', + 'DefaultRepitition' => 'DEFAULTREPITITION', + 'EventType.DefaultRepitition' => 'DEFAULTREPITITION', + 'defaultRepitition' => 'DEFAULTREPITITION', + 'eventType.defaultRepitition' => 'DEFAULTREPITITION', + 'EventTypeTableMap::COL_DEFAULTREPITITION' => 'DEFAULTREPITITION', + 'COL_DEFAULTREPITITION' => 'DEFAULTREPITITION', + 'eventTypes.defaultRepitition' => 'DEFAULTREPITITION', + 'DefaultLocationId' => 'DEFAULTLOCATIONID', + 'EventType.DefaultLocationId' => 'DEFAULTLOCATIONID', + 'defaultLocationId' => 'DEFAULTLOCATIONID', + 'eventType.defaultLocationId' => 'DEFAULTLOCATIONID', + 'EventTypeTableMap::COL_DEFAULTLOCATIONID' => 'DEFAULTLOCATIONID', + 'COL_DEFAULTLOCATIONID' => 'DEFAULTLOCATIONID', + 'eventTypes.defaultLocationId' => 'DEFAULTLOCATIONID', + 'Rehearsal' => 'REHEARSAL', + 'EventType.Rehearsal' => 'REHEARSAL', + 'rehearsal' => 'REHEARSAL', + 'eventType.rehearsal' => 'REHEARSAL', + 'EventTypeTableMap::COL_REHEARSAL' => 'REHEARSAL', + 'COL_REHEARSAL' => 'REHEARSAL', + 'eventTypes.rehearsal' => 'REHEARSAL', + 'GroupFormat' => 'GROUPFORMAT', + 'EventType.GroupFormat' => 'GROUPFORMAT', + 'groupFormat' => 'GROUPFORMAT', + 'eventType.groupFormat' => 'GROUPFORMAT', + 'EventTypeTableMap::COL_GROUPFORMAT' => 'GROUPFORMAT', + 'COL_GROUPFORMAT' => 'GROUPFORMAT', + 'groupformat' => 'GROUPFORMAT', + 'eventTypes.groupformat' => 'GROUPFORMAT', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('eventTypes'); @@ -174,28 +255,30 @@ public function initialize() $this->addForeignKey('defaultLocationId', 'DefaultLocationId', 'INTEGER', 'locations', 'id', false, 30, null); $this->addColumn('rehearsal', 'Rehearsal', 'INTEGER', true, 2, 0); $this->addColumn('groupformat', 'GroupFormat', 'INTEGER', true, 1, 0); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Location', '\\TechWilk\\Rota\\Location', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Location', '\\TechWilk\\Rota\\Location', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':defaultLocationId', 1 => ':id', ), ), 'SET NULL', null, null, false); - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':type', 1 => ':id', ), ), null, null, 'Events', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -203,14 +286,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -225,14 +308,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -249,10 +332,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? EventTypeTableMap::CLASS_DEFAULT : EventTypeTableMap::OM_CLASS; } @@ -260,17 +343,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (EventType object, last column rank) + * @return array (EventType object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = EventTypeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = EventTypeTableMap::getInstanceFromPool($key))) { @@ -286,7 +369,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: EventTypeTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -294,13 +377,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -330,12 +413,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(EventTypeTableMap::COL_ID); @@ -361,68 +445,94 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(EventTypeTableMap::DATABASE_NAME)->getTable(EventTypeTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(EventTypeTableMap::COL_ID); + $criteria->removeSelectColumn(EventTypeTableMap::COL_NAME); + $criteria->removeSelectColumn(EventTypeTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(EventTypeTableMap::COL_DEFAULTDAY); + $criteria->removeSelectColumn(EventTypeTableMap::COL_DEFAULTTIME); + $criteria->removeSelectColumn(EventTypeTableMap::COL_DEFAULTREPITITION); + $criteria->removeSelectColumn(EventTypeTableMap::COL_DEFAULTLOCATIONID); + $criteria->removeSelectColumn(EventTypeTableMap::COL_REHEARSAL); + $criteria->removeSelectColumn(EventTypeTableMap::COL_GROUPFORMAT); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.defaultDay'); + $criteria->removeSelectColumn($alias . '.defaultTime'); + $criteria->removeSelectColumn($alias . '.defaultRepitition'); + $criteria->removeSelectColumn($alias . '.defaultLocationId'); + $criteria->removeSelectColumn($alias . '.rehearsal'); + $criteria->removeSelectColumn($alias . '.groupformat'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(EventTypeTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(EventTypeTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new EventTypeTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(EventTypeTableMap::DATABASE_NAME)->getTable(EventTypeTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a EventType or Criteria object OR a primary key value. * - * @param mixed $values Criteria or EventType object or primary key or array of primary keys + * @param mixed $values Criteria or EventType object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(EventTypeTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(EventTypeTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\EventType) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\EventType) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(EventTypeTableMap::DATABASE_NAME); - $criteria->add(EventTypeTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(EventTypeTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = EventTypeQuery::create()->mergeWith($criteria); + $query = EventTypeQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - EventTypeTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + EventTypeTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { EventTypeTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the eventTypes table. @@ -430,7 +540,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return EventTypeQuery::create()->doDeleteAll($con); } @@ -438,13 +548,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a EventType or Criteria object. * - * @param mixed $criteria Criteria or EventType object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or EventType object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EventTypeTableMap::DATABASE_NAME); @@ -456,7 +566,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from EventType object } - if ($criteria->containsKey(EventTypeTableMap::COL_ID) && $criteria->keyContainsValue(EventTypeTableMap::COL_ID)) { + if ($criteria->containsKey(EventTypeTableMap::COL_ID) && $criteria->keyContainsValue(EventTypeTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.EventTypeTableMap::COL_ID.')'); } @@ -470,7 +580,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // EventTypeTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -EventTypeTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/GroupTableMap.php b/generated-classes/TechWilk/Rota/Map/GroupTableMap.php index daa5a63a..811a8c87 100644 --- a/generated-classes/TechWilk/Rota/Map/GroupTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/GroupTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Group; use TechWilk\Rota\GroupQuery; + /** * This class defines the structure of the 'groups' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class GroupTableMap extends TableMap { @@ -33,114 +33,174 @@ class GroupTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.GroupTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.GroupTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'groups'; + public const TABLE_NAME = 'groups'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Group'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Group'; + public const OM_CLASS = '\\TechWilk\\Rota\\Group'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Group'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Group'; /** * The total number of columns */ - const NUM_COLUMNS = 6; + public const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + public const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the id field */ - const COL_ID = 'groups.id'; + public const COL_ID = 'groups.id'; /** * the column name for the name field */ - const COL_NAME = 'groups.name'; + public const COL_NAME = 'groups.name'; /** * the column name for the rehearsal field */ - const COL_REHEARSAL = 'groups.rehearsal'; + public const COL_REHEARSAL = 'groups.rehearsal'; /** * the column name for the formatgroup field */ - const COL_FORMATGROUP = 'groups.formatgroup'; + public const COL_FORMATGROUP = 'groups.formatgroup'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'groups.description'; + public const COL_DESCRIPTION = 'groups.description'; /** * the column name for the allowRoleSwaps field */ - const COL_ALLOWROLESWAPS = 'groups.allowRoleSwaps'; + public const COL_ALLOWROLESWAPS = 'groups.allowRoleSwaps'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Rehearsal', 'FormatGroup', 'Description', 'AllowRoleSwaps', ), - self::TYPE_CAMELNAME => array('id', 'name', 'rehearsal', 'formatGroup', 'description', 'allowRoleSwaps', ), - self::TYPE_COLNAME => array(GroupTableMap::COL_ID, GroupTableMap::COL_NAME, GroupTableMap::COL_REHEARSAL, GroupTableMap::COL_FORMATGROUP, GroupTableMap::COL_DESCRIPTION, GroupTableMap::COL_ALLOWROLESWAPS, ), - self::TYPE_FIELDNAME => array('id', 'name', 'rehearsal', 'formatgroup', 'description', 'allowRoleSwaps', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Rehearsal', 'FormatGroup', 'Description', 'AllowRoleSwaps', ], + self::TYPE_CAMELNAME => ['id', 'name', 'rehearsal', 'formatGroup', 'description', 'allowRoleSwaps', ], + self::TYPE_COLNAME => [GroupTableMap::COL_ID, GroupTableMap::COL_NAME, GroupTableMap::COL_REHEARSAL, GroupTableMap::COL_FORMATGROUP, GroupTableMap::COL_DESCRIPTION, GroupTableMap::COL_ALLOWROLESWAPS, ], + self::TYPE_FIELDNAME => ['id', 'name', 'rehearsal', 'formatgroup', 'description', 'allowRoleSwaps', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Rehearsal' => 2, 'FormatGroup' => 3, 'Description' => 4, 'AllowRoleSwaps' => 5, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'rehearsal' => 2, 'formatGroup' => 3, 'description' => 4, 'allowRoleSwaps' => 5, ], + self::TYPE_COLNAME => [GroupTableMap::COL_ID => 0, GroupTableMap::COL_NAME => 1, GroupTableMap::COL_REHEARSAL => 2, GroupTableMap::COL_FORMATGROUP => 3, GroupTableMap::COL_DESCRIPTION => 4, GroupTableMap::COL_ALLOWROLESWAPS => 5, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'rehearsal' => 2, 'formatgroup' => 3, 'description' => 4, 'allowRoleSwaps' => 5, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Rehearsal' => 2, 'FormatGroup' => 3, 'Description' => 4, 'AllowRoleSwaps' => 5, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'rehearsal' => 2, 'formatGroup' => 3, 'description' => 4, 'allowRoleSwaps' => 5, ), - self::TYPE_COLNAME => array(GroupTableMap::COL_ID => 0, GroupTableMap::COL_NAME => 1, GroupTableMap::COL_REHEARSAL => 2, GroupTableMap::COL_FORMATGROUP => 3, GroupTableMap::COL_DESCRIPTION => 4, GroupTableMap::COL_ALLOWROLESWAPS => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'rehearsal' => 2, 'formatgroup' => 3, 'description' => 4, 'allowRoleSwaps' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Group.Id' => 'ID', + 'id' => 'ID', + 'group.id' => 'ID', + 'GroupTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'groups.id' => 'ID', + 'Name' => 'NAME', + 'Group.Name' => 'NAME', + 'name' => 'NAME', + 'group.name' => 'NAME', + 'GroupTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'groups.name' => 'NAME', + 'Rehearsal' => 'REHEARSAL', + 'Group.Rehearsal' => 'REHEARSAL', + 'rehearsal' => 'REHEARSAL', + 'group.rehearsal' => 'REHEARSAL', + 'GroupTableMap::COL_REHEARSAL' => 'REHEARSAL', + 'COL_REHEARSAL' => 'REHEARSAL', + 'groups.rehearsal' => 'REHEARSAL', + 'FormatGroup' => 'FORMATGROUP', + 'Group.FormatGroup' => 'FORMATGROUP', + 'formatGroup' => 'FORMATGROUP', + 'group.formatGroup' => 'FORMATGROUP', + 'GroupTableMap::COL_FORMATGROUP' => 'FORMATGROUP', + 'COL_FORMATGROUP' => 'FORMATGROUP', + 'formatgroup' => 'FORMATGROUP', + 'groups.formatgroup' => 'FORMATGROUP', + 'Description' => 'DESCRIPTION', + 'Group.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'group.description' => 'DESCRIPTION', + 'GroupTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'groups.description' => 'DESCRIPTION', + 'AllowRoleSwaps' => 'ALLOWROLESWAPS', + 'Group.AllowRoleSwaps' => 'ALLOWROLESWAPS', + 'allowRoleSwaps' => 'ALLOWROLESWAPS', + 'group.allowRoleSwaps' => 'ALLOWROLESWAPS', + 'GroupTableMap::COL_ALLOWROLESWAPS' => 'ALLOWROLESWAPS', + 'COL_ALLOWROLESWAPS' => 'ALLOWROLESWAPS', + 'groups.allowRoleSwaps' => 'ALLOWROLESWAPS', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('groups'); @@ -156,21 +216,23 @@ public function initialize() $this->addColumn('formatgroup', 'FormatGroup', 'INTEGER', true, 2, 0); $this->addColumn('description', 'Description', 'LONGVARCHAR', false, null, null); $this->addColumn('allowRoleSwaps', 'AllowRoleSwaps', 'BOOLEAN', true, 1, true); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Role', '\\TechWilk\\Rota\\Role', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Role', '\\TechWilk\\Rota\\Role', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':groupId', 1 => ':id', ), ), null, null, 'Roles', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -178,14 +240,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -200,14 +262,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -224,10 +286,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? GroupTableMap::CLASS_DEFAULT : GroupTableMap::OM_CLASS; } @@ -235,17 +297,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Group object, last column rank) + * @return array (Group object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = GroupTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = GroupTableMap::getInstanceFromPool($key))) { @@ -261,7 +323,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: GroupTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -269,13 +331,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -305,12 +367,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(GroupTableMap::COL_ID); @@ -330,68 +393,88 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(GroupTableMap::DATABASE_NAME)->getTable(GroupTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(GroupTableMap::COL_ID); + $criteria->removeSelectColumn(GroupTableMap::COL_NAME); + $criteria->removeSelectColumn(GroupTableMap::COL_REHEARSAL); + $criteria->removeSelectColumn(GroupTableMap::COL_FORMATGROUP); + $criteria->removeSelectColumn(GroupTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(GroupTableMap::COL_ALLOWROLESWAPS); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.rehearsal'); + $criteria->removeSelectColumn($alias . '.formatgroup'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.allowRoleSwaps'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(GroupTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(GroupTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new GroupTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(GroupTableMap::DATABASE_NAME)->getTable(GroupTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Group or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Group object or primary key or array of primary keys + * @param mixed $values Criteria or Group object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Group) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Group) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(GroupTableMap::DATABASE_NAME); - $criteria->add(GroupTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(GroupTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = GroupQuery::create()->mergeWith($criteria); + $query = GroupQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - GroupTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + GroupTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { GroupTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the groups table. @@ -399,7 +482,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return GroupQuery::create()->doDeleteAll($con); } @@ -407,13 +490,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Group or Criteria object. * - * @param mixed $criteria Criteria or Group object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Group object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME); @@ -425,7 +508,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Group object } - if ($criteria->containsKey(GroupTableMap::COL_ID) && $criteria->keyContainsValue(GroupTableMap::COL_ID)) { + if ($criteria->containsKey(GroupTableMap::COL_ID) && $criteria->keyContainsValue(GroupTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.GroupTableMap::COL_ID.')'); } @@ -439,7 +522,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // GroupTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -GroupTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/LocationTableMap.php b/generated-classes/TechWilk/Rota/Map/LocationTableMap.php index da2d48be..f70387b2 100644 --- a/generated-classes/TechWilk/Rota/Map/LocationTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/LocationTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Location; use TechWilk\Rota\LocationQuery; + /** * This class defines the structure of the 'locations' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class LocationTableMap extends TableMap { @@ -33,99 +33,137 @@ class LocationTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.LocationTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.LocationTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'locations'; + public const TABLE_NAME = 'locations'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Location'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Location'; + public const OM_CLASS = '\\TechWilk\\Rota\\Location'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Location'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Location'; /** * The total number of columns */ - const NUM_COLUMNS = 3; + public const NUM_COLUMNS = 3; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 3; + public const NUM_HYDRATE_COLUMNS = 3; /** * the column name for the id field */ - const COL_ID = 'locations.id'; + public const COL_ID = 'locations.id'; /** * the column name for the name field */ - const COL_NAME = 'locations.name'; + public const COL_NAME = 'locations.name'; /** * the column name for the address field */ - const COL_ADDRESS = 'locations.address'; + public const COL_ADDRESS = 'locations.address'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Address', ), - self::TYPE_CAMELNAME => array('id', 'name', 'address', ), - self::TYPE_COLNAME => array(LocationTableMap::COL_ID, LocationTableMap::COL_NAME, LocationTableMap::COL_ADDRESS, ), - self::TYPE_FIELDNAME => array('id', 'name', 'address', ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Address', ], + self::TYPE_CAMELNAME => ['id', 'name', 'address', ], + self::TYPE_COLNAME => [LocationTableMap::COL_ID, LocationTableMap::COL_NAME, LocationTableMap::COL_ADDRESS, ], + self::TYPE_FIELDNAME => ['id', 'name', 'address', ], + self::TYPE_NUM => [0, 1, 2, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Address' => 2, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'address' => 2, ], + self::TYPE_COLNAME => [LocationTableMap::COL_ID => 0, LocationTableMap::COL_NAME => 1, LocationTableMap::COL_ADDRESS => 2, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'address' => 2, ], + self::TYPE_NUM => [0, 1, 2, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Address' => 2, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'address' => 2, ), - self::TYPE_COLNAME => array(LocationTableMap::COL_ID => 0, LocationTableMap::COL_NAME => 1, LocationTableMap::COL_ADDRESS => 2, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'address' => 2, ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Location.Id' => 'ID', + 'id' => 'ID', + 'location.id' => 'ID', + 'LocationTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'locations.id' => 'ID', + 'Name' => 'NAME', + 'Location.Name' => 'NAME', + 'name' => 'NAME', + 'location.name' => 'NAME', + 'LocationTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'locations.name' => 'NAME', + 'Address' => 'ADDRESS', + 'Location.Address' => 'ADDRESS', + 'address' => 'ADDRESS', + 'location.address' => 'ADDRESS', + 'LocationTableMap::COL_ADDRESS' => 'ADDRESS', + 'COL_ADDRESS' => 'ADDRESS', + 'locations.address' => 'ADDRESS', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('locations'); @@ -138,32 +176,35 @@ public function initialize() $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); $this->addColumn('name', 'Name', 'LONGVARCHAR', true, null, null); $this->addColumn('address', 'Address', 'LONGVARCHAR', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('EventType', '\\TechWilk\\Rota\\EventType', RelationMap::ONE_TO_MANY, array( + $this->addRelation('EventType', '\\TechWilk\\Rota\\EventType', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':defaultLocationId', 1 => ':id', ), ), 'SET NULL', null, 'EventTypes', false); - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':location', 1 => ':id', ), ), null, null, 'Events', false); - } // buildRelations() + } + /** * Method to invalidate the instance pool of all tables related to locations * by a foreign key with ON DELETE CASCADE */ - public static function clearRelatedInstancePool() + public static function clearRelatedInstancePool(): void { // Invalidate objects in related instance pools, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. @@ -176,14 +217,14 @@ public static function clearRelatedInstancePool() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -198,14 +239,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -222,10 +263,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? LocationTableMap::CLASS_DEFAULT : LocationTableMap::OM_CLASS; } @@ -233,17 +274,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Location object, last column rank) + * @return array (Location object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = LocationTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = LocationTableMap::getInstanceFromPool($key))) { @@ -259,7 +300,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: LocationTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -267,13 +308,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -303,12 +344,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(LocationTableMap::COL_ID); @@ -322,68 +364,82 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(LocationTableMap::DATABASE_NAME)->getTable(LocationTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(LocationTableMap::COL_ID); + $criteria->removeSelectColumn(LocationTableMap::COL_NAME); + $criteria->removeSelectColumn(LocationTableMap::COL_ADDRESS); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.address'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(LocationTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(LocationTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new LocationTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(LocationTableMap::DATABASE_NAME)->getTable(LocationTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Location or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Location object or primary key or array of primary keys + * @param mixed $values Criteria or Location object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(LocationTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(LocationTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Location) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Location) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(LocationTableMap::DATABASE_NAME); - $criteria->add(LocationTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(LocationTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = LocationQuery::create()->mergeWith($criteria); + $query = LocationQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - LocationTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + LocationTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { LocationTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the locations table. @@ -391,7 +447,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return LocationQuery::create()->doDeleteAll($con); } @@ -399,13 +455,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Location or Criteria object. * - * @param mixed $criteria Criteria or Location object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Location object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(LocationTableMap::DATABASE_NAME); @@ -417,7 +473,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Location object } - if ($criteria->containsKey(LocationTableMap::COL_ID) && $criteria->keyContainsValue(LocationTableMap::COL_ID)) { + if ($criteria->containsKey(LocationTableMap::COL_ID) && $criteria->keyContainsValue(LocationTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.LocationTableMap::COL_ID.')'); } @@ -431,7 +487,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // LocationTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -LocationTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/LoginFailureTableMap.php b/generated-classes/TechWilk/Rota/Map/LoginFailureTableMap.php index 3f0d1227..9538cb78 100644 --- a/generated-classes/TechWilk/Rota/Map/LoginFailureTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/LoginFailureTableMap.php @@ -15,6 +15,7 @@ use TechWilk\Rota\LoginFailure; use TechWilk\Rota\LoginFailureQuery; + /** * This class defines the structure of the 'loginFailures' table. * @@ -24,7 +25,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class LoginFailureTableMap extends TableMap { @@ -34,99 +34,136 @@ class LoginFailureTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.LoginFailureTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.LoginFailureTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'loginFailures'; + public const TABLE_NAME = 'loginFailures'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'LoginFailure'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\LoginFailure'; + public const OM_CLASS = '\\TechWilk\\Rota\\LoginFailure'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.LoginFailure'; + public const CLASS_DEFAULT = 'TechWilk.Rota.LoginFailure'; /** * The total number of columns */ - const NUM_COLUMNS = 3; + public const NUM_COLUMNS = 3; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 3; + public const NUM_HYDRATE_COLUMNS = 3; /** * the column name for the username field */ - const COL_USERNAME = 'loginFailures.username'; + public const COL_USERNAME = 'loginFailures.username'; /** * the column name for the ipAddress field */ - const COL_IPADDRESS = 'loginFailures.ipAddress'; + public const COL_IPADDRESS = 'loginFailures.ipAddress'; /** * the column name for the timestamp field */ - const COL_TIMESTAMP = 'loginFailures.timestamp'; + public const COL_TIMESTAMP = 'loginFailures.timestamp'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Username', 'ipAddress', 'Timestamp', ), - self::TYPE_CAMELNAME => array('username', 'ipAddress', 'timestamp', ), - self::TYPE_COLNAME => array(LoginFailureTableMap::COL_USERNAME, LoginFailureTableMap::COL_IPADDRESS, LoginFailureTableMap::COL_TIMESTAMP, ), - self::TYPE_FIELDNAME => array('username', 'ipAddress', 'timestamp', ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Username', 'ipAddress', 'Timestamp', ], + self::TYPE_CAMELNAME => ['username', 'ipAddress', 'timestamp', ], + self::TYPE_COLNAME => [LoginFailureTableMap::COL_USERNAME, LoginFailureTableMap::COL_IPADDRESS, LoginFailureTableMap::COL_TIMESTAMP, ], + self::TYPE_FIELDNAME => ['username', 'ipAddress', 'timestamp', ], + self::TYPE_NUM => [0, 1, 2, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Username' => 0, 'ipAddress' => 1, 'Timestamp' => 2, ], + self::TYPE_CAMELNAME => ['username' => 0, 'ipAddress' => 1, 'timestamp' => 2, ], + self::TYPE_COLNAME => [LoginFailureTableMap::COL_USERNAME => 0, LoginFailureTableMap::COL_IPADDRESS => 1, LoginFailureTableMap::COL_TIMESTAMP => 2, ], + self::TYPE_FIELDNAME => ['username' => 0, 'ipAddress' => 1, 'timestamp' => 2, ], + self::TYPE_NUM => [0, 1, 2, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Username' => 0, 'ipAddress' => 1, 'Timestamp' => 2, ), - self::TYPE_CAMELNAME => array('username' => 0, 'ipAddress' => 1, 'timestamp' => 2, ), - self::TYPE_COLNAME => array(LoginFailureTableMap::COL_USERNAME => 0, LoginFailureTableMap::COL_IPADDRESS => 1, LoginFailureTableMap::COL_TIMESTAMP => 2, ), - self::TYPE_FIELDNAME => array('username' => 0, 'ipAddress' => 1, 'timestamp' => 2, ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected $normalizedColumnNameMap = [ + 'Username' => 'USERNAME', + 'LoginFailure.Username' => 'USERNAME', + 'username' => 'USERNAME', + 'loginFailure.username' => 'USERNAME', + 'LoginFailureTableMap::COL_USERNAME' => 'USERNAME', + 'COL_USERNAME' => 'USERNAME', + 'loginFailures.username' => 'USERNAME', + 'ipAddress' => 'IPADDRESS', + 'LoginFailure.ipAddress' => 'IPADDRESS', + 'loginFailure.ipAddress' => 'IPADDRESS', + 'LoginFailureTableMap::COL_IPADDRESS' => 'IPADDRESS', + 'COL_IPADDRESS' => 'IPADDRESS', + 'loginFailures.ipAddress' => 'IPADDRESS', + 'Timestamp' => 'TIMESTAMP', + 'LoginFailure.Timestamp' => 'TIMESTAMP', + 'timestamp' => 'TIMESTAMP', + 'loginFailure.timestamp' => 'TIMESTAMP', + 'LoginFailureTableMap::COL_TIMESTAMP' => 'TIMESTAMP', + 'COL_TIMESTAMP' => 'TIMESTAMP', + 'loginFailures.timestamp' => 'TIMESTAMP', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('loginFailures'); @@ -139,14 +176,16 @@ public function initialize() $this->addColumn('username', 'Username', 'VARCHAR', true, 30, null); $this->addColumn('ipAddress', 'ipAddress', 'VARCHAR', true, 15, null); $this->addColumn('timestamp', 'Timestamp', 'TIMESTAMP', true, null, 'CURRENT_TIMESTAMP'); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -154,14 +193,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { return null; } @@ -171,14 +210,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return ''; } @@ -191,10 +230,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? LoginFailureTableMap::CLASS_DEFAULT : LoginFailureTableMap::OM_CLASS; } @@ -202,17 +241,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (LoginFailure object, last column rank) + * @return array (LoginFailure object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = LoginFailureTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = LoginFailureTableMap::getInstanceFromPool($key))) { @@ -228,7 +267,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: LoginFailureTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -236,13 +275,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -272,12 +311,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(LoginFailureTableMap::COL_USERNAME); @@ -291,67 +331,81 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(LoginFailureTableMap::DATABASE_NAME)->getTable(LoginFailureTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(LoginFailureTableMap::COL_USERNAME); + $criteria->removeSelectColumn(LoginFailureTableMap::COL_IPADDRESS); + $criteria->removeSelectColumn(LoginFailureTableMap::COL_TIMESTAMP); + } else { + $criteria->removeSelectColumn($alias . '.username'); + $criteria->removeSelectColumn($alias . '.ipAddress'); + $criteria->removeSelectColumn($alias . '.timestamp'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(LoginFailureTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(LoginFailureTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new LoginFailureTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(LoginFailureTableMap::DATABASE_NAME)->getTable(LoginFailureTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a LoginFailure or Criteria object OR a primary key value. * - * @param mixed $values Criteria or LoginFailure object or primary key or array of primary keys + * @param mixed $values Criteria or LoginFailure object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(LoginFailureTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(LoginFailureTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\LoginFailure) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\LoginFailure) { // it's a model object // create criteria based on pk value $criteria = $values->buildCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks throw new LogicException('The LoginFailure object has no primary key'); - } + } - $query = LoginFailureQuery::create()->mergeWith($criteria); + $query = LoginFailureQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - LoginFailureTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + LoginFailureTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { LoginFailureTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the loginFailures table. @@ -359,7 +413,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return LoginFailureQuery::create()->doDeleteAll($con); } @@ -367,13 +421,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a LoginFailure or Criteria object. * - * @param mixed $criteria Criteria or LoginFailure object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or LoginFailure object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(LoginFailureTableMap::DATABASE_NAME); @@ -395,7 +449,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // LoginFailureTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -LoginFailureTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/NotificationClickTableMap.php b/generated-classes/TechWilk/Rota/Map/NotificationClickTableMap.php index 453c7688..22e513fc 100644 --- a/generated-classes/TechWilk/Rota/Map/NotificationClickTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/NotificationClickTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\NotificationClick; use TechWilk\Rota\NotificationClickQuery; + /** * This class defines the structure of the 'notificationClicks' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class NotificationClickTableMap extends TableMap { @@ -33,104 +33,149 @@ class NotificationClickTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.NotificationClickTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.NotificationClickTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'notificationClicks'; + public const TABLE_NAME = 'notificationClicks'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'NotificationClick'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\NotificationClick'; + public const OM_CLASS = '\\TechWilk\\Rota\\NotificationClick'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.NotificationClick'; + public const CLASS_DEFAULT = 'TechWilk.Rota.NotificationClick'; /** * The total number of columns */ - const NUM_COLUMNS = 4; + public const NUM_COLUMNS = 4; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 4; + public const NUM_HYDRATE_COLUMNS = 4; /** * the column name for the id field */ - const COL_ID = 'notificationClicks.id'; + public const COL_ID = 'notificationClicks.id'; /** * the column name for the notificationId field */ - const COL_NOTIFICATIONID = 'notificationClicks.notificationId'; + public const COL_NOTIFICATIONID = 'notificationClicks.notificationId'; /** * the column name for the referer field */ - const COL_REFERER = 'notificationClicks.referer'; + public const COL_REFERER = 'notificationClicks.referer'; /** * the column name for the timestamp field */ - const COL_TIMESTAMP = 'notificationClicks.timestamp'; + public const COL_TIMESTAMP = 'notificationClicks.timestamp'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'NotificationId', 'Referer', 'Timestamp', ), - self::TYPE_CAMELNAME => array('id', 'notificationId', 'referer', 'timestamp', ), - self::TYPE_COLNAME => array(NotificationClickTableMap::COL_ID, NotificationClickTableMap::COL_NOTIFICATIONID, NotificationClickTableMap::COL_REFERER, NotificationClickTableMap::COL_TIMESTAMP, ), - self::TYPE_FIELDNAME => array('id', 'notificationId', 'referer', 'timestamp', ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'NotificationId', 'Referer', 'Timestamp', ], + self::TYPE_CAMELNAME => ['id', 'notificationId', 'referer', 'timestamp', ], + self::TYPE_COLNAME => [NotificationClickTableMap::COL_ID, NotificationClickTableMap::COL_NOTIFICATIONID, NotificationClickTableMap::COL_REFERER, NotificationClickTableMap::COL_TIMESTAMP, ], + self::TYPE_FIELDNAME => ['id', 'notificationId', 'referer', 'timestamp', ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'NotificationId' => 1, 'Referer' => 2, 'Timestamp' => 3, ], + self::TYPE_CAMELNAME => ['id' => 0, 'notificationId' => 1, 'referer' => 2, 'timestamp' => 3, ], + self::TYPE_COLNAME => [NotificationClickTableMap::COL_ID => 0, NotificationClickTableMap::COL_NOTIFICATIONID => 1, NotificationClickTableMap::COL_REFERER => 2, NotificationClickTableMap::COL_TIMESTAMP => 3, ], + self::TYPE_FIELDNAME => ['id' => 0, 'notificationId' => 1, 'referer' => 2, 'timestamp' => 3, ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'NotificationId' => 1, 'Referer' => 2, 'Timestamp' => 3, ), - self::TYPE_CAMELNAME => array('id' => 0, 'notificationId' => 1, 'referer' => 2, 'timestamp' => 3, ), - self::TYPE_COLNAME => array(NotificationClickTableMap::COL_ID => 0, NotificationClickTableMap::COL_NOTIFICATIONID => 1, NotificationClickTableMap::COL_REFERER => 2, NotificationClickTableMap::COL_TIMESTAMP => 3, ), - self::TYPE_FIELDNAME => array('id' => 0, 'notificationId' => 1, 'referer' => 2, 'timestamp' => 3, ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'NotificationClick.Id' => 'ID', + 'id' => 'ID', + 'notificationClick.id' => 'ID', + 'NotificationClickTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'notificationClicks.id' => 'ID', + 'NotificationId' => 'NOTIFICATIONID', + 'NotificationClick.NotificationId' => 'NOTIFICATIONID', + 'notificationId' => 'NOTIFICATIONID', + 'notificationClick.notificationId' => 'NOTIFICATIONID', + 'NotificationClickTableMap::COL_NOTIFICATIONID' => 'NOTIFICATIONID', + 'COL_NOTIFICATIONID' => 'NOTIFICATIONID', + 'notificationClicks.notificationId' => 'NOTIFICATIONID', + 'Referer' => 'REFERER', + 'NotificationClick.Referer' => 'REFERER', + 'referer' => 'REFERER', + 'notificationClick.referer' => 'REFERER', + 'NotificationClickTableMap::COL_REFERER' => 'REFERER', + 'COL_REFERER' => 'REFERER', + 'notificationClicks.referer' => 'REFERER', + 'Timestamp' => 'TIMESTAMP', + 'NotificationClick.Timestamp' => 'TIMESTAMP', + 'timestamp' => 'TIMESTAMP', + 'notificationClick.timestamp' => 'TIMESTAMP', + 'NotificationClickTableMap::COL_TIMESTAMP' => 'TIMESTAMP', + 'COL_TIMESTAMP' => 'TIMESTAMP', + 'notificationClicks.timestamp' => 'TIMESTAMP', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('notificationClicks'); @@ -144,34 +189,36 @@ public function initialize() $this->addForeignKey('notificationId', 'NotificationId', 'INTEGER', 'notifications', 'id', true, 30, null); $this->addColumn('referer', 'Referer', 'VARCHAR', true, 50, null); $this->addColumn('timestamp', 'Timestamp', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Notification', '\\TechWilk\\Rota\\Notification', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Notification', '\\TechWilk\\Rota\\Notification', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':notificationId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'timestamp', 'update_column' => 'updated_at', 'disable_created_at' => 'false', 'disable_updated_at' => 'true', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'timestamp', 'update_column' => 'updated_at', 'disable_created_at' => 'false', 'disable_updated_at' => 'true'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -179,14 +226,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -201,14 +248,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -225,10 +272,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? NotificationClickTableMap::CLASS_DEFAULT : NotificationClickTableMap::OM_CLASS; } @@ -236,17 +283,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (NotificationClick object, last column rank) + * @return array (NotificationClick object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = NotificationClickTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = NotificationClickTableMap::getInstanceFromPool($key))) { @@ -262,7 +309,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: NotificationClickTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -270,13 +317,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -306,12 +353,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(NotificationClickTableMap::COL_ID); @@ -327,68 +375,84 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(NotificationClickTableMap::DATABASE_NAME)->getTable(NotificationClickTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(NotificationClickTableMap::COL_ID); + $criteria->removeSelectColumn(NotificationClickTableMap::COL_NOTIFICATIONID); + $criteria->removeSelectColumn(NotificationClickTableMap::COL_REFERER); + $criteria->removeSelectColumn(NotificationClickTableMap::COL_TIMESTAMP); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.notificationId'); + $criteria->removeSelectColumn($alias . '.referer'); + $criteria->removeSelectColumn($alias . '.timestamp'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(NotificationClickTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(NotificationClickTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new NotificationClickTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(NotificationClickTableMap::DATABASE_NAME)->getTable(NotificationClickTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a NotificationClick or Criteria object OR a primary key value. * - * @param mixed $values Criteria or NotificationClick object or primary key or array of primary keys + * @param mixed $values Criteria or NotificationClick object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(NotificationClickTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(NotificationClickTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\NotificationClick) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\NotificationClick) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(NotificationClickTableMap::DATABASE_NAME); - $criteria->add(NotificationClickTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(NotificationClickTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = NotificationClickQuery::create()->mergeWith($criteria); + $query = NotificationClickQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - NotificationClickTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + NotificationClickTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { NotificationClickTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the notificationClicks table. @@ -396,7 +460,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return NotificationClickQuery::create()->doDeleteAll($con); } @@ -404,13 +468,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a NotificationClick or Criteria object. * - * @param mixed $criteria Criteria or NotificationClick object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or NotificationClick object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(NotificationClickTableMap::DATABASE_NAME); @@ -422,7 +486,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from NotificationClick object } - if ($criteria->containsKey(NotificationClickTableMap::COL_ID) && $criteria->keyContainsValue(NotificationClickTableMap::COL_ID)) { + if ($criteria->containsKey(NotificationClickTableMap::COL_ID) && $criteria->keyContainsValue(NotificationClickTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.NotificationClickTableMap::COL_ID.')'); } @@ -436,7 +500,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // NotificationClickTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -NotificationClickTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/NotificationTableMap.php b/generated-classes/TechWilk/Rota/Map/NotificationTableMap.php index 3a7f2757..768c2fea 100644 --- a/generated-classes/TechWilk/Rota/Map/NotificationTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/NotificationTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Notification; use TechWilk\Rota\NotificationQuery; + /** * This class defines the structure of the 'notifications' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class NotificationTableMap extends TableMap { @@ -33,134 +33,221 @@ class NotificationTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.NotificationTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.NotificationTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'notifications'; + public const TABLE_NAME = 'notifications'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Notification'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Notification'; + public const OM_CLASS = '\\TechWilk\\Rota\\Notification'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Notification'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Notification'; /** * The total number of columns */ - const NUM_COLUMNS = 10; + public const NUM_COLUMNS = 10; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 10; + public const NUM_HYDRATE_COLUMNS = 10; /** * the column name for the id field */ - const COL_ID = 'notifications.id'; + public const COL_ID = 'notifications.id'; /** * the column name for the timestamp field */ - const COL_TIMESTAMP = 'notifications.timestamp'; + public const COL_TIMESTAMP = 'notifications.timestamp'; /** * the column name for the userId field */ - const COL_USERID = 'notifications.userId'; + public const COL_USERID = 'notifications.userId'; /** * the column name for the summary field */ - const COL_SUMMARY = 'notifications.summary'; + public const COL_SUMMARY = 'notifications.summary'; /** * the column name for the body field */ - const COL_BODY = 'notifications.body'; + public const COL_BODY = 'notifications.body'; /** * the column name for the link field */ - const COL_LINK = 'notifications.link'; + public const COL_LINK = 'notifications.link'; /** * the column name for the type field */ - const COL_TYPE = 'notifications.type'; + public const COL_TYPE = 'notifications.type'; /** * the column name for the seen field */ - const COL_SEEN = 'notifications.seen'; + public const COL_SEEN = 'notifications.seen'; /** * the column name for the dismissed field */ - const COL_DISMISSED = 'notifications.dismissed'; + public const COL_DISMISSED = 'notifications.dismissed'; /** * the column name for the archived field */ - const COL_ARCHIVED = 'notifications.archived'; + public const COL_ARCHIVED = 'notifications.archived'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Timestamp', 'UserId', 'Summary', 'Body', 'Link', 'Type', 'Seen', 'Dismissed', 'Archived', ), - self::TYPE_CAMELNAME => array('id', 'timestamp', 'userId', 'summary', 'body', 'link', 'type', 'seen', 'dismissed', 'archived', ), - self::TYPE_COLNAME => array(NotificationTableMap::COL_ID, NotificationTableMap::COL_TIMESTAMP, NotificationTableMap::COL_USERID, NotificationTableMap::COL_SUMMARY, NotificationTableMap::COL_BODY, NotificationTableMap::COL_LINK, NotificationTableMap::COL_TYPE, NotificationTableMap::COL_SEEN, NotificationTableMap::COL_DISMISSED, NotificationTableMap::COL_ARCHIVED, ), - self::TYPE_FIELDNAME => array('id', 'timestamp', 'userId', 'summary', 'body', 'link', 'type', 'seen', 'dismissed', 'archived', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Timestamp', 'UserId', 'Summary', 'Body', 'Link', 'Type', 'Seen', 'Dismissed', 'Archived', ], + self::TYPE_CAMELNAME => ['id', 'timestamp', 'userId', 'summary', 'body', 'link', 'type', 'seen', 'dismissed', 'archived', ], + self::TYPE_COLNAME => [NotificationTableMap::COL_ID, NotificationTableMap::COL_TIMESTAMP, NotificationTableMap::COL_USERID, NotificationTableMap::COL_SUMMARY, NotificationTableMap::COL_BODY, NotificationTableMap::COL_LINK, NotificationTableMap::COL_TYPE, NotificationTableMap::COL_SEEN, NotificationTableMap::COL_DISMISSED, NotificationTableMap::COL_ARCHIVED, ], + self::TYPE_FIELDNAME => ['id', 'timestamp', 'userId', 'summary', 'body', 'link', 'type', 'seen', 'dismissed', 'archived', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Timestamp' => 1, 'UserId' => 2, 'Summary' => 3, 'Body' => 4, 'Link' => 5, 'Type' => 6, 'Seen' => 7, 'Dismissed' => 8, 'Archived' => 9, ), - self::TYPE_CAMELNAME => array('id' => 0, 'timestamp' => 1, 'userId' => 2, 'summary' => 3, 'body' => 4, 'link' => 5, 'type' => 6, 'seen' => 7, 'dismissed' => 8, 'archived' => 9, ), - self::TYPE_COLNAME => array(NotificationTableMap::COL_ID => 0, NotificationTableMap::COL_TIMESTAMP => 1, NotificationTableMap::COL_USERID => 2, NotificationTableMap::COL_SUMMARY => 3, NotificationTableMap::COL_BODY => 4, NotificationTableMap::COL_LINK => 5, NotificationTableMap::COL_TYPE => 6, NotificationTableMap::COL_SEEN => 7, NotificationTableMap::COL_DISMISSED => 8, NotificationTableMap::COL_ARCHIVED => 9, ), - self::TYPE_FIELDNAME => array('id' => 0, 'timestamp' => 1, 'userId' => 2, 'summary' => 3, 'body' => 4, 'link' => 5, 'type' => 6, 'seen' => 7, 'dismissed' => 8, 'archived' => 9, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Timestamp' => 1, 'UserId' => 2, 'Summary' => 3, 'Body' => 4, 'Link' => 5, 'Type' => 6, 'Seen' => 7, 'Dismissed' => 8, 'Archived' => 9, ], + self::TYPE_CAMELNAME => ['id' => 0, 'timestamp' => 1, 'userId' => 2, 'summary' => 3, 'body' => 4, 'link' => 5, 'type' => 6, 'seen' => 7, 'dismissed' => 8, 'archived' => 9, ], + self::TYPE_COLNAME => [NotificationTableMap::COL_ID => 0, NotificationTableMap::COL_TIMESTAMP => 1, NotificationTableMap::COL_USERID => 2, NotificationTableMap::COL_SUMMARY => 3, NotificationTableMap::COL_BODY => 4, NotificationTableMap::COL_LINK => 5, NotificationTableMap::COL_TYPE => 6, NotificationTableMap::COL_SEEN => 7, NotificationTableMap::COL_DISMISSED => 8, NotificationTableMap::COL_ARCHIVED => 9, ], + self::TYPE_FIELDNAME => ['id' => 0, 'timestamp' => 1, 'userId' => 2, 'summary' => 3, 'body' => 4, 'link' => 5, 'type' => 6, 'seen' => 7, 'dismissed' => 8, 'archived' => 9, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Notification.Id' => 'ID', + 'id' => 'ID', + 'notification.id' => 'ID', + 'NotificationTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'notifications.id' => 'ID', + 'Timestamp' => 'TIMESTAMP', + 'Notification.Timestamp' => 'TIMESTAMP', + 'timestamp' => 'TIMESTAMP', + 'notification.timestamp' => 'TIMESTAMP', + 'NotificationTableMap::COL_TIMESTAMP' => 'TIMESTAMP', + 'COL_TIMESTAMP' => 'TIMESTAMP', + 'notifications.timestamp' => 'TIMESTAMP', + 'UserId' => 'USERID', + 'Notification.UserId' => 'USERID', + 'userId' => 'USERID', + 'notification.userId' => 'USERID', + 'NotificationTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'notifications.userId' => 'USERID', + 'Summary' => 'SUMMARY', + 'Notification.Summary' => 'SUMMARY', + 'summary' => 'SUMMARY', + 'notification.summary' => 'SUMMARY', + 'NotificationTableMap::COL_SUMMARY' => 'SUMMARY', + 'COL_SUMMARY' => 'SUMMARY', + 'notifications.summary' => 'SUMMARY', + 'Body' => 'BODY', + 'Notification.Body' => 'BODY', + 'body' => 'BODY', + 'notification.body' => 'BODY', + 'NotificationTableMap::COL_BODY' => 'BODY', + 'COL_BODY' => 'BODY', + 'notifications.body' => 'BODY', + 'Link' => 'LINK', + 'Notification.Link' => 'LINK', + 'link' => 'LINK', + 'notification.link' => 'LINK', + 'NotificationTableMap::COL_LINK' => 'LINK', + 'COL_LINK' => 'LINK', + 'notifications.link' => 'LINK', + 'Type' => 'TYPE', + 'Notification.Type' => 'TYPE', + 'type' => 'TYPE', + 'notification.type' => 'TYPE', + 'NotificationTableMap::COL_TYPE' => 'TYPE', + 'COL_TYPE' => 'TYPE', + 'notifications.type' => 'TYPE', + 'Seen' => 'SEEN', + 'Notification.Seen' => 'SEEN', + 'seen' => 'SEEN', + 'notification.seen' => 'SEEN', + 'NotificationTableMap::COL_SEEN' => 'SEEN', + 'COL_SEEN' => 'SEEN', + 'notifications.seen' => 'SEEN', + 'Dismissed' => 'DISMISSED', + 'Notification.Dismissed' => 'DISMISSED', + 'dismissed' => 'DISMISSED', + 'notification.dismissed' => 'DISMISSED', + 'NotificationTableMap::COL_DISMISSED' => 'DISMISSED', + 'COL_DISMISSED' => 'DISMISSED', + 'notifications.dismissed' => 'DISMISSED', + 'Archived' => 'ARCHIVED', + 'Notification.Archived' => 'ARCHIVED', + 'archived' => 'ARCHIVED', + 'notification.archived' => 'ARCHIVED', + 'NotificationTableMap::COL_ARCHIVED' => 'ARCHIVED', + 'COL_ARCHIVED' => 'ARCHIVED', + 'notifications.archived' => 'ARCHIVED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('notifications'); @@ -180,28 +267,30 @@ public function initialize() $this->addColumn('seen', 'Seen', 'BOOLEAN', true, 1, false); $this->addColumn('dismissed', 'Dismissed', 'BOOLEAN', true, 1, false); $this->addColumn('archived', 'Archived', 'BOOLEAN', true, 1, false); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('NotificationClick', '\\TechWilk\\Rota\\NotificationClick', RelationMap::ONE_TO_MANY, array( + $this->addRelation('NotificationClick', '\\TechWilk\\Rota\\NotificationClick', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':notificationId', 1 => ':id', ), ), null, null, 'NotificationClicks', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -209,14 +298,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -231,14 +320,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -255,10 +344,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? NotificationTableMap::CLASS_DEFAULT : NotificationTableMap::OM_CLASS; } @@ -266,17 +355,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Notification object, last column rank) + * @return array (Notification object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = NotificationTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = NotificationTableMap::getInstanceFromPool($key))) { @@ -292,7 +381,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: NotificationTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -300,13 +389,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -336,12 +425,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(NotificationTableMap::COL_ID); @@ -369,68 +459,96 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(NotificationTableMap::DATABASE_NAME)->getTable(NotificationTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(NotificationTableMap::COL_ID); + $criteria->removeSelectColumn(NotificationTableMap::COL_TIMESTAMP); + $criteria->removeSelectColumn(NotificationTableMap::COL_USERID); + $criteria->removeSelectColumn(NotificationTableMap::COL_SUMMARY); + $criteria->removeSelectColumn(NotificationTableMap::COL_BODY); + $criteria->removeSelectColumn(NotificationTableMap::COL_LINK); + $criteria->removeSelectColumn(NotificationTableMap::COL_TYPE); + $criteria->removeSelectColumn(NotificationTableMap::COL_SEEN); + $criteria->removeSelectColumn(NotificationTableMap::COL_DISMISSED); + $criteria->removeSelectColumn(NotificationTableMap::COL_ARCHIVED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.timestamp'); + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.summary'); + $criteria->removeSelectColumn($alias . '.body'); + $criteria->removeSelectColumn($alias . '.link'); + $criteria->removeSelectColumn($alias . '.type'); + $criteria->removeSelectColumn($alias . '.seen'); + $criteria->removeSelectColumn($alias . '.dismissed'); + $criteria->removeSelectColumn($alias . '.archived'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(NotificationTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(NotificationTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new NotificationTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(NotificationTableMap::DATABASE_NAME)->getTable(NotificationTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Notification or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Notification object or primary key or array of primary keys + * @param mixed $values Criteria or Notification object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(NotificationTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(NotificationTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Notification) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Notification) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(NotificationTableMap::DATABASE_NAME); - $criteria->add(NotificationTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(NotificationTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = NotificationQuery::create()->mergeWith($criteria); + $query = NotificationQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - NotificationTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + NotificationTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { NotificationTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the notifications table. @@ -438,7 +556,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return NotificationQuery::create()->doDeleteAll($con); } @@ -446,13 +564,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Notification or Criteria object. * - * @param mixed $criteria Criteria or Notification object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Notification object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(NotificationTableMap::DATABASE_NAME); @@ -464,7 +582,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Notification object } - if ($criteria->containsKey(NotificationTableMap::COL_ID) && $criteria->keyContainsValue(NotificationTableMap::COL_ID)) { + if ($criteria->containsKey(NotificationTableMap::COL_ID) && $criteria->keyContainsValue(NotificationTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.NotificationTableMap::COL_ID.')'); } @@ -478,7 +596,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // NotificationTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -NotificationTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/PendingUserTableMap.php b/generated-classes/TechWilk/Rota/Map/PendingUserTableMap.php index daca5484..423d5abb 100644 --- a/generated-classes/TechWilk/Rota/Map/PendingUserTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/PendingUserTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\PendingUser; use TechWilk\Rota\PendingUserQuery; + /** * This class defines the structure of the 'pendingUsers' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class PendingUserTableMap extends TableMap { @@ -33,124 +33,197 @@ class PendingUserTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.PendingUserTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.PendingUserTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'pendingUsers'; + public const TABLE_NAME = 'pendingUsers'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'PendingUser'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\PendingUser'; + public const OM_CLASS = '\\TechWilk\\Rota\\PendingUser'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.PendingUser'; + public const CLASS_DEFAULT = 'TechWilk.Rota.PendingUser'; /** * The total number of columns */ - const NUM_COLUMNS = 8; + public const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 8; + public const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the id field */ - const COL_ID = 'pendingUsers.id'; + public const COL_ID = 'pendingUsers.id'; /** * the column name for the socialId field */ - const COL_SOCIALID = 'pendingUsers.socialId'; + public const COL_SOCIALID = 'pendingUsers.socialId'; /** * the column name for the firstName field */ - const COL_FIRSTNAME = 'pendingUsers.firstName'; + public const COL_FIRSTNAME = 'pendingUsers.firstName'; /** * the column name for the lastName field */ - const COL_LASTNAME = 'pendingUsers.lastName'; + public const COL_LASTNAME = 'pendingUsers.lastName'; /** * the column name for the email field */ - const COL_EMAIL = 'pendingUsers.email'; + public const COL_EMAIL = 'pendingUsers.email'; /** * the column name for the approved field */ - const COL_APPROVED = 'pendingUsers.approved'; + public const COL_APPROVED = 'pendingUsers.approved'; /** * the column name for the declined field */ - const COL_DECLINED = 'pendingUsers.declined'; + public const COL_DECLINED = 'pendingUsers.declined'; /** * the column name for the source field */ - const COL_SOURCE = 'pendingUsers.source'; + public const COL_SOURCE = 'pendingUsers.source'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'SocialId', 'FirstName', 'LastName', 'Email', 'Approved', 'Declined', 'Source', ), - self::TYPE_CAMELNAME => array('id', 'socialId', 'firstName', 'lastName', 'email', 'approved', 'declined', 'source', ), - self::TYPE_COLNAME => array(PendingUserTableMap::COL_ID, PendingUserTableMap::COL_SOCIALID, PendingUserTableMap::COL_FIRSTNAME, PendingUserTableMap::COL_LASTNAME, PendingUserTableMap::COL_EMAIL, PendingUserTableMap::COL_APPROVED, PendingUserTableMap::COL_DECLINED, PendingUserTableMap::COL_SOURCE, ), - self::TYPE_FIELDNAME => array('id', 'socialId', 'firstName', 'lastName', 'email', 'approved', 'declined', 'source', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'SocialId', 'FirstName', 'LastName', 'Email', 'Approved', 'Declined', 'Source', ], + self::TYPE_CAMELNAME => ['id', 'socialId', 'firstName', 'lastName', 'email', 'approved', 'declined', 'source', ], + self::TYPE_COLNAME => [PendingUserTableMap::COL_ID, PendingUserTableMap::COL_SOCIALID, PendingUserTableMap::COL_FIRSTNAME, PendingUserTableMap::COL_LASTNAME, PendingUserTableMap::COL_EMAIL, PendingUserTableMap::COL_APPROVED, PendingUserTableMap::COL_DECLINED, PendingUserTableMap::COL_SOURCE, ], + self::TYPE_FIELDNAME => ['id', 'socialId', 'firstName', 'lastName', 'email', 'approved', 'declined', 'source', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'SocialId' => 1, 'FirstName' => 2, 'LastName' => 3, 'Email' => 4, 'Approved' => 5, 'Declined' => 6, 'Source' => 7, ), - self::TYPE_CAMELNAME => array('id' => 0, 'socialId' => 1, 'firstName' => 2, 'lastName' => 3, 'email' => 4, 'approved' => 5, 'declined' => 6, 'source' => 7, ), - self::TYPE_COLNAME => array(PendingUserTableMap::COL_ID => 0, PendingUserTableMap::COL_SOCIALID => 1, PendingUserTableMap::COL_FIRSTNAME => 2, PendingUserTableMap::COL_LASTNAME => 3, PendingUserTableMap::COL_EMAIL => 4, PendingUserTableMap::COL_APPROVED => 5, PendingUserTableMap::COL_DECLINED => 6, PendingUserTableMap::COL_SOURCE => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'socialId' => 1, 'firstName' => 2, 'lastName' => 3, 'email' => 4, 'approved' => 5, 'declined' => 6, 'source' => 7, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'SocialId' => 1, 'FirstName' => 2, 'LastName' => 3, 'Email' => 4, 'Approved' => 5, 'Declined' => 6, 'Source' => 7, ], + self::TYPE_CAMELNAME => ['id' => 0, 'socialId' => 1, 'firstName' => 2, 'lastName' => 3, 'email' => 4, 'approved' => 5, 'declined' => 6, 'source' => 7, ], + self::TYPE_COLNAME => [PendingUserTableMap::COL_ID => 0, PendingUserTableMap::COL_SOCIALID => 1, PendingUserTableMap::COL_FIRSTNAME => 2, PendingUserTableMap::COL_LASTNAME => 3, PendingUserTableMap::COL_EMAIL => 4, PendingUserTableMap::COL_APPROVED => 5, PendingUserTableMap::COL_DECLINED => 6, PendingUserTableMap::COL_SOURCE => 7, ], + self::TYPE_FIELDNAME => ['id' => 0, 'socialId' => 1, 'firstName' => 2, 'lastName' => 3, 'email' => 4, 'approved' => 5, 'declined' => 6, 'source' => 7, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'PendingUser.Id' => 'ID', + 'id' => 'ID', + 'pendingUser.id' => 'ID', + 'PendingUserTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'pendingUsers.id' => 'ID', + 'SocialId' => 'SOCIALID', + 'PendingUser.SocialId' => 'SOCIALID', + 'socialId' => 'SOCIALID', + 'pendingUser.socialId' => 'SOCIALID', + 'PendingUserTableMap::COL_SOCIALID' => 'SOCIALID', + 'COL_SOCIALID' => 'SOCIALID', + 'pendingUsers.socialId' => 'SOCIALID', + 'FirstName' => 'FIRSTNAME', + 'PendingUser.FirstName' => 'FIRSTNAME', + 'firstName' => 'FIRSTNAME', + 'pendingUser.firstName' => 'FIRSTNAME', + 'PendingUserTableMap::COL_FIRSTNAME' => 'FIRSTNAME', + 'COL_FIRSTNAME' => 'FIRSTNAME', + 'pendingUsers.firstName' => 'FIRSTNAME', + 'LastName' => 'LASTNAME', + 'PendingUser.LastName' => 'LASTNAME', + 'lastName' => 'LASTNAME', + 'pendingUser.lastName' => 'LASTNAME', + 'PendingUserTableMap::COL_LASTNAME' => 'LASTNAME', + 'COL_LASTNAME' => 'LASTNAME', + 'pendingUsers.lastName' => 'LASTNAME', + 'Email' => 'EMAIL', + 'PendingUser.Email' => 'EMAIL', + 'email' => 'EMAIL', + 'pendingUser.email' => 'EMAIL', + 'PendingUserTableMap::COL_EMAIL' => 'EMAIL', + 'COL_EMAIL' => 'EMAIL', + 'pendingUsers.email' => 'EMAIL', + 'Approved' => 'APPROVED', + 'PendingUser.Approved' => 'APPROVED', + 'approved' => 'APPROVED', + 'pendingUser.approved' => 'APPROVED', + 'PendingUserTableMap::COL_APPROVED' => 'APPROVED', + 'COL_APPROVED' => 'APPROVED', + 'pendingUsers.approved' => 'APPROVED', + 'Declined' => 'DECLINED', + 'PendingUser.Declined' => 'DECLINED', + 'declined' => 'DECLINED', + 'pendingUser.declined' => 'DECLINED', + 'PendingUserTableMap::COL_DECLINED' => 'DECLINED', + 'COL_DECLINED' => 'DECLINED', + 'pendingUsers.declined' => 'DECLINED', + 'Source' => 'SOURCE', + 'PendingUser.Source' => 'SOURCE', + 'source' => 'SOURCE', + 'pendingUser.source' => 'SOURCE', + 'PendingUserTableMap::COL_SOURCE' => 'SOURCE', + 'COL_SOURCE' => 'SOURCE', + 'pendingUsers.source' => 'SOURCE', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('pendingUsers'); @@ -168,14 +241,16 @@ public function initialize() $this->addColumn('approved', 'Approved', 'BOOLEAN', true, 1, false); $this->addColumn('declined', 'Declined', 'BOOLEAN', true, 1, false); $this->addColumn('source', 'Source', 'VARCHAR', true, 50, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -183,14 +258,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -205,14 +280,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -229,10 +304,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? PendingUserTableMap::CLASS_DEFAULT : PendingUserTableMap::OM_CLASS; } @@ -240,17 +315,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (PendingUser object, last column rank) + * @return array (PendingUser object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = PendingUserTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = PendingUserTableMap::getInstanceFromPool($key))) { @@ -266,7 +341,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: PendingUserTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -274,13 +349,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -310,12 +385,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(PendingUserTableMap::COL_ID); @@ -339,68 +415,92 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(PendingUserTableMap::DATABASE_NAME)->getTable(PendingUserTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(PendingUserTableMap::COL_ID); + $criteria->removeSelectColumn(PendingUserTableMap::COL_SOCIALID); + $criteria->removeSelectColumn(PendingUserTableMap::COL_FIRSTNAME); + $criteria->removeSelectColumn(PendingUserTableMap::COL_LASTNAME); + $criteria->removeSelectColumn(PendingUserTableMap::COL_EMAIL); + $criteria->removeSelectColumn(PendingUserTableMap::COL_APPROVED); + $criteria->removeSelectColumn(PendingUserTableMap::COL_DECLINED); + $criteria->removeSelectColumn(PendingUserTableMap::COL_SOURCE); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.socialId'); + $criteria->removeSelectColumn($alias . '.firstName'); + $criteria->removeSelectColumn($alias . '.lastName'); + $criteria->removeSelectColumn($alias . '.email'); + $criteria->removeSelectColumn($alias . '.approved'); + $criteria->removeSelectColumn($alias . '.declined'); + $criteria->removeSelectColumn($alias . '.source'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(PendingUserTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(PendingUserTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new PendingUserTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(PendingUserTableMap::DATABASE_NAME)->getTable(PendingUserTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a PendingUser or Criteria object OR a primary key value. * - * @param mixed $values Criteria or PendingUser object or primary key or array of primary keys + * @param mixed $values Criteria or PendingUser object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(PendingUserTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(PendingUserTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\PendingUser) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\PendingUser) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(PendingUserTableMap::DATABASE_NAME); - $criteria->add(PendingUserTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(PendingUserTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = PendingUserQuery::create()->mergeWith($criteria); + $query = PendingUserQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - PendingUserTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + PendingUserTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { PendingUserTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the pendingUsers table. @@ -408,7 +508,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return PendingUserQuery::create()->doDeleteAll($con); } @@ -416,13 +516,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a PendingUser or Criteria object. * - * @param mixed $criteria Criteria or PendingUser object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or PendingUser object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PendingUserTableMap::DATABASE_NAME); @@ -434,7 +534,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from PendingUser object } - if ($criteria->containsKey(PendingUserTableMap::COL_ID) && $criteria->keyContainsValue(PendingUserTableMap::COL_ID)) { + if ($criteria->containsKey(PendingUserTableMap::COL_ID) && $criteria->keyContainsValue(PendingUserTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.PendingUserTableMap::COL_ID.')'); } @@ -448,7 +548,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // PendingUserTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -PendingUserTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/PermissionGroupPermissionTableMap.php b/generated-classes/TechWilk/Rota/Map/PermissionGroupPermissionTableMap.php index 92470553..8cf3b7be 100644 --- a/generated-classes/TechWilk/Rota/Map/PermissionGroupPermissionTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/PermissionGroupPermissionTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\PermissionGroupPermission; use TechWilk\Rota\PermissionGroupPermissionQuery; + /** * This class defines the structure of the 'permissionGroupPermissions' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class PermissionGroupPermissionTableMap extends TableMap { @@ -33,99 +33,139 @@ class PermissionGroupPermissionTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.PermissionGroupPermissionTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.PermissionGroupPermissionTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'permissionGroupPermissions'; + public const TABLE_NAME = 'permissionGroupPermissions'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'PermissionGroupPermission'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\PermissionGroupPermission'; + public const OM_CLASS = '\\TechWilk\\Rota\\PermissionGroupPermission'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.PermissionGroupPermission'; + public const CLASS_DEFAULT = 'TechWilk.Rota.PermissionGroupPermission'; /** * The total number of columns */ - const NUM_COLUMNS = 3; + public const NUM_COLUMNS = 3; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 3; + public const NUM_HYDRATE_COLUMNS = 3; /** * the column name for the id field */ - const COL_ID = 'permissionGroupPermissions.id'; + public const COL_ID = 'permissionGroupPermissions.id'; /** * the column name for the permissionId field */ - const COL_PERMISSIONID = 'permissionGroupPermissions.permissionId'; + public const COL_PERMISSIONID = 'permissionGroupPermissions.permissionId'; /** * the column name for the permissionGroupId field */ - const COL_PERMISSIONGROUPID = 'permissionGroupPermissions.permissionGroupId'; + public const COL_PERMISSIONGROUPID = 'permissionGroupPermissions.permissionGroupId'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'UserId', 'PermissionId', ), - self::TYPE_CAMELNAME => array('id', 'userId', 'permissionId', ), - self::TYPE_COLNAME => array(PermissionGroupPermissionTableMap::COL_ID, PermissionGroupPermissionTableMap::COL_PERMISSIONID, PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID, ), - self::TYPE_FIELDNAME => array('id', 'permissionId', 'permissionGroupId', ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'UserId', 'PermissionId', ], + self::TYPE_CAMELNAME => ['id', 'userId', 'permissionId', ], + self::TYPE_COLNAME => [PermissionGroupPermissionTableMap::COL_ID, PermissionGroupPermissionTableMap::COL_PERMISSIONID, PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID, ], + self::TYPE_FIELDNAME => ['id', 'permissionId', 'permissionGroupId', ], + self::TYPE_NUM => [0, 1, 2, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'UserId' => 1, 'PermissionId' => 2, ], + self::TYPE_CAMELNAME => ['id' => 0, 'userId' => 1, 'permissionId' => 2, ], + self::TYPE_COLNAME => [PermissionGroupPermissionTableMap::COL_ID => 0, PermissionGroupPermissionTableMap::COL_PERMISSIONID => 1, PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID => 2, ], + self::TYPE_FIELDNAME => ['id' => 0, 'permissionId' => 1, 'permissionGroupId' => 2, ], + self::TYPE_NUM => [0, 1, 2, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'UserId' => 1, 'PermissionId' => 2, ), - self::TYPE_CAMELNAME => array('id' => 0, 'userId' => 1, 'permissionId' => 2, ), - self::TYPE_COLNAME => array(PermissionGroupPermissionTableMap::COL_ID => 0, PermissionGroupPermissionTableMap::COL_PERMISSIONID => 1, PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID => 2, ), - self::TYPE_FIELDNAME => array('id' => 0, 'permissionId' => 1, 'permissionGroupId' => 2, ), - self::TYPE_NUM => array(0, 1, 2, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'PermissionGroupPermission.Id' => 'ID', + 'id' => 'ID', + 'permissionGroupPermission.id' => 'ID', + 'PermissionGroupPermissionTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'permissionGroupPermissions.id' => 'ID', + 'UserId' => 'PERMISSIONID', + 'PermissionGroupPermission.UserId' => 'PERMISSIONID', + 'userId' => 'PERMISSIONID', + 'permissionGroupPermission.userId' => 'PERMISSIONID', + 'PermissionGroupPermissionTableMap::COL_PERMISSIONID' => 'PERMISSIONID', + 'COL_PERMISSIONID' => 'PERMISSIONID', + 'permissionId' => 'PERMISSIONID', + 'permissionGroupPermissions.permissionId' => 'PERMISSIONID', + 'PermissionId' => 'PERMISSIONGROUPID', + 'PermissionGroupPermission.PermissionId' => 'PERMISSIONGROUPID', + 'permissionId' => 'PERMISSIONGROUPID', + 'permissionGroupPermission.permissionId' => 'PERMISSIONGROUPID', + 'PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID' => 'PERMISSIONGROUPID', + 'COL_PERMISSIONGROUPID' => 'PERMISSIONGROUPID', + 'permissionGroupId' => 'PERMISSIONGROUPID', + 'permissionGroupPermissions.permissionGroupId' => 'PERMISSIONGROUPID', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('permissionGroupPermissions'); @@ -138,28 +178,30 @@ public function initialize() $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('permissionId', 'UserId', 'INTEGER', 'permissions', 'id', true, 30, 0); $this->addForeignKey('permissionGroupId', 'PermissionId', 'INTEGER', 'permissionGroups', 'id', true, null, 0); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Permission', '\\TechWilk\\Rota\\Permission', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Permission', '\\TechWilk\\Rota\\Permission', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':permissionId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('PermissionGroup', '\\TechWilk\\Rota\\PermissionGroup', RelationMap::MANY_TO_ONE, array( + $this->addRelation('PermissionGroup', '\\TechWilk\\Rota\\PermissionGroup', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':permissionGroupId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -167,14 +209,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -189,14 +231,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -213,10 +255,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? PermissionGroupPermissionTableMap::CLASS_DEFAULT : PermissionGroupPermissionTableMap::OM_CLASS; } @@ -224,17 +266,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (PermissionGroupPermission object, last column rank) + * @return array (PermissionGroupPermission object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = PermissionGroupPermissionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = PermissionGroupPermissionTableMap::getInstanceFromPool($key))) { @@ -250,7 +292,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: PermissionGroupPermissionTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -258,13 +300,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -294,12 +336,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(PermissionGroupPermissionTableMap::COL_ID); @@ -313,68 +356,82 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(PermissionGroupPermissionTableMap::DATABASE_NAME)->getTable(PermissionGroupPermissionTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(PermissionGroupPermissionTableMap::COL_ID); + $criteria->removeSelectColumn(PermissionGroupPermissionTableMap::COL_PERMISSIONID); + $criteria->removeSelectColumn(PermissionGroupPermissionTableMap::COL_PERMISSIONGROUPID); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.permissionId'); + $criteria->removeSelectColumn($alias . '.permissionGroupId'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(PermissionGroupPermissionTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(PermissionGroupPermissionTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new PermissionGroupPermissionTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(PermissionGroupPermissionTableMap::DATABASE_NAME)->getTable(PermissionGroupPermissionTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a PermissionGroupPermission or Criteria object OR a primary key value. * - * @param mixed $values Criteria or PermissionGroupPermission object or primary key or array of primary keys + * @param mixed $values Criteria or PermissionGroupPermission object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupPermissionTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupPermissionTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\PermissionGroupPermission) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\PermissionGroupPermission) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(PermissionGroupPermissionTableMap::DATABASE_NAME); - $criteria->add(PermissionGroupPermissionTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(PermissionGroupPermissionTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = PermissionGroupPermissionQuery::create()->mergeWith($criteria); + $query = PermissionGroupPermissionQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - PermissionGroupPermissionTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + PermissionGroupPermissionTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { PermissionGroupPermissionTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the permissionGroupPermissions table. @@ -382,7 +439,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return PermissionGroupPermissionQuery::create()->doDeleteAll($con); } @@ -390,13 +447,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a PermissionGroupPermission or Criteria object. * - * @param mixed $criteria Criteria or PermissionGroupPermission object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or PermissionGroupPermission object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupPermissionTableMap::DATABASE_NAME); @@ -408,7 +465,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from PermissionGroupPermission object } - if ($criteria->containsKey(PermissionGroupPermissionTableMap::COL_ID) && $criteria->keyContainsValue(PermissionGroupPermissionTableMap::COL_ID)) { + if ($criteria->containsKey(PermissionGroupPermissionTableMap::COL_ID) && $criteria->keyContainsValue(PermissionGroupPermissionTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.PermissionGroupPermissionTableMap::COL_ID.')'); } @@ -422,7 +479,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // PermissionGroupPermissionTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -PermissionGroupPermissionTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/PermissionGroupTableMap.php b/generated-classes/TechWilk/Rota/Map/PermissionGroupTableMap.php index 1c3dee65..eb8424db 100644 --- a/generated-classes/TechWilk/Rota/Map/PermissionGroupTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/PermissionGroupTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\PermissionGroup; use TechWilk\Rota\PermissionGroupQuery; + /** * This class defines the structure of the 'permissionGroups' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class PermissionGroupTableMap extends TableMap { @@ -33,109 +33,161 @@ class PermissionGroupTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.PermissionGroupTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.PermissionGroupTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'permissionGroups'; + public const TABLE_NAME = 'permissionGroups'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'PermissionGroup'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\PermissionGroup'; + public const OM_CLASS = '\\TechWilk\\Rota\\PermissionGroup'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.PermissionGroup'; + public const CLASS_DEFAULT = 'TechWilk.Rota.PermissionGroup'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + public const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + public const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the id field */ - const COL_ID = 'permissionGroups.id'; + public const COL_ID = 'permissionGroups.id'; /** * the column name for the name field */ - const COL_NAME = 'permissionGroups.name'; + public const COL_NAME = 'permissionGroups.name'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'permissionGroups.description'; + public const COL_DESCRIPTION = 'permissionGroups.description'; /** * the column name for the created field */ - const COL_CREATED = 'permissionGroups.created'; + public const COL_CREATED = 'permissionGroups.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'permissionGroups.updated'; + public const COL_UPDATED = 'permissionGroups.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Description', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'name', 'description', 'created', 'updated', ), - self::TYPE_COLNAME => array(PermissionGroupTableMap::COL_ID, PermissionGroupTableMap::COL_NAME, PermissionGroupTableMap::COL_DESCRIPTION, PermissionGroupTableMap::COL_CREATED, PermissionGroupTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'name', 'description', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Description', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'name', 'description', 'created', 'updated', ], + self::TYPE_COLNAME => [PermissionGroupTableMap::COL_ID, PermissionGroupTableMap::COL_NAME, PermissionGroupTableMap::COL_DESCRIPTION, PermissionGroupTableMap::COL_CREATED, PermissionGroupTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'name', 'description', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Description' => 2, 'Created' => 3, 'Updated' => 4, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'created' => 3, 'updated' => 4, ], + self::TYPE_COLNAME => [PermissionGroupTableMap::COL_ID => 0, PermissionGroupTableMap::COL_NAME => 1, PermissionGroupTableMap::COL_DESCRIPTION => 2, PermissionGroupTableMap::COL_CREATED => 3, PermissionGroupTableMap::COL_UPDATED => 4, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'created' => 3, 'updated' => 4, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Description' => 2, 'Created' => 3, 'Updated' => 4, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'created' => 3, 'updated' => 4, ), - self::TYPE_COLNAME => array(PermissionGroupTableMap::COL_ID => 0, PermissionGroupTableMap::COL_NAME => 1, PermissionGroupTableMap::COL_DESCRIPTION => 2, PermissionGroupTableMap::COL_CREATED => 3, PermissionGroupTableMap::COL_UPDATED => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'created' => 3, 'updated' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'PermissionGroup.Id' => 'ID', + 'id' => 'ID', + 'permissionGroup.id' => 'ID', + 'PermissionGroupTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'permissionGroups.id' => 'ID', + 'Name' => 'NAME', + 'PermissionGroup.Name' => 'NAME', + 'name' => 'NAME', + 'permissionGroup.name' => 'NAME', + 'PermissionGroupTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'permissionGroups.name' => 'NAME', + 'Description' => 'DESCRIPTION', + 'PermissionGroup.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'permissionGroup.description' => 'DESCRIPTION', + 'PermissionGroupTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'permissionGroups.description' => 'DESCRIPTION', + 'Created' => 'CREATED', + 'PermissionGroup.Created' => 'CREATED', + 'created' => 'CREATED', + 'permissionGroup.created' => 'CREATED', + 'PermissionGroupTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'permissionGroups.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'PermissionGroup.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'permissionGroup.updated' => 'UPDATED', + 'PermissionGroupTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'permissionGroups.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('permissionGroups'); @@ -150,34 +202,36 @@ public function initialize() $this->addColumn('description', 'Description', 'LONGVARCHAR', false, null, null); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('PermissionGroupPermission', '\\TechWilk\\Rota\\PermissionGroupPermission', RelationMap::ONE_TO_MANY, array( + $this->addRelation('PermissionGroupPermission', '\\TechWilk\\Rota\\PermissionGroupPermission', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':permissionGroupId', 1 => ':id', ), ), null, null, 'PermissionGroupPermissions', false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -185,14 +239,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -207,14 +261,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -231,10 +285,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? PermissionGroupTableMap::CLASS_DEFAULT : PermissionGroupTableMap::OM_CLASS; } @@ -242,17 +296,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (PermissionGroup object, last column rank) + * @return array (PermissionGroup object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = PermissionGroupTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = PermissionGroupTableMap::getInstanceFromPool($key))) { @@ -268,7 +322,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: PermissionGroupTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -276,13 +330,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -312,12 +366,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(PermissionGroupTableMap::COL_ID); @@ -335,68 +390,86 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(PermissionGroupTableMap::DATABASE_NAME)->getTable(PermissionGroupTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(PermissionGroupTableMap::COL_ID); + $criteria->removeSelectColumn(PermissionGroupTableMap::COL_NAME); + $criteria->removeSelectColumn(PermissionGroupTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(PermissionGroupTableMap::COL_CREATED); + $criteria->removeSelectColumn(PermissionGroupTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(PermissionGroupTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(PermissionGroupTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new PermissionGroupTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(PermissionGroupTableMap::DATABASE_NAME)->getTable(PermissionGroupTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a PermissionGroup or Criteria object OR a primary key value. * - * @param mixed $values Criteria or PermissionGroup object or primary key or array of primary keys + * @param mixed $values Criteria or PermissionGroup object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\PermissionGroup) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\PermissionGroup) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(PermissionGroupTableMap::DATABASE_NAME); - $criteria->add(PermissionGroupTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(PermissionGroupTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = PermissionGroupQuery::create()->mergeWith($criteria); + $query = PermissionGroupQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - PermissionGroupTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + PermissionGroupTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { PermissionGroupTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the permissionGroups table. @@ -404,7 +477,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return PermissionGroupQuery::create()->doDeleteAll($con); } @@ -412,13 +485,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a PermissionGroup or Criteria object. * - * @param mixed $criteria Criteria or PermissionGroup object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or PermissionGroup object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionGroupTableMap::DATABASE_NAME); @@ -430,7 +503,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from PermissionGroup object } - if ($criteria->containsKey(PermissionGroupTableMap::COL_ID) && $criteria->keyContainsValue(PermissionGroupTableMap::COL_ID)) { + if ($criteria->containsKey(PermissionGroupTableMap::COL_ID) && $criteria->keyContainsValue(PermissionGroupTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.PermissionGroupTableMap::COL_ID.')'); } @@ -444,7 +517,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // PermissionGroupTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -PermissionGroupTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/PermissionTableMap.php b/generated-classes/TechWilk/Rota/Map/PermissionTableMap.php index aff665ae..738d7f29 100644 --- a/generated-classes/TechWilk/Rota/Map/PermissionTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/PermissionTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Permission; use TechWilk\Rota\PermissionQuery; + /** * This class defines the structure of the 'permissions' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class PermissionTableMap extends TableMap { @@ -33,104 +33,149 @@ class PermissionTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.PermissionTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.PermissionTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'permissions'; + public const TABLE_NAME = 'permissions'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Permission'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Permission'; + public const OM_CLASS = '\\TechWilk\\Rota\\Permission'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Permission'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Permission'; /** * The total number of columns */ - const NUM_COLUMNS = 4; + public const NUM_COLUMNS = 4; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 4; + public const NUM_HYDRATE_COLUMNS = 4; /** * the column name for the id field */ - const COL_ID = 'permissions.id'; + public const COL_ID = 'permissions.id'; /** * the column name for the name field */ - const COL_NAME = 'permissions.name'; + public const COL_NAME = 'permissions.name'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'permissions.description'; + public const COL_DESCRIPTION = 'permissions.description'; /** * the column name for the slug field */ - const COL_SLUG = 'permissions.slug'; + public const COL_SLUG = 'permissions.slug'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'Name', 'Description', 'Slug', ), - self::TYPE_CAMELNAME => array('id', 'name', 'description', 'slug', ), - self::TYPE_COLNAME => array(PermissionTableMap::COL_ID, PermissionTableMap::COL_NAME, PermissionTableMap::COL_DESCRIPTION, PermissionTableMap::COL_SLUG, ), - self::TYPE_FIELDNAME => array('id', 'name', 'description', 'slug', ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'Name', 'Description', 'Slug', ], + self::TYPE_CAMELNAME => ['id', 'name', 'description', 'slug', ], + self::TYPE_COLNAME => [PermissionTableMap::COL_ID, PermissionTableMap::COL_NAME, PermissionTableMap::COL_DESCRIPTION, PermissionTableMap::COL_SLUG, ], + self::TYPE_FIELDNAME => ['id', 'name', 'description', 'slug', ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'Name' => 1, 'Description' => 2, 'Slug' => 3, ], + self::TYPE_CAMELNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'slug' => 3, ], + self::TYPE_COLNAME => [PermissionTableMap::COL_ID => 0, PermissionTableMap::COL_NAME => 1, PermissionTableMap::COL_DESCRIPTION => 2, PermissionTableMap::COL_SLUG => 3, ], + self::TYPE_FIELDNAME => ['id' => 0, 'name' => 1, 'description' => 2, 'slug' => 3, ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Description' => 2, 'Slug' => 3, ), - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'slug' => 3, ), - self::TYPE_COLNAME => array(PermissionTableMap::COL_ID => 0, PermissionTableMap::COL_NAME => 1, PermissionTableMap::COL_DESCRIPTION => 2, PermissionTableMap::COL_SLUG => 3, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'description' => 2, 'slug' => 3, ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Permission.Id' => 'ID', + 'id' => 'ID', + 'permission.id' => 'ID', + 'PermissionTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'permissions.id' => 'ID', + 'Name' => 'NAME', + 'Permission.Name' => 'NAME', + 'name' => 'NAME', + 'permission.name' => 'NAME', + 'PermissionTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'permissions.name' => 'NAME', + 'Description' => 'DESCRIPTION', + 'Permission.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'permission.description' => 'DESCRIPTION', + 'PermissionTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'permissions.description' => 'DESCRIPTION', + 'Slug' => 'SLUG', + 'Permission.Slug' => 'SLUG', + 'slug' => 'SLUG', + 'permission.slug' => 'SLUG', + 'PermissionTableMap::COL_SLUG' => 'SLUG', + 'COL_SLUG' => 'SLUG', + 'permissions.slug' => 'SLUG', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('permissions'); @@ -144,28 +189,30 @@ public function initialize() $this->addColumn('name', 'Name', 'VARCHAR', false, 255, null); $this->addColumn('description', 'Description', 'LONGVARCHAR', false, null, null); $this->addColumn('slug', 'Slug', 'VARCHAR', true, 10, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('UserPermission', '\\TechWilk\\Rota\\UserPermission', RelationMap::ONE_TO_MANY, array( + $this->addRelation('UserPermission', '\\TechWilk\\Rota\\UserPermission', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':permissionId', 1 => ':id', ), ), null, null, 'UserPermissions', false); - $this->addRelation('PermissionGroupPermission', '\\TechWilk\\Rota\\PermissionGroupPermission', RelationMap::ONE_TO_MANY, array( + $this->addRelation('PermissionGroupPermission', '\\TechWilk\\Rota\\PermissionGroupPermission', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':permissionId', 1 => ':id', ), ), null, null, 'PermissionGroupPermissions', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -173,14 +220,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -195,14 +242,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -219,10 +266,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? PermissionTableMap::CLASS_DEFAULT : PermissionTableMap::OM_CLASS; } @@ -230,17 +277,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Permission object, last column rank) + * @return array (Permission object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = PermissionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = PermissionTableMap::getInstanceFromPool($key))) { @@ -256,7 +303,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: PermissionTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -264,13 +311,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -300,12 +347,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(PermissionTableMap::COL_ID); @@ -321,68 +369,84 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(PermissionTableMap::DATABASE_NAME)->getTable(PermissionTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(PermissionTableMap::COL_ID); + $criteria->removeSelectColumn(PermissionTableMap::COL_NAME); + $criteria->removeSelectColumn(PermissionTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(PermissionTableMap::COL_SLUG); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.slug'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(PermissionTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(PermissionTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new PermissionTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(PermissionTableMap::DATABASE_NAME)->getTable(PermissionTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Permission or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Permission object or primary key or array of primary keys + * @param mixed $values Criteria or Permission object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(PermissionTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(PermissionTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Permission) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Permission) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(PermissionTableMap::DATABASE_NAME); - $criteria->add(PermissionTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(PermissionTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = PermissionQuery::create()->mergeWith($criteria); + $query = PermissionQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - PermissionTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + PermissionTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { PermissionTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the permissions table. @@ -390,7 +454,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return PermissionQuery::create()->doDeleteAll($con); } @@ -398,13 +462,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Permission or Criteria object. * - * @param mixed $criteria Criteria or Permission object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Permission object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(PermissionTableMap::DATABASE_NAME); @@ -426,7 +490,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // PermissionTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -PermissionTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/RoleTableMap.php b/generated-classes/TechWilk/Rota/Map/RoleTableMap.php index b7fac937..44fe11b7 100644 --- a/generated-classes/TechWilk/Rota/Map/RoleTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/RoleTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Role; use TechWilk\Rota\RoleQuery; + /** * This class defines the structure of the 'roles' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class RoleTableMap extends TableMap { @@ -33,114 +33,173 @@ class RoleTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.RoleTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.RoleTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'roles'; + public const TABLE_NAME = 'roles'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Role'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Role'; + public const OM_CLASS = '\\TechWilk\\Rota\\Role'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Role'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Role'; /** * The total number of columns */ - const NUM_COLUMNS = 6; + public const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + public const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the id field */ - const COL_ID = 'roles.id'; + public const COL_ID = 'roles.id'; /** * the column name for the groupId field */ - const COL_GROUPID = 'roles.groupId'; + public const COL_GROUPID = 'roles.groupId'; /** * the column name for the name field */ - const COL_NAME = 'roles.name'; + public const COL_NAME = 'roles.name'; /** * the column name for the description field */ - const COL_DESCRIPTION = 'roles.description'; + public const COL_DESCRIPTION = 'roles.description'; /** * the column name for the rehersalId field */ - const COL_REHERSALID = 'roles.rehersalId'; + public const COL_REHERSALID = 'roles.rehersalId'; /** * the column name for the allowRoleSwaps field */ - const COL_ALLOWROLESWAPS = 'roles.allowRoleSwaps'; + public const COL_ALLOWROLESWAPS = 'roles.allowRoleSwaps'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'GroupId', 'Name', 'Description', 'RehersalId', 'AllowRoleSwaps', ), - self::TYPE_CAMELNAME => array('id', 'groupId', 'name', 'description', 'rehersalId', 'allowRoleSwaps', ), - self::TYPE_COLNAME => array(RoleTableMap::COL_ID, RoleTableMap::COL_GROUPID, RoleTableMap::COL_NAME, RoleTableMap::COL_DESCRIPTION, RoleTableMap::COL_REHERSALID, RoleTableMap::COL_ALLOWROLESWAPS, ), - self::TYPE_FIELDNAME => array('id', 'groupId', 'name', 'description', 'rehersalId', 'allowRoleSwaps', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'GroupId', 'Name', 'Description', 'RehersalId', 'AllowRoleSwaps', ], + self::TYPE_CAMELNAME => ['id', 'groupId', 'name', 'description', 'rehersalId', 'allowRoleSwaps', ], + self::TYPE_COLNAME => [RoleTableMap::COL_ID, RoleTableMap::COL_GROUPID, RoleTableMap::COL_NAME, RoleTableMap::COL_DESCRIPTION, RoleTableMap::COL_REHERSALID, RoleTableMap::COL_ALLOWROLESWAPS, ], + self::TYPE_FIELDNAME => ['id', 'groupId', 'name', 'description', 'rehersalId', 'allowRoleSwaps', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'GroupId' => 1, 'Name' => 2, 'Description' => 3, 'RehersalId' => 4, 'AllowRoleSwaps' => 5, ], + self::TYPE_CAMELNAME => ['id' => 0, 'groupId' => 1, 'name' => 2, 'description' => 3, 'rehersalId' => 4, 'allowRoleSwaps' => 5, ], + self::TYPE_COLNAME => [RoleTableMap::COL_ID => 0, RoleTableMap::COL_GROUPID => 1, RoleTableMap::COL_NAME => 2, RoleTableMap::COL_DESCRIPTION => 3, RoleTableMap::COL_REHERSALID => 4, RoleTableMap::COL_ALLOWROLESWAPS => 5, ], + self::TYPE_FIELDNAME => ['id' => 0, 'groupId' => 1, 'name' => 2, 'description' => 3, 'rehersalId' => 4, 'allowRoleSwaps' => 5, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'GroupId' => 1, 'Name' => 2, 'Description' => 3, 'RehersalId' => 4, 'AllowRoleSwaps' => 5, ), - self::TYPE_CAMELNAME => array('id' => 0, 'groupId' => 1, 'name' => 2, 'description' => 3, 'rehersalId' => 4, 'allowRoleSwaps' => 5, ), - self::TYPE_COLNAME => array(RoleTableMap::COL_ID => 0, RoleTableMap::COL_GROUPID => 1, RoleTableMap::COL_NAME => 2, RoleTableMap::COL_DESCRIPTION => 3, RoleTableMap::COL_REHERSALID => 4, RoleTableMap::COL_ALLOWROLESWAPS => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'groupId' => 1, 'name' => 2, 'description' => 3, 'rehersalId' => 4, 'allowRoleSwaps' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Role.Id' => 'ID', + 'id' => 'ID', + 'role.id' => 'ID', + 'RoleTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'roles.id' => 'ID', + 'GroupId' => 'GROUPID', + 'Role.GroupId' => 'GROUPID', + 'groupId' => 'GROUPID', + 'role.groupId' => 'GROUPID', + 'RoleTableMap::COL_GROUPID' => 'GROUPID', + 'COL_GROUPID' => 'GROUPID', + 'roles.groupId' => 'GROUPID', + 'Name' => 'NAME', + 'Role.Name' => 'NAME', + 'name' => 'NAME', + 'role.name' => 'NAME', + 'RoleTableMap::COL_NAME' => 'NAME', + 'COL_NAME' => 'NAME', + 'roles.name' => 'NAME', + 'Description' => 'DESCRIPTION', + 'Role.Description' => 'DESCRIPTION', + 'description' => 'DESCRIPTION', + 'role.description' => 'DESCRIPTION', + 'RoleTableMap::COL_DESCRIPTION' => 'DESCRIPTION', + 'COL_DESCRIPTION' => 'DESCRIPTION', + 'roles.description' => 'DESCRIPTION', + 'RehersalId' => 'REHERSALID', + 'Role.RehersalId' => 'REHERSALID', + 'rehersalId' => 'REHERSALID', + 'role.rehersalId' => 'REHERSALID', + 'RoleTableMap::COL_REHERSALID' => 'REHERSALID', + 'COL_REHERSALID' => 'REHERSALID', + 'roles.rehersalId' => 'REHERSALID', + 'AllowRoleSwaps' => 'ALLOWROLESWAPS', + 'Role.AllowRoleSwaps' => 'ALLOWROLESWAPS', + 'allowRoleSwaps' => 'ALLOWROLESWAPS', + 'role.allowRoleSwaps' => 'ALLOWROLESWAPS', + 'RoleTableMap::COL_ALLOWROLESWAPS' => 'ALLOWROLESWAPS', + 'COL_ALLOWROLESWAPS' => 'ALLOWROLESWAPS', + 'roles.allowRoleSwaps' => 'ALLOWROLESWAPS', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('roles'); @@ -156,28 +215,30 @@ public function initialize() $this->addColumn('description', 'Description', 'LONGVARCHAR', true, null, null); $this->addColumn('rehersalId', 'RehersalId', 'INTEGER', true, 6, 0); $this->addColumn('allowRoleSwaps', 'AllowRoleSwaps', 'BOOLEAN', false, 1, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('Group', '\\TechWilk\\Rota\\Group', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Group', '\\TechWilk\\Rota\\Group', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':groupId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('UserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::ONE_TO_MANY, array( + $this->addRelation('UserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':roleId', 1 => ':id', ), ), null, null, 'UserRoles', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -185,14 +246,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -207,14 +268,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -231,10 +292,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? RoleTableMap::CLASS_DEFAULT : RoleTableMap::OM_CLASS; } @@ -242,17 +303,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Role object, last column rank) + * @return array (Role object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = RoleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = RoleTableMap::getInstanceFromPool($key))) { @@ -268,7 +329,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: RoleTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -276,13 +337,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -312,12 +373,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(RoleTableMap::COL_ID); @@ -337,68 +399,88 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(RoleTableMap::DATABASE_NAME)->getTable(RoleTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(RoleTableMap::COL_ID); + $criteria->removeSelectColumn(RoleTableMap::COL_GROUPID); + $criteria->removeSelectColumn(RoleTableMap::COL_NAME); + $criteria->removeSelectColumn(RoleTableMap::COL_DESCRIPTION); + $criteria->removeSelectColumn(RoleTableMap::COL_REHERSALID); + $criteria->removeSelectColumn(RoleTableMap::COL_ALLOWROLESWAPS); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.groupId'); + $criteria->removeSelectColumn($alias . '.name'); + $criteria->removeSelectColumn($alias . '.description'); + $criteria->removeSelectColumn($alias . '.rehersalId'); + $criteria->removeSelectColumn($alias . '.allowRoleSwaps'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(RoleTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(RoleTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new RoleTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(RoleTableMap::DATABASE_NAME)->getTable(RoleTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Role or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Role object or primary key or array of primary keys + * @param mixed $values Criteria or Role object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Role) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Role) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(RoleTableMap::DATABASE_NAME); - $criteria->add(RoleTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(RoleTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = RoleQuery::create()->mergeWith($criteria); + $query = RoleQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - RoleTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + RoleTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { RoleTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the roles table. @@ -406,7 +488,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return RoleQuery::create()->doDeleteAll($con); } @@ -414,13 +496,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Role or Criteria object. * - * @param mixed $criteria Criteria or Role object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Role object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME); @@ -432,7 +514,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Role object } - if ($criteria->containsKey(RoleTableMap::COL_ID) && $criteria->keyContainsValue(RoleTableMap::COL_ID)) { + if ($criteria->containsKey(RoleTableMap::COL_ID) && $criteria->keyContainsValue(RoleTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.RoleTableMap::COL_ID.')'); } @@ -446,7 +528,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // RoleTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -RoleTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/SettingsTableMap.php b/generated-classes/TechWilk/Rota/Map/SettingsTableMap.php index b7f5d6d9..8a65ab5b 100644 --- a/generated-classes/TechWilk/Rota/Map/SettingsTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/SettingsTableMap.php @@ -15,6 +15,7 @@ use TechWilk\Rota\Settings; use TechWilk\Rota\SettingsQuery; + /** * This class defines the structure of the 'settings' table. * @@ -24,7 +25,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class SettingsTableMap extends TableMap { @@ -34,224 +34,457 @@ class SettingsTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.SettingsTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.SettingsTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'settings'; + public const TABLE_NAME = 'settings'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Settings'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Settings'; + public const OM_CLASS = '\\TechWilk\\Rota\\Settings'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Settings'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Settings'; /** * The total number of columns */ - const NUM_COLUMNS = 28; + public const NUM_COLUMNS = 28; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 28; + public const NUM_HYDRATE_COLUMNS = 28; /** * the column name for the siteurl field */ - const COL_SITEURL = 'settings.siteurl'; + public const COL_SITEURL = 'settings.siteurl'; /** * the column name for the owner field */ - const COL_OWNER = 'settings.owner'; + public const COL_OWNER = 'settings.owner'; /** * the column name for the notificationemail field */ - const COL_NOTIFICATIONEMAIL = 'settings.notificationemail'; + public const COL_NOTIFICATIONEMAIL = 'settings.notificationemail'; /** * the column name for the adminemailaddress field */ - const COL_ADMINEMAILADDRESS = 'settings.adminemailaddress'; + public const COL_ADMINEMAILADDRESS = 'settings.adminemailaddress'; /** * the column name for the norehearsalemail field */ - const COL_NOREHEARSALEMAIL = 'settings.norehearsalemail'; + public const COL_NOREHEARSALEMAIL = 'settings.norehearsalemail'; /** * the column name for the yesrehearsal field */ - const COL_YESREHEARSAL = 'settings.yesrehearsal'; + public const COL_YESREHEARSAL = 'settings.yesrehearsal'; /** * the column name for the newusermessage field */ - const COL_NEWUSERMESSAGE = 'settings.newusermessage'; + public const COL_NEWUSERMESSAGE = 'settings.newusermessage'; /** * the column name for the version field */ - const COL_VERSION = 'settings.version'; + public const COL_VERSION = 'settings.version'; /** * the column name for the lang_locale field */ - const COL_LANG_LOCALE = 'settings.lang_locale'; + public const COL_LANG_LOCALE = 'settings.lang_locale'; /** * the column name for the event_sorting_latest field */ - const COL_EVENT_SORTING_LATEST = 'settings.event_sorting_latest'; + public const COL_EVENT_SORTING_LATEST = 'settings.event_sorting_latest'; /** * the column name for the snapshot_show_two_month field */ - const COL_SNAPSHOT_SHOW_TWO_MONTH = 'settings.snapshot_show_two_month'; + public const COL_SNAPSHOT_SHOW_TWO_MONTH = 'settings.snapshot_show_two_month'; /** * the column name for the snapshot_reduce_skills_by_group field */ - const COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP = 'settings.snapshot_reduce_skills_by_group'; + public const COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP = 'settings.snapshot_reduce_skills_by_group'; /** * the column name for the logged_in_show_snapshot_button field */ - const COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON = 'settings.logged_in_show_snapshot_button'; + public const COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON = 'settings.logged_in_show_snapshot_button'; /** * the column name for the time_format_long field */ - const COL_TIME_FORMAT_LONG = 'settings.time_format_long'; + public const COL_TIME_FORMAT_LONG = 'settings.time_format_long'; /** * the column name for the time_format_normal field */ - const COL_TIME_FORMAT_NORMAL = 'settings.time_format_normal'; + public const COL_TIME_FORMAT_NORMAL = 'settings.time_format_normal'; /** * the column name for the time_format_short field */ - const COL_TIME_FORMAT_SHORT = 'settings.time_format_short'; + public const COL_TIME_FORMAT_SHORT = 'settings.time_format_short'; /** * the column name for the time_only_format field */ - const COL_TIME_ONLY_FORMAT = 'settings.time_only_format'; + public const COL_TIME_ONLY_FORMAT = 'settings.time_only_format'; /** * the column name for the date_only_format field */ - const COL_DATE_ONLY_FORMAT = 'settings.date_only_format'; + public const COL_DATE_ONLY_FORMAT = 'settings.date_only_format'; /** * the column name for the day_only_format field */ - const COL_DAY_ONLY_FORMAT = 'settings.day_only_format'; + public const COL_DAY_ONLY_FORMAT = 'settings.day_only_format'; /** * the column name for the users_start_with_myevents field */ - const COL_USERS_START_WITH_MYEVENTS = 'settings.users_start_with_myevents'; + public const COL_USERS_START_WITH_MYEVENTS = 'settings.users_start_with_myevents'; /** * the column name for the time_zone field */ - const COL_TIME_ZONE = 'settings.time_zone'; + public const COL_TIME_ZONE = 'settings.time_zone'; /** * the column name for the google_group_calendar field */ - const COL_GOOGLE_GROUP_CALENDAR = 'settings.google_group_calendar'; + public const COL_GOOGLE_GROUP_CALENDAR = 'settings.google_group_calendar'; /** * the column name for the overviewemail field */ - const COL_OVERVIEWEMAIL = 'settings.overviewemail'; + public const COL_OVERVIEWEMAIL = 'settings.overviewemail'; /** * the column name for the group_sorting_name field */ - const COL_GROUP_SORTING_NAME = 'settings.group_sorting_name'; + public const COL_GROUP_SORTING_NAME = 'settings.group_sorting_name'; /** * the column name for the debug_mode field */ - const COL_DEBUG_MODE = 'settings.debug_mode'; + public const COL_DEBUG_MODE = 'settings.debug_mode'; /** * the column name for the days_to_alert field */ - const COL_DAYS_TO_ALERT = 'settings.days_to_alert'; + public const COL_DAYS_TO_ALERT = 'settings.days_to_alert'; /** * the column name for the token field */ - const COL_TOKEN = 'settings.token'; + public const COL_TOKEN = 'settings.token'; /** * the column name for the skin field */ - const COL_SKIN = 'settings.skin'; + public const COL_SKIN = 'settings.skin'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('SiteUrl', 'Owner', 'NotificationEmail', 'AdminEmailAddress', 'NoRehearsalEmail', 'YesRehearsal', 'NewUserMessage', 'Version', 'LangLocale', 'EventSortingLatest', 'SnapshotShowTwoMonth', 'SnapshotReduceSkillsByGroup', 'LoggedInShowSnapshotButton', 'TimeFormatLong', 'TimeFormatNormal', 'TimeFormatShort', 'TimeOnlyFormat', 'DateOnlyFormat', 'DayOnlyFormat', 'UsersStartWithMyEvents', 'TimeZone', 'GoogleGroupCalendar', 'OverviewEmail', 'GroupSortingName', 'DebugMode', 'DaysToAlert', 'Token', 'Skin', ), - self::TYPE_CAMELNAME => array('siteUrl', 'owner', 'notificationEmail', 'adminEmailAddress', 'noRehearsalEmail', 'yesRehearsal', 'newUserMessage', 'version', 'langLocale', 'eventSortingLatest', 'snapshotShowTwoMonth', 'snapshotReduceSkillsByGroup', 'loggedInShowSnapshotButton', 'timeFormatLong', 'timeFormatNormal', 'timeFormatShort', 'timeOnlyFormat', 'dateOnlyFormat', 'dayOnlyFormat', 'usersStartWithMyEvents', 'timeZone', 'googleGroupCalendar', 'overviewEmail', 'groupSortingName', 'debugMode', 'daysToAlert', 'token', 'skin', ), - self::TYPE_COLNAME => array(SettingsTableMap::COL_SITEURL, SettingsTableMap::COL_OWNER, SettingsTableMap::COL_NOTIFICATIONEMAIL, SettingsTableMap::COL_ADMINEMAILADDRESS, SettingsTableMap::COL_NOREHEARSALEMAIL, SettingsTableMap::COL_YESREHEARSAL, SettingsTableMap::COL_NEWUSERMESSAGE, SettingsTableMap::COL_VERSION, SettingsTableMap::COL_LANG_LOCALE, SettingsTableMap::COL_EVENT_SORTING_LATEST, SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH, SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP, SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON, SettingsTableMap::COL_TIME_FORMAT_LONG, SettingsTableMap::COL_TIME_FORMAT_NORMAL, SettingsTableMap::COL_TIME_FORMAT_SHORT, SettingsTableMap::COL_TIME_ONLY_FORMAT, SettingsTableMap::COL_DATE_ONLY_FORMAT, SettingsTableMap::COL_DAY_ONLY_FORMAT, SettingsTableMap::COL_USERS_START_WITH_MYEVENTS, SettingsTableMap::COL_TIME_ZONE, SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR, SettingsTableMap::COL_OVERVIEWEMAIL, SettingsTableMap::COL_GROUP_SORTING_NAME, SettingsTableMap::COL_DEBUG_MODE, SettingsTableMap::COL_DAYS_TO_ALERT, SettingsTableMap::COL_TOKEN, SettingsTableMap::COL_SKIN, ), - self::TYPE_FIELDNAME => array('siteurl', 'owner', 'notificationemail', 'adminemailaddress', 'norehearsalemail', 'yesrehearsal', 'newusermessage', 'version', 'lang_locale', 'event_sorting_latest', 'snapshot_show_two_month', 'snapshot_reduce_skills_by_group', 'logged_in_show_snapshot_button', 'time_format_long', 'time_format_normal', 'time_format_short', 'time_only_format', 'date_only_format', 'day_only_format', 'users_start_with_myevents', 'time_zone', 'google_group_calendar', 'overviewemail', 'group_sorting_name', 'debug_mode', 'days_to_alert', 'token', 'skin', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['SiteUrl', 'Owner', 'NotificationEmail', 'AdminEmailAddress', 'NoRehearsalEmail', 'YesRehearsal', 'NewUserMessage', 'Version', 'LangLocale', 'EventSortingLatest', 'SnapshotShowTwoMonth', 'SnapshotReduceSkillsByGroup', 'LoggedInShowSnapshotButton', 'TimeFormatLong', 'TimeFormatNormal', 'TimeFormatShort', 'TimeOnlyFormat', 'DateOnlyFormat', 'DayOnlyFormat', 'UsersStartWithMyEvents', 'TimeZone', 'GoogleGroupCalendar', 'OverviewEmail', 'GroupSortingName', 'DebugMode', 'DaysToAlert', 'Token', 'Skin', ], + self::TYPE_CAMELNAME => ['siteUrl', 'owner', 'notificationEmail', 'adminEmailAddress', 'noRehearsalEmail', 'yesRehearsal', 'newUserMessage', 'version', 'langLocale', 'eventSortingLatest', 'snapshotShowTwoMonth', 'snapshotReduceSkillsByGroup', 'loggedInShowSnapshotButton', 'timeFormatLong', 'timeFormatNormal', 'timeFormatShort', 'timeOnlyFormat', 'dateOnlyFormat', 'dayOnlyFormat', 'usersStartWithMyEvents', 'timeZone', 'googleGroupCalendar', 'overviewEmail', 'groupSortingName', 'debugMode', 'daysToAlert', 'token', 'skin', ], + self::TYPE_COLNAME => [SettingsTableMap::COL_SITEURL, SettingsTableMap::COL_OWNER, SettingsTableMap::COL_NOTIFICATIONEMAIL, SettingsTableMap::COL_ADMINEMAILADDRESS, SettingsTableMap::COL_NOREHEARSALEMAIL, SettingsTableMap::COL_YESREHEARSAL, SettingsTableMap::COL_NEWUSERMESSAGE, SettingsTableMap::COL_VERSION, SettingsTableMap::COL_LANG_LOCALE, SettingsTableMap::COL_EVENT_SORTING_LATEST, SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH, SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP, SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON, SettingsTableMap::COL_TIME_FORMAT_LONG, SettingsTableMap::COL_TIME_FORMAT_NORMAL, SettingsTableMap::COL_TIME_FORMAT_SHORT, SettingsTableMap::COL_TIME_ONLY_FORMAT, SettingsTableMap::COL_DATE_ONLY_FORMAT, SettingsTableMap::COL_DAY_ONLY_FORMAT, SettingsTableMap::COL_USERS_START_WITH_MYEVENTS, SettingsTableMap::COL_TIME_ZONE, SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR, SettingsTableMap::COL_OVERVIEWEMAIL, SettingsTableMap::COL_GROUP_SORTING_NAME, SettingsTableMap::COL_DEBUG_MODE, SettingsTableMap::COL_DAYS_TO_ALERT, SettingsTableMap::COL_TOKEN, SettingsTableMap::COL_SKIN, ], + self::TYPE_FIELDNAME => ['siteurl', 'owner', 'notificationemail', 'adminemailaddress', 'norehearsalemail', 'yesrehearsal', 'newusermessage', 'version', 'lang_locale', 'event_sorting_latest', 'snapshot_show_two_month', 'snapshot_reduce_skills_by_group', 'logged_in_show_snapshot_button', 'time_format_long', 'time_format_normal', 'time_format_short', 'time_only_format', 'date_only_format', 'day_only_format', 'users_start_with_myevents', 'time_zone', 'google_group_calendar', 'overviewemail', 'group_sorting_name', 'debug_mode', 'days_to_alert', 'token', 'skin', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('SiteUrl' => 0, 'Owner' => 1, 'NotificationEmail' => 2, 'AdminEmailAddress' => 3, 'NoRehearsalEmail' => 4, 'YesRehearsal' => 5, 'NewUserMessage' => 6, 'Version' => 7, 'LangLocale' => 8, 'EventSortingLatest' => 9, 'SnapshotShowTwoMonth' => 10, 'SnapshotReduceSkillsByGroup' => 11, 'LoggedInShowSnapshotButton' => 12, 'TimeFormatLong' => 13, 'TimeFormatNormal' => 14, 'TimeFormatShort' => 15, 'TimeOnlyFormat' => 16, 'DateOnlyFormat' => 17, 'DayOnlyFormat' => 18, 'UsersStartWithMyEvents' => 19, 'TimeZone' => 20, 'GoogleGroupCalendar' => 21, 'OverviewEmail' => 22, 'GroupSortingName' => 23, 'DebugMode' => 24, 'DaysToAlert' => 25, 'Token' => 26, 'Skin' => 27, ), - self::TYPE_CAMELNAME => array('siteUrl' => 0, 'owner' => 1, 'notificationEmail' => 2, 'adminEmailAddress' => 3, 'noRehearsalEmail' => 4, 'yesRehearsal' => 5, 'newUserMessage' => 6, 'version' => 7, 'langLocale' => 8, 'eventSortingLatest' => 9, 'snapshotShowTwoMonth' => 10, 'snapshotReduceSkillsByGroup' => 11, 'loggedInShowSnapshotButton' => 12, 'timeFormatLong' => 13, 'timeFormatNormal' => 14, 'timeFormatShort' => 15, 'timeOnlyFormat' => 16, 'dateOnlyFormat' => 17, 'dayOnlyFormat' => 18, 'usersStartWithMyEvents' => 19, 'timeZone' => 20, 'googleGroupCalendar' => 21, 'overviewEmail' => 22, 'groupSortingName' => 23, 'debugMode' => 24, 'daysToAlert' => 25, 'token' => 26, 'skin' => 27, ), - self::TYPE_COLNAME => array(SettingsTableMap::COL_SITEURL => 0, SettingsTableMap::COL_OWNER => 1, SettingsTableMap::COL_NOTIFICATIONEMAIL => 2, SettingsTableMap::COL_ADMINEMAILADDRESS => 3, SettingsTableMap::COL_NOREHEARSALEMAIL => 4, SettingsTableMap::COL_YESREHEARSAL => 5, SettingsTableMap::COL_NEWUSERMESSAGE => 6, SettingsTableMap::COL_VERSION => 7, SettingsTableMap::COL_LANG_LOCALE => 8, SettingsTableMap::COL_EVENT_SORTING_LATEST => 9, SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH => 10, SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP => 11, SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON => 12, SettingsTableMap::COL_TIME_FORMAT_LONG => 13, SettingsTableMap::COL_TIME_FORMAT_NORMAL => 14, SettingsTableMap::COL_TIME_FORMAT_SHORT => 15, SettingsTableMap::COL_TIME_ONLY_FORMAT => 16, SettingsTableMap::COL_DATE_ONLY_FORMAT => 17, SettingsTableMap::COL_DAY_ONLY_FORMAT => 18, SettingsTableMap::COL_USERS_START_WITH_MYEVENTS => 19, SettingsTableMap::COL_TIME_ZONE => 20, SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR => 21, SettingsTableMap::COL_OVERVIEWEMAIL => 22, SettingsTableMap::COL_GROUP_SORTING_NAME => 23, SettingsTableMap::COL_DEBUG_MODE => 24, SettingsTableMap::COL_DAYS_TO_ALERT => 25, SettingsTableMap::COL_TOKEN => 26, SettingsTableMap::COL_SKIN => 27, ), - self::TYPE_FIELDNAME => array('siteurl' => 0, 'owner' => 1, 'notificationemail' => 2, 'adminemailaddress' => 3, 'norehearsalemail' => 4, 'yesrehearsal' => 5, 'newusermessage' => 6, 'version' => 7, 'lang_locale' => 8, 'event_sorting_latest' => 9, 'snapshot_show_two_month' => 10, 'snapshot_reduce_skills_by_group' => 11, 'logged_in_show_snapshot_button' => 12, 'time_format_long' => 13, 'time_format_normal' => 14, 'time_format_short' => 15, 'time_only_format' => 16, 'date_only_format' => 17, 'day_only_format' => 18, 'users_start_with_myevents' => 19, 'time_zone' => 20, 'google_group_calendar' => 21, 'overviewemail' => 22, 'group_sorting_name' => 23, 'debug_mode' => 24, 'days_to_alert' => 25, 'token' => 26, 'skin' => 27, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['SiteUrl' => 0, 'Owner' => 1, 'NotificationEmail' => 2, 'AdminEmailAddress' => 3, 'NoRehearsalEmail' => 4, 'YesRehearsal' => 5, 'NewUserMessage' => 6, 'Version' => 7, 'LangLocale' => 8, 'EventSortingLatest' => 9, 'SnapshotShowTwoMonth' => 10, 'SnapshotReduceSkillsByGroup' => 11, 'LoggedInShowSnapshotButton' => 12, 'TimeFormatLong' => 13, 'TimeFormatNormal' => 14, 'TimeFormatShort' => 15, 'TimeOnlyFormat' => 16, 'DateOnlyFormat' => 17, 'DayOnlyFormat' => 18, 'UsersStartWithMyEvents' => 19, 'TimeZone' => 20, 'GoogleGroupCalendar' => 21, 'OverviewEmail' => 22, 'GroupSortingName' => 23, 'DebugMode' => 24, 'DaysToAlert' => 25, 'Token' => 26, 'Skin' => 27, ], + self::TYPE_CAMELNAME => ['siteUrl' => 0, 'owner' => 1, 'notificationEmail' => 2, 'adminEmailAddress' => 3, 'noRehearsalEmail' => 4, 'yesRehearsal' => 5, 'newUserMessage' => 6, 'version' => 7, 'langLocale' => 8, 'eventSortingLatest' => 9, 'snapshotShowTwoMonth' => 10, 'snapshotReduceSkillsByGroup' => 11, 'loggedInShowSnapshotButton' => 12, 'timeFormatLong' => 13, 'timeFormatNormal' => 14, 'timeFormatShort' => 15, 'timeOnlyFormat' => 16, 'dateOnlyFormat' => 17, 'dayOnlyFormat' => 18, 'usersStartWithMyEvents' => 19, 'timeZone' => 20, 'googleGroupCalendar' => 21, 'overviewEmail' => 22, 'groupSortingName' => 23, 'debugMode' => 24, 'daysToAlert' => 25, 'token' => 26, 'skin' => 27, ], + self::TYPE_COLNAME => [SettingsTableMap::COL_SITEURL => 0, SettingsTableMap::COL_OWNER => 1, SettingsTableMap::COL_NOTIFICATIONEMAIL => 2, SettingsTableMap::COL_ADMINEMAILADDRESS => 3, SettingsTableMap::COL_NOREHEARSALEMAIL => 4, SettingsTableMap::COL_YESREHEARSAL => 5, SettingsTableMap::COL_NEWUSERMESSAGE => 6, SettingsTableMap::COL_VERSION => 7, SettingsTableMap::COL_LANG_LOCALE => 8, SettingsTableMap::COL_EVENT_SORTING_LATEST => 9, SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH => 10, SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP => 11, SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON => 12, SettingsTableMap::COL_TIME_FORMAT_LONG => 13, SettingsTableMap::COL_TIME_FORMAT_NORMAL => 14, SettingsTableMap::COL_TIME_FORMAT_SHORT => 15, SettingsTableMap::COL_TIME_ONLY_FORMAT => 16, SettingsTableMap::COL_DATE_ONLY_FORMAT => 17, SettingsTableMap::COL_DAY_ONLY_FORMAT => 18, SettingsTableMap::COL_USERS_START_WITH_MYEVENTS => 19, SettingsTableMap::COL_TIME_ZONE => 20, SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR => 21, SettingsTableMap::COL_OVERVIEWEMAIL => 22, SettingsTableMap::COL_GROUP_SORTING_NAME => 23, SettingsTableMap::COL_DEBUG_MODE => 24, SettingsTableMap::COL_DAYS_TO_ALERT => 25, SettingsTableMap::COL_TOKEN => 26, SettingsTableMap::COL_SKIN => 27, ], + self::TYPE_FIELDNAME => ['siteurl' => 0, 'owner' => 1, 'notificationemail' => 2, 'adminemailaddress' => 3, 'norehearsalemail' => 4, 'yesrehearsal' => 5, 'newusermessage' => 6, 'version' => 7, 'lang_locale' => 8, 'event_sorting_latest' => 9, 'snapshot_show_two_month' => 10, 'snapshot_reduce_skills_by_group' => 11, 'logged_in_show_snapshot_button' => 12, 'time_format_long' => 13, 'time_format_normal' => 14, 'time_format_short' => 15, 'time_only_format' => 16, 'date_only_format' => 17, 'day_only_format' => 18, 'users_start_with_myevents' => 19, 'time_zone' => 20, 'google_group_calendar' => 21, 'overviewemail' => 22, 'group_sorting_name' => 23, 'debug_mode' => 24, 'days_to_alert' => 25, 'token' => 26, 'skin' => 27, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'SiteUrl' => 'SITEURL', + 'Settings.SiteUrl' => 'SITEURL', + 'siteUrl' => 'SITEURL', + 'settings.siteUrl' => 'SITEURL', + 'SettingsTableMap::COL_SITEURL' => 'SITEURL', + 'COL_SITEURL' => 'SITEURL', + 'siteurl' => 'SITEURL', + 'settings.siteurl' => 'SITEURL', + 'Owner' => 'OWNER', + 'Settings.Owner' => 'OWNER', + 'owner' => 'OWNER', + 'settings.owner' => 'OWNER', + 'SettingsTableMap::COL_OWNER' => 'OWNER', + 'COL_OWNER' => 'OWNER', + 'NotificationEmail' => 'NOTIFICATIONEMAIL', + 'Settings.NotificationEmail' => 'NOTIFICATIONEMAIL', + 'notificationEmail' => 'NOTIFICATIONEMAIL', + 'settings.notificationEmail' => 'NOTIFICATIONEMAIL', + 'SettingsTableMap::COL_NOTIFICATIONEMAIL' => 'NOTIFICATIONEMAIL', + 'COL_NOTIFICATIONEMAIL' => 'NOTIFICATIONEMAIL', + 'notificationemail' => 'NOTIFICATIONEMAIL', + 'settings.notificationemail' => 'NOTIFICATIONEMAIL', + 'AdminEmailAddress' => 'ADMINEMAILADDRESS', + 'Settings.AdminEmailAddress' => 'ADMINEMAILADDRESS', + 'adminEmailAddress' => 'ADMINEMAILADDRESS', + 'settings.adminEmailAddress' => 'ADMINEMAILADDRESS', + 'SettingsTableMap::COL_ADMINEMAILADDRESS' => 'ADMINEMAILADDRESS', + 'COL_ADMINEMAILADDRESS' => 'ADMINEMAILADDRESS', + 'adminemailaddress' => 'ADMINEMAILADDRESS', + 'settings.adminemailaddress' => 'ADMINEMAILADDRESS', + 'NoRehearsalEmail' => 'NOREHEARSALEMAIL', + 'Settings.NoRehearsalEmail' => 'NOREHEARSALEMAIL', + 'noRehearsalEmail' => 'NOREHEARSALEMAIL', + 'settings.noRehearsalEmail' => 'NOREHEARSALEMAIL', + 'SettingsTableMap::COL_NOREHEARSALEMAIL' => 'NOREHEARSALEMAIL', + 'COL_NOREHEARSALEMAIL' => 'NOREHEARSALEMAIL', + 'norehearsalemail' => 'NOREHEARSALEMAIL', + 'settings.norehearsalemail' => 'NOREHEARSALEMAIL', + 'YesRehearsal' => 'YESREHEARSAL', + 'Settings.YesRehearsal' => 'YESREHEARSAL', + 'yesRehearsal' => 'YESREHEARSAL', + 'settings.yesRehearsal' => 'YESREHEARSAL', + 'SettingsTableMap::COL_YESREHEARSAL' => 'YESREHEARSAL', + 'COL_YESREHEARSAL' => 'YESREHEARSAL', + 'yesrehearsal' => 'YESREHEARSAL', + 'settings.yesrehearsal' => 'YESREHEARSAL', + 'NewUserMessage' => 'NEWUSERMESSAGE', + 'Settings.NewUserMessage' => 'NEWUSERMESSAGE', + 'newUserMessage' => 'NEWUSERMESSAGE', + 'settings.newUserMessage' => 'NEWUSERMESSAGE', + 'SettingsTableMap::COL_NEWUSERMESSAGE' => 'NEWUSERMESSAGE', + 'COL_NEWUSERMESSAGE' => 'NEWUSERMESSAGE', + 'newusermessage' => 'NEWUSERMESSAGE', + 'settings.newusermessage' => 'NEWUSERMESSAGE', + 'Version' => 'VERSION', + 'Settings.Version' => 'VERSION', + 'version' => 'VERSION', + 'settings.version' => 'VERSION', + 'SettingsTableMap::COL_VERSION' => 'VERSION', + 'COL_VERSION' => 'VERSION', + 'LangLocale' => 'LANG_LOCALE', + 'Settings.LangLocale' => 'LANG_LOCALE', + 'langLocale' => 'LANG_LOCALE', + 'settings.langLocale' => 'LANG_LOCALE', + 'SettingsTableMap::COL_LANG_LOCALE' => 'LANG_LOCALE', + 'COL_LANG_LOCALE' => 'LANG_LOCALE', + 'lang_locale' => 'LANG_LOCALE', + 'settings.lang_locale' => 'LANG_LOCALE', + 'EventSortingLatest' => 'EVENT_SORTING_LATEST', + 'Settings.EventSortingLatest' => 'EVENT_SORTING_LATEST', + 'eventSortingLatest' => 'EVENT_SORTING_LATEST', + 'settings.eventSortingLatest' => 'EVENT_SORTING_LATEST', + 'SettingsTableMap::COL_EVENT_SORTING_LATEST' => 'EVENT_SORTING_LATEST', + 'COL_EVENT_SORTING_LATEST' => 'EVENT_SORTING_LATEST', + 'event_sorting_latest' => 'EVENT_SORTING_LATEST', + 'settings.event_sorting_latest' => 'EVENT_SORTING_LATEST', + 'SnapshotShowTwoMonth' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'Settings.SnapshotShowTwoMonth' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'snapshotShowTwoMonth' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'settings.snapshotShowTwoMonth' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'COL_SNAPSHOT_SHOW_TWO_MONTH' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'snapshot_show_two_month' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'settings.snapshot_show_two_month' => 'SNAPSHOT_SHOW_TWO_MONTH', + 'SnapshotReduceSkillsByGroup' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'Settings.SnapshotReduceSkillsByGroup' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'snapshotReduceSkillsByGroup' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'settings.snapshotReduceSkillsByGroup' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'snapshot_reduce_skills_by_group' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'settings.snapshot_reduce_skills_by_group' => 'SNAPSHOT_REDUCE_SKILLS_BY_GROUP', + 'LoggedInShowSnapshotButton' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'Settings.LoggedInShowSnapshotButton' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'loggedInShowSnapshotButton' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'settings.loggedInShowSnapshotButton' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'logged_in_show_snapshot_button' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'settings.logged_in_show_snapshot_button' => 'LOGGED_IN_SHOW_SNAPSHOT_BUTTON', + 'TimeFormatLong' => 'TIME_FORMAT_LONG', + 'Settings.TimeFormatLong' => 'TIME_FORMAT_LONG', + 'timeFormatLong' => 'TIME_FORMAT_LONG', + 'settings.timeFormatLong' => 'TIME_FORMAT_LONG', + 'SettingsTableMap::COL_TIME_FORMAT_LONG' => 'TIME_FORMAT_LONG', + 'COL_TIME_FORMAT_LONG' => 'TIME_FORMAT_LONG', + 'time_format_long' => 'TIME_FORMAT_LONG', + 'settings.time_format_long' => 'TIME_FORMAT_LONG', + 'TimeFormatNormal' => 'TIME_FORMAT_NORMAL', + 'Settings.TimeFormatNormal' => 'TIME_FORMAT_NORMAL', + 'timeFormatNormal' => 'TIME_FORMAT_NORMAL', + 'settings.timeFormatNormal' => 'TIME_FORMAT_NORMAL', + 'SettingsTableMap::COL_TIME_FORMAT_NORMAL' => 'TIME_FORMAT_NORMAL', + 'COL_TIME_FORMAT_NORMAL' => 'TIME_FORMAT_NORMAL', + 'time_format_normal' => 'TIME_FORMAT_NORMAL', + 'settings.time_format_normal' => 'TIME_FORMAT_NORMAL', + 'TimeFormatShort' => 'TIME_FORMAT_SHORT', + 'Settings.TimeFormatShort' => 'TIME_FORMAT_SHORT', + 'timeFormatShort' => 'TIME_FORMAT_SHORT', + 'settings.timeFormatShort' => 'TIME_FORMAT_SHORT', + 'SettingsTableMap::COL_TIME_FORMAT_SHORT' => 'TIME_FORMAT_SHORT', + 'COL_TIME_FORMAT_SHORT' => 'TIME_FORMAT_SHORT', + 'time_format_short' => 'TIME_FORMAT_SHORT', + 'settings.time_format_short' => 'TIME_FORMAT_SHORT', + 'TimeOnlyFormat' => 'TIME_ONLY_FORMAT', + 'Settings.TimeOnlyFormat' => 'TIME_ONLY_FORMAT', + 'timeOnlyFormat' => 'TIME_ONLY_FORMAT', + 'settings.timeOnlyFormat' => 'TIME_ONLY_FORMAT', + 'SettingsTableMap::COL_TIME_ONLY_FORMAT' => 'TIME_ONLY_FORMAT', + 'COL_TIME_ONLY_FORMAT' => 'TIME_ONLY_FORMAT', + 'time_only_format' => 'TIME_ONLY_FORMAT', + 'settings.time_only_format' => 'TIME_ONLY_FORMAT', + 'DateOnlyFormat' => 'DATE_ONLY_FORMAT', + 'Settings.DateOnlyFormat' => 'DATE_ONLY_FORMAT', + 'dateOnlyFormat' => 'DATE_ONLY_FORMAT', + 'settings.dateOnlyFormat' => 'DATE_ONLY_FORMAT', + 'SettingsTableMap::COL_DATE_ONLY_FORMAT' => 'DATE_ONLY_FORMAT', + 'COL_DATE_ONLY_FORMAT' => 'DATE_ONLY_FORMAT', + 'date_only_format' => 'DATE_ONLY_FORMAT', + 'settings.date_only_format' => 'DATE_ONLY_FORMAT', + 'DayOnlyFormat' => 'DAY_ONLY_FORMAT', + 'Settings.DayOnlyFormat' => 'DAY_ONLY_FORMAT', + 'dayOnlyFormat' => 'DAY_ONLY_FORMAT', + 'settings.dayOnlyFormat' => 'DAY_ONLY_FORMAT', + 'SettingsTableMap::COL_DAY_ONLY_FORMAT' => 'DAY_ONLY_FORMAT', + 'COL_DAY_ONLY_FORMAT' => 'DAY_ONLY_FORMAT', + 'day_only_format' => 'DAY_ONLY_FORMAT', + 'settings.day_only_format' => 'DAY_ONLY_FORMAT', + 'UsersStartWithMyEvents' => 'USERS_START_WITH_MYEVENTS', + 'Settings.UsersStartWithMyEvents' => 'USERS_START_WITH_MYEVENTS', + 'usersStartWithMyEvents' => 'USERS_START_WITH_MYEVENTS', + 'settings.usersStartWithMyEvents' => 'USERS_START_WITH_MYEVENTS', + 'SettingsTableMap::COL_USERS_START_WITH_MYEVENTS' => 'USERS_START_WITH_MYEVENTS', + 'COL_USERS_START_WITH_MYEVENTS' => 'USERS_START_WITH_MYEVENTS', + 'users_start_with_myevents' => 'USERS_START_WITH_MYEVENTS', + 'settings.users_start_with_myevents' => 'USERS_START_WITH_MYEVENTS', + 'TimeZone' => 'TIME_ZONE', + 'Settings.TimeZone' => 'TIME_ZONE', + 'timeZone' => 'TIME_ZONE', + 'settings.timeZone' => 'TIME_ZONE', + 'SettingsTableMap::COL_TIME_ZONE' => 'TIME_ZONE', + 'COL_TIME_ZONE' => 'TIME_ZONE', + 'time_zone' => 'TIME_ZONE', + 'settings.time_zone' => 'TIME_ZONE', + 'GoogleGroupCalendar' => 'GOOGLE_GROUP_CALENDAR', + 'Settings.GoogleGroupCalendar' => 'GOOGLE_GROUP_CALENDAR', + 'googleGroupCalendar' => 'GOOGLE_GROUP_CALENDAR', + 'settings.googleGroupCalendar' => 'GOOGLE_GROUP_CALENDAR', + 'SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR' => 'GOOGLE_GROUP_CALENDAR', + 'COL_GOOGLE_GROUP_CALENDAR' => 'GOOGLE_GROUP_CALENDAR', + 'google_group_calendar' => 'GOOGLE_GROUP_CALENDAR', + 'settings.google_group_calendar' => 'GOOGLE_GROUP_CALENDAR', + 'OverviewEmail' => 'OVERVIEWEMAIL', + 'Settings.OverviewEmail' => 'OVERVIEWEMAIL', + 'overviewEmail' => 'OVERVIEWEMAIL', + 'settings.overviewEmail' => 'OVERVIEWEMAIL', + 'SettingsTableMap::COL_OVERVIEWEMAIL' => 'OVERVIEWEMAIL', + 'COL_OVERVIEWEMAIL' => 'OVERVIEWEMAIL', + 'overviewemail' => 'OVERVIEWEMAIL', + 'settings.overviewemail' => 'OVERVIEWEMAIL', + 'GroupSortingName' => 'GROUP_SORTING_NAME', + 'Settings.GroupSortingName' => 'GROUP_SORTING_NAME', + 'groupSortingName' => 'GROUP_SORTING_NAME', + 'settings.groupSortingName' => 'GROUP_SORTING_NAME', + 'SettingsTableMap::COL_GROUP_SORTING_NAME' => 'GROUP_SORTING_NAME', + 'COL_GROUP_SORTING_NAME' => 'GROUP_SORTING_NAME', + 'group_sorting_name' => 'GROUP_SORTING_NAME', + 'settings.group_sorting_name' => 'GROUP_SORTING_NAME', + 'DebugMode' => 'DEBUG_MODE', + 'Settings.DebugMode' => 'DEBUG_MODE', + 'debugMode' => 'DEBUG_MODE', + 'settings.debugMode' => 'DEBUG_MODE', + 'SettingsTableMap::COL_DEBUG_MODE' => 'DEBUG_MODE', + 'COL_DEBUG_MODE' => 'DEBUG_MODE', + 'debug_mode' => 'DEBUG_MODE', + 'settings.debug_mode' => 'DEBUG_MODE', + 'DaysToAlert' => 'DAYS_TO_ALERT', + 'Settings.DaysToAlert' => 'DAYS_TO_ALERT', + 'daysToAlert' => 'DAYS_TO_ALERT', + 'settings.daysToAlert' => 'DAYS_TO_ALERT', + 'SettingsTableMap::COL_DAYS_TO_ALERT' => 'DAYS_TO_ALERT', + 'COL_DAYS_TO_ALERT' => 'DAYS_TO_ALERT', + 'days_to_alert' => 'DAYS_TO_ALERT', + 'settings.days_to_alert' => 'DAYS_TO_ALERT', + 'Token' => 'TOKEN', + 'Settings.Token' => 'TOKEN', + 'token' => 'TOKEN', + 'settings.token' => 'TOKEN', + 'SettingsTableMap::COL_TOKEN' => 'TOKEN', + 'COL_TOKEN' => 'TOKEN', + 'Skin' => 'SKIN', + 'Settings.Skin' => 'SKIN', + 'skin' => 'SKIN', + 'settings.skin' => 'SKIN', + 'SettingsTableMap::COL_SKIN' => 'SKIN', + 'COL_SKIN' => 'SKIN', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('settings'); @@ -289,14 +522,16 @@ public function initialize() $this->addColumn('days_to_alert', 'DaysToAlert', 'INTEGER', false, 2, 5); $this->addColumn('token', 'Token', 'VARCHAR', false, 100, ''); $this->addColumn('skin', 'Skin', 'VARCHAR', false, 20, ''); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -304,14 +539,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { return null; } @@ -321,14 +556,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return ''; } @@ -341,10 +576,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? SettingsTableMap::CLASS_DEFAULT : SettingsTableMap::OM_CLASS; } @@ -352,17 +587,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Settings object, last column rank) + * @return array (Settings object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = SettingsTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = SettingsTableMap::getInstanceFromPool($key))) { @@ -378,7 +613,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: SettingsTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -386,13 +621,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -422,12 +657,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(SettingsTableMap::COL_SITEURL); @@ -491,67 +727,131 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(SettingsTableMap::DATABASE_NAME)->getTable(SettingsTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(SettingsTableMap::COL_SITEURL); + $criteria->removeSelectColumn(SettingsTableMap::COL_OWNER); + $criteria->removeSelectColumn(SettingsTableMap::COL_NOTIFICATIONEMAIL); + $criteria->removeSelectColumn(SettingsTableMap::COL_ADMINEMAILADDRESS); + $criteria->removeSelectColumn(SettingsTableMap::COL_NOREHEARSALEMAIL); + $criteria->removeSelectColumn(SettingsTableMap::COL_YESREHEARSAL); + $criteria->removeSelectColumn(SettingsTableMap::COL_NEWUSERMESSAGE); + $criteria->removeSelectColumn(SettingsTableMap::COL_VERSION); + $criteria->removeSelectColumn(SettingsTableMap::COL_LANG_LOCALE); + $criteria->removeSelectColumn(SettingsTableMap::COL_EVENT_SORTING_LATEST); + $criteria->removeSelectColumn(SettingsTableMap::COL_SNAPSHOT_SHOW_TWO_MONTH); + $criteria->removeSelectColumn(SettingsTableMap::COL_SNAPSHOT_REDUCE_SKILLS_BY_GROUP); + $criteria->removeSelectColumn(SettingsTableMap::COL_LOGGED_IN_SHOW_SNAPSHOT_BUTTON); + $criteria->removeSelectColumn(SettingsTableMap::COL_TIME_FORMAT_LONG); + $criteria->removeSelectColumn(SettingsTableMap::COL_TIME_FORMAT_NORMAL); + $criteria->removeSelectColumn(SettingsTableMap::COL_TIME_FORMAT_SHORT); + $criteria->removeSelectColumn(SettingsTableMap::COL_TIME_ONLY_FORMAT); + $criteria->removeSelectColumn(SettingsTableMap::COL_DATE_ONLY_FORMAT); + $criteria->removeSelectColumn(SettingsTableMap::COL_DAY_ONLY_FORMAT); + $criteria->removeSelectColumn(SettingsTableMap::COL_USERS_START_WITH_MYEVENTS); + $criteria->removeSelectColumn(SettingsTableMap::COL_TIME_ZONE); + $criteria->removeSelectColumn(SettingsTableMap::COL_GOOGLE_GROUP_CALENDAR); + $criteria->removeSelectColumn(SettingsTableMap::COL_OVERVIEWEMAIL); + $criteria->removeSelectColumn(SettingsTableMap::COL_GROUP_SORTING_NAME); + $criteria->removeSelectColumn(SettingsTableMap::COL_DEBUG_MODE); + $criteria->removeSelectColumn(SettingsTableMap::COL_DAYS_TO_ALERT); + $criteria->removeSelectColumn(SettingsTableMap::COL_TOKEN); + $criteria->removeSelectColumn(SettingsTableMap::COL_SKIN); + } else { + $criteria->removeSelectColumn($alias . '.siteurl'); + $criteria->removeSelectColumn($alias . '.owner'); + $criteria->removeSelectColumn($alias . '.notificationemail'); + $criteria->removeSelectColumn($alias . '.adminemailaddress'); + $criteria->removeSelectColumn($alias . '.norehearsalemail'); + $criteria->removeSelectColumn($alias . '.yesrehearsal'); + $criteria->removeSelectColumn($alias . '.newusermessage'); + $criteria->removeSelectColumn($alias . '.version'); + $criteria->removeSelectColumn($alias . '.lang_locale'); + $criteria->removeSelectColumn($alias . '.event_sorting_latest'); + $criteria->removeSelectColumn($alias . '.snapshot_show_two_month'); + $criteria->removeSelectColumn($alias . '.snapshot_reduce_skills_by_group'); + $criteria->removeSelectColumn($alias . '.logged_in_show_snapshot_button'); + $criteria->removeSelectColumn($alias . '.time_format_long'); + $criteria->removeSelectColumn($alias . '.time_format_normal'); + $criteria->removeSelectColumn($alias . '.time_format_short'); + $criteria->removeSelectColumn($alias . '.time_only_format'); + $criteria->removeSelectColumn($alias . '.date_only_format'); + $criteria->removeSelectColumn($alias . '.day_only_format'); + $criteria->removeSelectColumn($alias . '.users_start_with_myevents'); + $criteria->removeSelectColumn($alias . '.time_zone'); + $criteria->removeSelectColumn($alias . '.google_group_calendar'); + $criteria->removeSelectColumn($alias . '.overviewemail'); + $criteria->removeSelectColumn($alias . '.group_sorting_name'); + $criteria->removeSelectColumn($alias . '.debug_mode'); + $criteria->removeSelectColumn($alias . '.days_to_alert'); + $criteria->removeSelectColumn($alias . '.token'); + $criteria->removeSelectColumn($alias . '.skin'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(SettingsTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(SettingsTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new SettingsTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(SettingsTableMap::DATABASE_NAME)->getTable(SettingsTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Settings or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Settings object or primary key or array of primary keys + * @param mixed $values Criteria or Settings object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(SettingsTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(SettingsTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Settings) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Settings) { // it's a model object // create criteria based on pk value $criteria = $values->buildCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks throw new LogicException('The Settings object has no primary key'); - } + } - $query = SettingsQuery::create()->mergeWith($criteria); + $query = SettingsQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - SettingsTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + SettingsTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { SettingsTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the settings table. @@ -559,7 +859,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return SettingsQuery::create()->doDeleteAll($con); } @@ -567,13 +867,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Settings or Criteria object. * - * @param mixed $criteria Criteria or Settings object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Settings object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SettingsTableMap::DATABASE_NAME); @@ -595,7 +895,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // SettingsTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -SettingsTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/SocialAuthTableMap.php b/generated-classes/TechWilk/Rota/Map/SocialAuthTableMap.php index e3bd8069..2b7ec02c 100644 --- a/generated-classes/TechWilk/Rota/Map/SocialAuthTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/SocialAuthTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\SocialAuth; use TechWilk\Rota\SocialAuthQuery; + /** * This class defines the structure of the 'socialAuth' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class SocialAuthTableMap extends TableMap { @@ -33,109 +33,156 @@ class SocialAuthTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.SocialAuthTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.SocialAuthTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'socialAuth'; + public const TABLE_NAME = 'socialAuth'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'SocialAuth'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\SocialAuth'; + public const OM_CLASS = '\\TechWilk\\Rota\\SocialAuth'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.SocialAuth'; + public const CLASS_DEFAULT = 'TechWilk.Rota.SocialAuth'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + public const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + public const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the userId field */ - const COL_USERID = 'socialAuth.userId'; + public const COL_USERID = 'socialAuth.userId'; /** * the column name for the platform field */ - const COL_PLATFORM = 'socialAuth.platform'; + public const COL_PLATFORM = 'socialAuth.platform'; /** * the column name for the socialId field */ - const COL_SOCIALID = 'socialAuth.socialId'; + public const COL_SOCIALID = 'socialAuth.socialId'; /** * the column name for the meta field */ - const COL_META = 'socialAuth.meta'; + public const COL_META = 'socialAuth.meta'; /** * the column name for the revoked field */ - const COL_REVOKED = 'socialAuth.revoked'; + public const COL_REVOKED = 'socialAuth.revoked'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('UserId', 'Platform', 'SocialId', 'Meta', 'Revoked', ), - self::TYPE_CAMELNAME => array('userId', 'platform', 'socialId', 'meta', 'revoked', ), - self::TYPE_COLNAME => array(SocialAuthTableMap::COL_USERID, SocialAuthTableMap::COL_PLATFORM, SocialAuthTableMap::COL_SOCIALID, SocialAuthTableMap::COL_META, SocialAuthTableMap::COL_REVOKED, ), - self::TYPE_FIELDNAME => array('userId', 'platform', 'socialId', 'meta', 'revoked', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['UserId', 'Platform', 'SocialId', 'Meta', 'Revoked', ], + self::TYPE_CAMELNAME => ['userId', 'platform', 'socialId', 'meta', 'revoked', ], + self::TYPE_COLNAME => [SocialAuthTableMap::COL_USERID, SocialAuthTableMap::COL_PLATFORM, SocialAuthTableMap::COL_SOCIALID, SocialAuthTableMap::COL_META, SocialAuthTableMap::COL_REVOKED, ], + self::TYPE_FIELDNAME => ['userId', 'platform', 'socialId', 'meta', 'revoked', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('UserId' => 0, 'Platform' => 1, 'SocialId' => 2, 'Meta' => 3, 'Revoked' => 4, ), - self::TYPE_CAMELNAME => array('userId' => 0, 'platform' => 1, 'socialId' => 2, 'meta' => 3, 'revoked' => 4, ), - self::TYPE_COLNAME => array(SocialAuthTableMap::COL_USERID => 0, SocialAuthTableMap::COL_PLATFORM => 1, SocialAuthTableMap::COL_SOCIALID => 2, SocialAuthTableMap::COL_META => 3, SocialAuthTableMap::COL_REVOKED => 4, ), - self::TYPE_FIELDNAME => array('userId' => 0, 'platform' => 1, 'socialId' => 2, 'meta' => 3, 'revoked' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['UserId' => 0, 'Platform' => 1, 'SocialId' => 2, 'Meta' => 3, 'Revoked' => 4, ], + self::TYPE_CAMELNAME => ['userId' => 0, 'platform' => 1, 'socialId' => 2, 'meta' => 3, 'revoked' => 4, ], + self::TYPE_COLNAME => [SocialAuthTableMap::COL_USERID => 0, SocialAuthTableMap::COL_PLATFORM => 1, SocialAuthTableMap::COL_SOCIALID => 2, SocialAuthTableMap::COL_META => 3, SocialAuthTableMap::COL_REVOKED => 4, ], + self::TYPE_FIELDNAME => ['userId' => 0, 'platform' => 1, 'socialId' => 2, 'meta' => 3, 'revoked' => 4, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'UserId' => 'USERID', + 'SocialAuth.UserId' => 'USERID', + 'userId' => 'USERID', + 'socialAuth.userId' => 'USERID', + 'SocialAuthTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'Platform' => 'PLATFORM', + 'SocialAuth.Platform' => 'PLATFORM', + 'platform' => 'PLATFORM', + 'socialAuth.platform' => 'PLATFORM', + 'SocialAuthTableMap::COL_PLATFORM' => 'PLATFORM', + 'COL_PLATFORM' => 'PLATFORM', + 'SocialId' => 'SOCIALID', + 'SocialAuth.SocialId' => 'SOCIALID', + 'socialId' => 'SOCIALID', + 'socialAuth.socialId' => 'SOCIALID', + 'SocialAuthTableMap::COL_SOCIALID' => 'SOCIALID', + 'COL_SOCIALID' => 'SOCIALID', + 'Meta' => 'META', + 'SocialAuth.Meta' => 'META', + 'meta' => 'META', + 'socialAuth.meta' => 'META', + 'SocialAuthTableMap::COL_META' => 'META', + 'COL_META' => 'META', + 'Revoked' => 'REVOKED', + 'SocialAuth.Revoked' => 'REVOKED', + 'revoked' => 'REVOKED', + 'socialAuth.revoked' => 'REVOKED', + 'SocialAuthTableMap::COL_REVOKED' => 'REVOKED', + 'COL_REVOKED' => 'REVOKED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('socialAuth'); @@ -145,26 +192,28 @@ public function initialize() $this->setPackage('TechWilk.Rota'); $this->setUseIdGenerator(false); // columns - $this->addForeignPrimaryKey('userId', 'UserId', 'INTEGER', 'users', 'id', true, 30, null); + $this->addForeignPrimaryKey('userId', 'UserId', 'INTEGER' , 'users', 'id', true, 30, null); $this->addPrimaryKey('platform', 'Platform', 'VARCHAR', true, 10, null); $this->addPrimaryKey('socialId', 'SocialId', 'BIGINT', true, 30, null); $this->addColumn('meta', 'Meta', 'LONGVARCHAR', false, null, null); $this->addColumn('revoked', 'Revoked', 'BOOLEAN', true, 1, false); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * Adds an object to the instance pool. @@ -175,9 +224,11 @@ public function buildRelations() * and findPk*() calls. * * @param \TechWilk\Rota\SocialAuth $obj A \TechWilk\Rota\SocialAuth object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + * @param string|null $key Key (optional) to use for instance map (for performance boost if key was already calculated externally). + * + * @return void */ - public static function addInstanceToPool($obj, $key = null) + public static function addInstanceToPool(SocialAuth $obj, ?string $key = null): void { if (Propel::isInstancePoolingEnabled()) { if (null === $key) { @@ -196,12 +247,15 @@ public static function addInstanceToPool($obj, $key = null) * from the cache in order to prevent returning objects that no longer exist. * * @param mixed $value A \TechWilk\Rota\SocialAuth object or a primary key value. + * + * @return void */ - public static function removeInstanceFromPool($value) + public static function removeInstanceFromPool($value): void { if (Propel::isInstancePoolingEnabled() && null !== $value) { if (is_object($value) && $value instanceof \TechWilk\Rota\SocialAuth) { $key = serialize([(null === $value->getUserId() || is_scalar($value->getUserId()) || is_callable([$value->getUserId(), '__toString']) ? (string) $value->getUserId() : $value->getUserId()), (null === $value->getPlatform() || is_scalar($value->getPlatform()) || is_callable([$value->getPlatform(), '__toString']) ? (string) $value->getPlatform() : $value->getPlatform()), (null === $value->getSocialId() || is_scalar($value->getSocialId()) || is_callable([$value->getSocialId(), '__toString']) ? (string) $value->getSocialId() : $value->getSocialId())]); + } elseif (is_array($value) && count($value) === 3) { // assume we've been passed a primary key"; $key = serialize([(null === $value[0] || is_scalar($value[0]) || is_callable([$value[0], '__toString']) ? (string) $value[0] : $value[0]), (null === $value[1] || is_scalar($value[1]) || is_callable([$value[1], '__toString']) ? (string) $value[1] : $value[1]), (null === $value[2] || is_scalar($value[2]) || is_callable([$value[2], '__toString']) ? (string) $value[2] : $value[2])]); @@ -224,14 +278,14 @@ public static function removeInstanceFromPool($value) * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('UserId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Platform', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('SocialId', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -246,16 +300,16 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { - $pks = []; + $pks = []; $pks[] = (int) $row[ $indexType == TableMap::TYPE_NUM @@ -284,10 +338,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? SocialAuthTableMap::CLASS_DEFAULT : SocialAuthTableMap::OM_CLASS; } @@ -295,17 +349,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (SocialAuth object, last column rank) + * @return array (SocialAuth object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = SocialAuthTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = SocialAuthTableMap::getInstanceFromPool($key))) { @@ -321,7 +375,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: SocialAuthTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -329,13 +383,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -365,12 +419,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(SocialAuthTableMap::COL_USERID); @@ -388,79 +443,97 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(SocialAuthTableMap::DATABASE_NAME)->getTable(SocialAuthTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(SocialAuthTableMap::COL_USERID); + $criteria->removeSelectColumn(SocialAuthTableMap::COL_PLATFORM); + $criteria->removeSelectColumn(SocialAuthTableMap::COL_SOCIALID); + $criteria->removeSelectColumn(SocialAuthTableMap::COL_META); + $criteria->removeSelectColumn(SocialAuthTableMap::COL_REVOKED); + } else { + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.platform'); + $criteria->removeSelectColumn($alias . '.socialId'); + $criteria->removeSelectColumn($alias . '.meta'); + $criteria->removeSelectColumn($alias . '.revoked'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(SocialAuthTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(SocialAuthTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new SocialAuthTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(SocialAuthTableMap::DATABASE_NAME)->getTable(SocialAuthTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a SocialAuth or Criteria object OR a primary key value. * - * @param mixed $values Criteria or SocialAuth object or primary key or array of primary keys + * @param mixed $values Criteria or SocialAuth object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(SocialAuthTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(SocialAuthTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\SocialAuth) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\SocialAuth) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(SocialAuthTableMap::DATABASE_NAME); // primary key is composite; we therefore, expect // the primary key passed to be an array of pkey values if (count($values) == count($values, COUNT_RECURSIVE)) { // array is not multi-dimensional - $values = array($values); + $values = [$values]; + } + foreach ($values as $value) { + $criterion = $criteria->getNewCriterion(SocialAuthTableMap::COL_USERID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(SocialAuthTableMap::COL_PLATFORM, $value[1])); + $criterion->addAnd($criteria->getNewCriterion(SocialAuthTableMap::COL_SOCIALID, $value[2])); + $criteria->addOr($criterion); } - foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(SocialAuthTableMap::COL_USERID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(SocialAuthTableMap::COL_PLATFORM, $value[1])); - $criterion->addAnd($criteria->getNewCriterion(SocialAuthTableMap::COL_SOCIALID, $value[2])); - $criteria->addOr($criterion); - } - } - - $query = SocialAuthQuery::create()->mergeWith($criteria); - - if ($values instanceof Criteria) { - SocialAuthTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + } + + $query = SocialAuthQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { + SocialAuthTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { SocialAuthTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the socialAuth table. @@ -468,7 +541,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return SocialAuthQuery::create()->doDeleteAll($con); } @@ -476,13 +549,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a SocialAuth or Criteria object. * - * @param mixed $criteria Criteria or SocialAuth object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or SocialAuth object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SocialAuthTableMap::DATABASE_NAME); @@ -504,7 +577,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // SocialAuthTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -SocialAuthTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/StatisticTableMap.php b/generated-classes/TechWilk/Rota/Map/StatisticTableMap.php index 2d1593fb..e66e1f62 100644 --- a/generated-classes/TechWilk/Rota/Map/StatisticTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/StatisticTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Statistic; use TechWilk\Rota\StatisticQuery; + /** * This class defines the structure of the 'statistics' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class StatisticTableMap extends TableMap { @@ -33,124 +33,198 @@ class StatisticTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.StatisticTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.StatisticTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'statistics'; + public const TABLE_NAME = 'statistics'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Statistic'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Statistic'; + public const OM_CLASS = '\\TechWilk\\Rota\\Statistic'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Statistic'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Statistic'; /** * The total number of columns */ - const NUM_COLUMNS = 8; + public const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 8; + public const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the id field */ - const COL_ID = 'statistics.id'; + public const COL_ID = 'statistics.id'; /** * the column name for the userid field */ - const COL_USERID = 'statistics.userid'; + public const COL_USERID = 'statistics.userid'; /** * the column name for the date field */ - const COL_DATE = 'statistics.date'; + public const COL_DATE = 'statistics.date'; /** * the column name for the type field */ - const COL_TYPE = 'statistics.type'; + public const COL_TYPE = 'statistics.type'; /** * the column name for the detail1 field */ - const COL_DETAIL1 = 'statistics.detail1'; + public const COL_DETAIL1 = 'statistics.detail1'; /** * the column name for the detail2 field */ - const COL_DETAIL2 = 'statistics.detail2'; + public const COL_DETAIL2 = 'statistics.detail2'; /** * the column name for the detail3 field */ - const COL_DETAIL3 = 'statistics.detail3'; + public const COL_DETAIL3 = 'statistics.detail3'; /** * the column name for the script field */ - const COL_SCRIPT = 'statistics.script'; + public const COL_SCRIPT = 'statistics.script'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'UserId', 'Date', 'Type', 'Detail1', 'Detail2', 'Detail3', 'Script', ), - self::TYPE_CAMELNAME => array('id', 'userId', 'date', 'type', 'detail1', 'detail2', 'detail3', 'script', ), - self::TYPE_COLNAME => array(StatisticTableMap::COL_ID, StatisticTableMap::COL_USERID, StatisticTableMap::COL_DATE, StatisticTableMap::COL_TYPE, StatisticTableMap::COL_DETAIL1, StatisticTableMap::COL_DETAIL2, StatisticTableMap::COL_DETAIL3, StatisticTableMap::COL_SCRIPT, ), - self::TYPE_FIELDNAME => array('id', 'userid', 'date', 'type', 'detail1', 'detail2', 'detail3', 'script', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'UserId', 'Date', 'Type', 'Detail1', 'Detail2', 'Detail3', 'Script', ], + self::TYPE_CAMELNAME => ['id', 'userId', 'date', 'type', 'detail1', 'detail2', 'detail3', 'script', ], + self::TYPE_COLNAME => [StatisticTableMap::COL_ID, StatisticTableMap::COL_USERID, StatisticTableMap::COL_DATE, StatisticTableMap::COL_TYPE, StatisticTableMap::COL_DETAIL1, StatisticTableMap::COL_DETAIL2, StatisticTableMap::COL_DETAIL3, StatisticTableMap::COL_SCRIPT, ], + self::TYPE_FIELDNAME => ['id', 'userid', 'date', 'type', 'detail1', 'detail2', 'detail3', 'script', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'UserId' => 1, 'Date' => 2, 'Type' => 3, 'Detail1' => 4, 'Detail2' => 5, 'Detail3' => 6, 'Script' => 7, ), - self::TYPE_CAMELNAME => array('id' => 0, 'userId' => 1, 'date' => 2, 'type' => 3, 'detail1' => 4, 'detail2' => 5, 'detail3' => 6, 'script' => 7, ), - self::TYPE_COLNAME => array(StatisticTableMap::COL_ID => 0, StatisticTableMap::COL_USERID => 1, StatisticTableMap::COL_DATE => 2, StatisticTableMap::COL_TYPE => 3, StatisticTableMap::COL_DETAIL1 => 4, StatisticTableMap::COL_DETAIL2 => 5, StatisticTableMap::COL_DETAIL3 => 6, StatisticTableMap::COL_SCRIPT => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'userid' => 1, 'date' => 2, 'type' => 3, 'detail1' => 4, 'detail2' => 5, 'detail3' => 6, 'script' => 7, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'UserId' => 1, 'Date' => 2, 'Type' => 3, 'Detail1' => 4, 'Detail2' => 5, 'Detail3' => 6, 'Script' => 7, ], + self::TYPE_CAMELNAME => ['id' => 0, 'userId' => 1, 'date' => 2, 'type' => 3, 'detail1' => 4, 'detail2' => 5, 'detail3' => 6, 'script' => 7, ], + self::TYPE_COLNAME => [StatisticTableMap::COL_ID => 0, StatisticTableMap::COL_USERID => 1, StatisticTableMap::COL_DATE => 2, StatisticTableMap::COL_TYPE => 3, StatisticTableMap::COL_DETAIL1 => 4, StatisticTableMap::COL_DETAIL2 => 5, StatisticTableMap::COL_DETAIL3 => 6, StatisticTableMap::COL_SCRIPT => 7, ], + self::TYPE_FIELDNAME => ['id' => 0, 'userid' => 1, 'date' => 2, 'type' => 3, 'detail1' => 4, 'detail2' => 5, 'detail3' => 6, 'script' => 7, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Statistic.Id' => 'ID', + 'id' => 'ID', + 'statistic.id' => 'ID', + 'StatisticTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'statistics.id' => 'ID', + 'UserId' => 'USERID', + 'Statistic.UserId' => 'USERID', + 'userId' => 'USERID', + 'statistic.userId' => 'USERID', + 'StatisticTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'userid' => 'USERID', + 'statistics.userid' => 'USERID', + 'Date' => 'DATE', + 'Statistic.Date' => 'DATE', + 'date' => 'DATE', + 'statistic.date' => 'DATE', + 'StatisticTableMap::COL_DATE' => 'DATE', + 'COL_DATE' => 'DATE', + 'statistics.date' => 'DATE', + 'Type' => 'TYPE', + 'Statistic.Type' => 'TYPE', + 'type' => 'TYPE', + 'statistic.type' => 'TYPE', + 'StatisticTableMap::COL_TYPE' => 'TYPE', + 'COL_TYPE' => 'TYPE', + 'statistics.type' => 'TYPE', + 'Detail1' => 'DETAIL1', + 'Statistic.Detail1' => 'DETAIL1', + 'detail1' => 'DETAIL1', + 'statistic.detail1' => 'DETAIL1', + 'StatisticTableMap::COL_DETAIL1' => 'DETAIL1', + 'COL_DETAIL1' => 'DETAIL1', + 'statistics.detail1' => 'DETAIL1', + 'Detail2' => 'DETAIL2', + 'Statistic.Detail2' => 'DETAIL2', + 'detail2' => 'DETAIL2', + 'statistic.detail2' => 'DETAIL2', + 'StatisticTableMap::COL_DETAIL2' => 'DETAIL2', + 'COL_DETAIL2' => 'DETAIL2', + 'statistics.detail2' => 'DETAIL2', + 'Detail3' => 'DETAIL3', + 'Statistic.Detail3' => 'DETAIL3', + 'detail3' => 'DETAIL3', + 'statistic.detail3' => 'DETAIL3', + 'StatisticTableMap::COL_DETAIL3' => 'DETAIL3', + 'COL_DETAIL3' => 'DETAIL3', + 'statistics.detail3' => 'DETAIL3', + 'Script' => 'SCRIPT', + 'Statistic.Script' => 'SCRIPT', + 'script' => 'SCRIPT', + 'statistic.script' => 'SCRIPT', + 'StatisticTableMap::COL_SCRIPT' => 'SCRIPT', + 'COL_SCRIPT' => 'SCRIPT', + 'statistics.script' => 'SCRIPT', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('statistics'); @@ -168,21 +242,23 @@ public function initialize() $this->addColumn('detail2', 'Detail2', 'LONGVARCHAR', true, null, null); $this->addColumn('detail3', 'Detail3', 'LONGVARCHAR', true, null, null); $this->addColumn('script', 'Script', 'LONGVARCHAR', true, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userid', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -190,14 +266,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -212,14 +288,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -236,10 +312,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? StatisticTableMap::CLASS_DEFAULT : StatisticTableMap::OM_CLASS; } @@ -247,17 +323,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Statistic object, last column rank) + * @return array (Statistic object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = StatisticTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = StatisticTableMap::getInstanceFromPool($key))) { @@ -273,7 +349,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: StatisticTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -281,13 +357,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -317,12 +393,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(StatisticTableMap::COL_ID); @@ -346,68 +423,92 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(StatisticTableMap::DATABASE_NAME)->getTable(StatisticTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(StatisticTableMap::COL_ID); + $criteria->removeSelectColumn(StatisticTableMap::COL_USERID); + $criteria->removeSelectColumn(StatisticTableMap::COL_DATE); + $criteria->removeSelectColumn(StatisticTableMap::COL_TYPE); + $criteria->removeSelectColumn(StatisticTableMap::COL_DETAIL1); + $criteria->removeSelectColumn(StatisticTableMap::COL_DETAIL2); + $criteria->removeSelectColumn(StatisticTableMap::COL_DETAIL3); + $criteria->removeSelectColumn(StatisticTableMap::COL_SCRIPT); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.userid'); + $criteria->removeSelectColumn($alias . '.date'); + $criteria->removeSelectColumn($alias . '.type'); + $criteria->removeSelectColumn($alias . '.detail1'); + $criteria->removeSelectColumn($alias . '.detail2'); + $criteria->removeSelectColumn($alias . '.detail3'); + $criteria->removeSelectColumn($alias . '.script'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(StatisticTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(StatisticTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new StatisticTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(StatisticTableMap::DATABASE_NAME)->getTable(StatisticTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Statistic or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Statistic object or primary key or array of primary keys + * @param mixed $values Criteria or Statistic object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(StatisticTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(StatisticTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Statistic) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Statistic) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(StatisticTableMap::DATABASE_NAME); - $criteria->add(StatisticTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(StatisticTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = StatisticQuery::create()->mergeWith($criteria); + $query = StatisticQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - StatisticTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + StatisticTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { StatisticTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the statistics table. @@ -415,7 +516,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return StatisticQuery::create()->doDeleteAll($con); } @@ -423,13 +524,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Statistic or Criteria object. * - * @param mixed $criteria Criteria or Statistic object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Statistic object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(StatisticTableMap::DATABASE_NAME); @@ -441,7 +542,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Statistic object } - if ($criteria->containsKey(StatisticTableMap::COL_ID) && $criteria->keyContainsValue(StatisticTableMap::COL_ID)) { + if ($criteria->containsKey(StatisticTableMap::COL_ID) && $criteria->keyContainsValue(StatisticTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.StatisticTableMap::COL_ID.')'); } @@ -455,7 +556,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // StatisticTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -StatisticTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/SwapTableMap.php b/generated-classes/TechWilk/Rota/Map/SwapTableMap.php index b4cd9da9..2aa14e3e 100644 --- a/generated-classes/TechWilk/Rota/Map/SwapTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/SwapTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\Swap; use TechWilk\Rota\SwapQuery; + /** * This class defines the structure of the 'swaps' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class SwapTableMap extends TableMap { @@ -33,134 +33,221 @@ class SwapTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.SwapTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.SwapTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'swaps'; + public const TABLE_NAME = 'swaps'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'Swap'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\Swap'; + public const OM_CLASS = '\\TechWilk\\Rota\\Swap'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.Swap'; + public const CLASS_DEFAULT = 'TechWilk.Rota.Swap'; /** * The total number of columns */ - const NUM_COLUMNS = 10; + public const NUM_COLUMNS = 10; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 10; + public const NUM_HYDRATE_COLUMNS = 10; /** * the column name for the id field */ - const COL_ID = 'swaps.id'; + public const COL_ID = 'swaps.id'; /** * the column name for the eventPersonId field */ - const COL_EVENTPERSONID = 'swaps.eventPersonId'; + public const COL_EVENTPERSONID = 'swaps.eventPersonId'; /** * the column name for the oldUserRoleId field */ - const COL_OLDUSERROLEID = 'swaps.oldUserRoleId'; + public const COL_OLDUSERROLEID = 'swaps.oldUserRoleId'; /** * the column name for the newUserRoleId field */ - const COL_NEWUSERROLEID = 'swaps.newUserRoleId'; + public const COL_NEWUSERROLEID = 'swaps.newUserRoleId'; /** * the column name for the accepted field */ - const COL_ACCEPTED = 'swaps.accepted'; + public const COL_ACCEPTED = 'swaps.accepted'; /** * the column name for the declined field */ - const COL_DECLINED = 'swaps.declined'; + public const COL_DECLINED = 'swaps.declined'; /** * the column name for the requestedBy field */ - const COL_REQUESTEDBY = 'swaps.requestedBy'; + public const COL_REQUESTEDBY = 'swaps.requestedBy'; /** * the column name for the verificationCode field */ - const COL_VERIFICATIONCODE = 'swaps.verificationCode'; + public const COL_VERIFICATIONCODE = 'swaps.verificationCode'; /** * the column name for the created field */ - const COL_CREATED = 'swaps.created'; + public const COL_CREATED = 'swaps.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'swaps.updated'; + public const COL_UPDATED = 'swaps.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'EventPersonId', 'OldUserRoleId', 'NewUserRoleId', 'Accepted', 'Declined', 'RequestedBy', 'VerificationCode', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'eventPersonId', 'oldUserRoleId', 'newUserRoleId', 'accepted', 'declined', 'requestedBy', 'verificationCode', 'created', 'updated', ), - self::TYPE_COLNAME => array(SwapTableMap::COL_ID, SwapTableMap::COL_EVENTPERSONID, SwapTableMap::COL_OLDUSERROLEID, SwapTableMap::COL_NEWUSERROLEID, SwapTableMap::COL_ACCEPTED, SwapTableMap::COL_DECLINED, SwapTableMap::COL_REQUESTEDBY, SwapTableMap::COL_VERIFICATIONCODE, SwapTableMap::COL_CREATED, SwapTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'eventPersonId', 'oldUserRoleId', 'newUserRoleId', 'accepted', 'declined', 'requestedBy', 'verificationCode', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'EventPersonId', 'OldUserRoleId', 'NewUserRoleId', 'Accepted', 'Declined', 'RequestedBy', 'VerificationCode', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'eventPersonId', 'oldUserRoleId', 'newUserRoleId', 'accepted', 'declined', 'requestedBy', 'verificationCode', 'created', 'updated', ], + self::TYPE_COLNAME => [SwapTableMap::COL_ID, SwapTableMap::COL_EVENTPERSONID, SwapTableMap::COL_OLDUSERROLEID, SwapTableMap::COL_NEWUSERROLEID, SwapTableMap::COL_ACCEPTED, SwapTableMap::COL_DECLINED, SwapTableMap::COL_REQUESTEDBY, SwapTableMap::COL_VERIFICATIONCODE, SwapTableMap::COL_CREATED, SwapTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'eventPersonId', 'oldUserRoleId', 'newUserRoleId', 'accepted', 'declined', 'requestedBy', 'verificationCode', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'EventPersonId' => 1, 'OldUserRoleId' => 2, 'NewUserRoleId' => 3, 'Accepted' => 4, 'Declined' => 5, 'RequestedBy' => 6, 'VerificationCode' => 7, 'Created' => 8, 'Updated' => 9, ), - self::TYPE_CAMELNAME => array('id' => 0, 'eventPersonId' => 1, 'oldUserRoleId' => 2, 'newUserRoleId' => 3, 'accepted' => 4, 'declined' => 5, 'requestedBy' => 6, 'verificationCode' => 7, 'created' => 8, 'updated' => 9, ), - self::TYPE_COLNAME => array(SwapTableMap::COL_ID => 0, SwapTableMap::COL_EVENTPERSONID => 1, SwapTableMap::COL_OLDUSERROLEID => 2, SwapTableMap::COL_NEWUSERROLEID => 3, SwapTableMap::COL_ACCEPTED => 4, SwapTableMap::COL_DECLINED => 5, SwapTableMap::COL_REQUESTEDBY => 6, SwapTableMap::COL_VERIFICATIONCODE => 7, SwapTableMap::COL_CREATED => 8, SwapTableMap::COL_UPDATED => 9, ), - self::TYPE_FIELDNAME => array('id' => 0, 'eventPersonId' => 1, 'oldUserRoleId' => 2, 'newUserRoleId' => 3, 'accepted' => 4, 'declined' => 5, 'requestedBy' => 6, 'verificationCode' => 7, 'created' => 8, 'updated' => 9, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'EventPersonId' => 1, 'OldUserRoleId' => 2, 'NewUserRoleId' => 3, 'Accepted' => 4, 'Declined' => 5, 'RequestedBy' => 6, 'VerificationCode' => 7, 'Created' => 8, 'Updated' => 9, ], + self::TYPE_CAMELNAME => ['id' => 0, 'eventPersonId' => 1, 'oldUserRoleId' => 2, 'newUserRoleId' => 3, 'accepted' => 4, 'declined' => 5, 'requestedBy' => 6, 'verificationCode' => 7, 'created' => 8, 'updated' => 9, ], + self::TYPE_COLNAME => [SwapTableMap::COL_ID => 0, SwapTableMap::COL_EVENTPERSONID => 1, SwapTableMap::COL_OLDUSERROLEID => 2, SwapTableMap::COL_NEWUSERROLEID => 3, SwapTableMap::COL_ACCEPTED => 4, SwapTableMap::COL_DECLINED => 5, SwapTableMap::COL_REQUESTEDBY => 6, SwapTableMap::COL_VERIFICATIONCODE => 7, SwapTableMap::COL_CREATED => 8, SwapTableMap::COL_UPDATED => 9, ], + self::TYPE_FIELDNAME => ['id' => 0, 'eventPersonId' => 1, 'oldUserRoleId' => 2, 'newUserRoleId' => 3, 'accepted' => 4, 'declined' => 5, 'requestedBy' => 6, 'verificationCode' => 7, 'created' => 8, 'updated' => 9, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'Swap.Id' => 'ID', + 'id' => 'ID', + 'swap.id' => 'ID', + 'SwapTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'swaps.id' => 'ID', + 'EventPersonId' => 'EVENTPERSONID', + 'Swap.EventPersonId' => 'EVENTPERSONID', + 'eventPersonId' => 'EVENTPERSONID', + 'swap.eventPersonId' => 'EVENTPERSONID', + 'SwapTableMap::COL_EVENTPERSONID' => 'EVENTPERSONID', + 'COL_EVENTPERSONID' => 'EVENTPERSONID', + 'swaps.eventPersonId' => 'EVENTPERSONID', + 'OldUserRoleId' => 'OLDUSERROLEID', + 'Swap.OldUserRoleId' => 'OLDUSERROLEID', + 'oldUserRoleId' => 'OLDUSERROLEID', + 'swap.oldUserRoleId' => 'OLDUSERROLEID', + 'SwapTableMap::COL_OLDUSERROLEID' => 'OLDUSERROLEID', + 'COL_OLDUSERROLEID' => 'OLDUSERROLEID', + 'swaps.oldUserRoleId' => 'OLDUSERROLEID', + 'NewUserRoleId' => 'NEWUSERROLEID', + 'Swap.NewUserRoleId' => 'NEWUSERROLEID', + 'newUserRoleId' => 'NEWUSERROLEID', + 'swap.newUserRoleId' => 'NEWUSERROLEID', + 'SwapTableMap::COL_NEWUSERROLEID' => 'NEWUSERROLEID', + 'COL_NEWUSERROLEID' => 'NEWUSERROLEID', + 'swaps.newUserRoleId' => 'NEWUSERROLEID', + 'Accepted' => 'ACCEPTED', + 'Swap.Accepted' => 'ACCEPTED', + 'accepted' => 'ACCEPTED', + 'swap.accepted' => 'ACCEPTED', + 'SwapTableMap::COL_ACCEPTED' => 'ACCEPTED', + 'COL_ACCEPTED' => 'ACCEPTED', + 'swaps.accepted' => 'ACCEPTED', + 'Declined' => 'DECLINED', + 'Swap.Declined' => 'DECLINED', + 'declined' => 'DECLINED', + 'swap.declined' => 'DECLINED', + 'SwapTableMap::COL_DECLINED' => 'DECLINED', + 'COL_DECLINED' => 'DECLINED', + 'swaps.declined' => 'DECLINED', + 'RequestedBy' => 'REQUESTEDBY', + 'Swap.RequestedBy' => 'REQUESTEDBY', + 'requestedBy' => 'REQUESTEDBY', + 'swap.requestedBy' => 'REQUESTEDBY', + 'SwapTableMap::COL_REQUESTEDBY' => 'REQUESTEDBY', + 'COL_REQUESTEDBY' => 'REQUESTEDBY', + 'swaps.requestedBy' => 'REQUESTEDBY', + 'VerificationCode' => 'VERIFICATIONCODE', + 'Swap.VerificationCode' => 'VERIFICATIONCODE', + 'verificationCode' => 'VERIFICATIONCODE', + 'swap.verificationCode' => 'VERIFICATIONCODE', + 'SwapTableMap::COL_VERIFICATIONCODE' => 'VERIFICATIONCODE', + 'COL_VERIFICATIONCODE' => 'VERIFICATIONCODE', + 'swaps.verificationCode' => 'VERIFICATIONCODE', + 'Created' => 'CREATED', + 'Swap.Created' => 'CREATED', + 'created' => 'CREATED', + 'swap.created' => 'CREATED', + 'SwapTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'swaps.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'Swap.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'swap.updated' => 'UPDATED', + 'SwapTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'swaps.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('swaps'); @@ -180,55 +267,57 @@ public function initialize() $this->addColumn('verificationCode', 'VerificationCode', 'VARCHAR', true, 18, null); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('EventPerson', '\\TechWilk\\Rota\\EventPerson', RelationMap::MANY_TO_ONE, array( + $this->addRelation('EventPerson', '\\TechWilk\\Rota\\EventPerson', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':eventPersonId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('OldUserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::MANY_TO_ONE, array( + $this->addRelation('OldUserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':oldUserRoleId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('NewUserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::MANY_TO_ONE, array( + $this->addRelation('NewUserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':newUserRoleId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':requestedBy', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -236,14 +325,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -258,14 +347,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -282,10 +371,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? SwapTableMap::CLASS_DEFAULT : SwapTableMap::OM_CLASS; } @@ -293,17 +382,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Swap object, last column rank) + * @return array (Swap object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = SwapTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = SwapTableMap::getInstanceFromPool($key))) { @@ -319,7 +408,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: SwapTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -327,13 +416,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -363,12 +452,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(SwapTableMap::COL_ID); @@ -396,68 +486,96 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(SwapTableMap::DATABASE_NAME)->getTable(SwapTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(SwapTableMap::COL_ID); + $criteria->removeSelectColumn(SwapTableMap::COL_EVENTPERSONID); + $criteria->removeSelectColumn(SwapTableMap::COL_OLDUSERROLEID); + $criteria->removeSelectColumn(SwapTableMap::COL_NEWUSERROLEID); + $criteria->removeSelectColumn(SwapTableMap::COL_ACCEPTED); + $criteria->removeSelectColumn(SwapTableMap::COL_DECLINED); + $criteria->removeSelectColumn(SwapTableMap::COL_REQUESTEDBY); + $criteria->removeSelectColumn(SwapTableMap::COL_VERIFICATIONCODE); + $criteria->removeSelectColumn(SwapTableMap::COL_CREATED); + $criteria->removeSelectColumn(SwapTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.eventPersonId'); + $criteria->removeSelectColumn($alias . '.oldUserRoleId'); + $criteria->removeSelectColumn($alias . '.newUserRoleId'); + $criteria->removeSelectColumn($alias . '.accepted'); + $criteria->removeSelectColumn($alias . '.declined'); + $criteria->removeSelectColumn($alias . '.requestedBy'); + $criteria->removeSelectColumn($alias . '.verificationCode'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(SwapTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(SwapTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new SwapTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(SwapTableMap::DATABASE_NAME)->getTable(SwapTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a Swap or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Swap object or primary key or array of primary keys + * @param mixed $values Criteria or Swap object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(SwapTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(SwapTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\Swap) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\Swap) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(SwapTableMap::DATABASE_NAME); - $criteria->add(SwapTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(SwapTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = SwapQuery::create()->mergeWith($criteria); + $query = SwapQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - SwapTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + SwapTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { SwapTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the swaps table. @@ -465,7 +583,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return SwapQuery::create()->doDeleteAll($con); } @@ -473,13 +591,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a Swap or Criteria object. * - * @param mixed $criteria Criteria or Swap object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Swap object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SwapTableMap::DATABASE_NAME); @@ -491,7 +609,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from Swap object } - if ($criteria->containsKey(SwapTableMap::COL_ID) && $criteria->keyContainsValue(SwapTableMap::COL_ID)) { + if ($criteria->containsKey(SwapTableMap::COL_ID) && $criteria->keyContainsValue(SwapTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.SwapTableMap::COL_ID.')'); } @@ -505,7 +623,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // SwapTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -SwapTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/UserPermissionTableMap.php b/generated-classes/TechWilk/Rota/Map/UserPermissionTableMap.php index d97d5927..ce3f79b6 100644 --- a/generated-classes/TechWilk/Rota/Map/UserPermissionTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/UserPermissionTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\UserPermission; use TechWilk\Rota\UserPermissionQuery; + /** * This class defines the structure of the 'userPermissions' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class UserPermissionTableMap extends TableMap { @@ -33,109 +33,161 @@ class UserPermissionTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.UserPermissionTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.UserPermissionTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'userPermissions'; + public const TABLE_NAME = 'userPermissions'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'UserPermission'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\UserPermission'; + public const OM_CLASS = '\\TechWilk\\Rota\\UserPermission'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.UserPermission'; + public const CLASS_DEFAULT = 'TechWilk.Rota.UserPermission'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + public const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + public const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the id field */ - const COL_ID = 'userPermissions.id'; + public const COL_ID = 'userPermissions.id'; /** * the column name for the userId field */ - const COL_USERID = 'userPermissions.userId'; + public const COL_USERID = 'userPermissions.userId'; /** * the column name for the permissionId field */ - const COL_PERMISSIONID = 'userPermissions.permissionId'; + public const COL_PERMISSIONID = 'userPermissions.permissionId'; /** * the column name for the created field */ - const COL_CREATED = 'userPermissions.created'; + public const COL_CREATED = 'userPermissions.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'userPermissions.updated'; + public const COL_UPDATED = 'userPermissions.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'UserId', 'PermissionId', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'userId', 'permissionId', 'created', 'updated', ), - self::TYPE_COLNAME => array(UserPermissionTableMap::COL_ID, UserPermissionTableMap::COL_USERID, UserPermissionTableMap::COL_PERMISSIONID, UserPermissionTableMap::COL_CREATED, UserPermissionTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'userId', 'permissionId', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'UserId', 'PermissionId', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'userId', 'permissionId', 'created', 'updated', ], + self::TYPE_COLNAME => [UserPermissionTableMap::COL_ID, UserPermissionTableMap::COL_USERID, UserPermissionTableMap::COL_PERMISSIONID, UserPermissionTableMap::COL_CREATED, UserPermissionTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'userId', 'permissionId', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'UserId' => 1, 'PermissionId' => 2, 'Created' => 3, 'Updated' => 4, ], + self::TYPE_CAMELNAME => ['id' => 0, 'userId' => 1, 'permissionId' => 2, 'created' => 3, 'updated' => 4, ], + self::TYPE_COLNAME => [UserPermissionTableMap::COL_ID => 0, UserPermissionTableMap::COL_USERID => 1, UserPermissionTableMap::COL_PERMISSIONID => 2, UserPermissionTableMap::COL_CREATED => 3, UserPermissionTableMap::COL_UPDATED => 4, ], + self::TYPE_FIELDNAME => ['id' => 0, 'userId' => 1, 'permissionId' => 2, 'created' => 3, 'updated' => 4, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'UserId' => 1, 'PermissionId' => 2, 'Created' => 3, 'Updated' => 4, ), - self::TYPE_CAMELNAME => array('id' => 0, 'userId' => 1, 'permissionId' => 2, 'created' => 3, 'updated' => 4, ), - self::TYPE_COLNAME => array(UserPermissionTableMap::COL_ID => 0, UserPermissionTableMap::COL_USERID => 1, UserPermissionTableMap::COL_PERMISSIONID => 2, UserPermissionTableMap::COL_CREATED => 3, UserPermissionTableMap::COL_UPDATED => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'userId' => 1, 'permissionId' => 2, 'created' => 3, 'updated' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'UserPermission.Id' => 'ID', + 'id' => 'ID', + 'userPermission.id' => 'ID', + 'UserPermissionTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'userPermissions.id' => 'ID', + 'UserId' => 'USERID', + 'UserPermission.UserId' => 'USERID', + 'userId' => 'USERID', + 'userPermission.userId' => 'USERID', + 'UserPermissionTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'userPermissions.userId' => 'USERID', + 'PermissionId' => 'PERMISSIONID', + 'UserPermission.PermissionId' => 'PERMISSIONID', + 'permissionId' => 'PERMISSIONID', + 'userPermission.permissionId' => 'PERMISSIONID', + 'UserPermissionTableMap::COL_PERMISSIONID' => 'PERMISSIONID', + 'COL_PERMISSIONID' => 'PERMISSIONID', + 'userPermissions.permissionId' => 'PERMISSIONID', + 'Created' => 'CREATED', + 'UserPermission.Created' => 'CREATED', + 'created' => 'CREATED', + 'userPermission.created' => 'CREATED', + 'UserPermissionTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'userPermissions.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'UserPermission.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'userPermission.updated' => 'UPDATED', + 'UserPermissionTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'userPermissions.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('userPermissions'); @@ -150,41 +202,43 @@ public function initialize() $this->addForeignKey('permissionId', 'PermissionId', 'INTEGER', 'permissions', 'id', true, null, 0); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('Permission', '\\TechWilk\\Rota\\Permission', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Permission', '\\TechWilk\\Rota\\Permission', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':permissionId', 1 => ':id', ), ), null, null, null, false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -192,14 +246,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -214,14 +268,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -238,10 +292,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? UserPermissionTableMap::CLASS_DEFAULT : UserPermissionTableMap::OM_CLASS; } @@ -249,17 +303,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (UserPermission object, last column rank) + * @return array (UserPermission object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = UserPermissionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = UserPermissionTableMap::getInstanceFromPool($key))) { @@ -275,7 +329,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: UserPermissionTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -283,13 +337,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -319,12 +373,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(UserPermissionTableMap::COL_ID); @@ -342,68 +397,86 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(UserPermissionTableMap::DATABASE_NAME)->getTable(UserPermissionTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(UserPermissionTableMap::COL_ID); + $criteria->removeSelectColumn(UserPermissionTableMap::COL_USERID); + $criteria->removeSelectColumn(UserPermissionTableMap::COL_PERMISSIONID); + $criteria->removeSelectColumn(UserPermissionTableMap::COL_CREATED); + $criteria->removeSelectColumn(UserPermissionTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.permissionId'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(UserPermissionTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(UserPermissionTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new UserPermissionTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(UserPermissionTableMap::DATABASE_NAME)->getTable(UserPermissionTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a UserPermission or Criteria object OR a primary key value. * - * @param mixed $values Criteria or UserPermission object or primary key or array of primary keys + * @param mixed $values Criteria or UserPermission object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(UserPermissionTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(UserPermissionTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\UserPermission) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\UserPermission) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(UserPermissionTableMap::DATABASE_NAME); - $criteria->add(UserPermissionTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(UserPermissionTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = UserPermissionQuery::create()->mergeWith($criteria); + $query = UserPermissionQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - UserPermissionTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + UserPermissionTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { UserPermissionTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the userPermissions table. @@ -411,7 +484,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return UserPermissionQuery::create()->doDeleteAll($con); } @@ -419,13 +492,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a UserPermission or Criteria object. * - * @param mixed $criteria Criteria or UserPermission object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or UserPermission object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserPermissionTableMap::DATABASE_NAME); @@ -437,7 +510,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from UserPermission object } - if ($criteria->containsKey(UserPermissionTableMap::COL_ID) && $criteria->keyContainsValue(UserPermissionTableMap::COL_ID)) { + if ($criteria->containsKey(UserPermissionTableMap::COL_ID) && $criteria->keyContainsValue(UserPermissionTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserPermissionTableMap::COL_ID.')'); } @@ -451,7 +524,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // UserPermissionTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -UserPermissionTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/UserRoleTableMap.php b/generated-classes/TechWilk/Rota/Map/UserRoleTableMap.php index 34687577..04094043 100644 --- a/generated-classes/TechWilk/Rota/Map/UserRoleTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/UserRoleTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\UserRole; use TechWilk\Rota\UserRoleQuery; + /** * This class defines the structure of the 'userRoles' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class UserRoleTableMap extends TableMap { @@ -33,104 +33,149 @@ class UserRoleTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.UserRoleTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.UserRoleTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'userRoles'; + public const TABLE_NAME = 'userRoles'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'UserRole'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\UserRole'; + public const OM_CLASS = '\\TechWilk\\Rota\\UserRole'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.UserRole'; + public const CLASS_DEFAULT = 'TechWilk.Rota.UserRole'; /** * The total number of columns */ - const NUM_COLUMNS = 4; + public const NUM_COLUMNS = 4; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 4; + public const NUM_HYDRATE_COLUMNS = 4; /** * the column name for the id field */ - const COL_ID = 'userRoles.id'; + public const COL_ID = 'userRoles.id'; /** * the column name for the userId field */ - const COL_USERID = 'userRoles.userId'; + public const COL_USERID = 'userRoles.userId'; /** * the column name for the roleId field */ - const COL_ROLEID = 'userRoles.roleId'; + public const COL_ROLEID = 'userRoles.roleId'; /** * the column name for the reserve field */ - const COL_RESERVE = 'userRoles.reserve'; + public const COL_RESERVE = 'userRoles.reserve'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'UserId', 'RoleId', 'Reserve', ), - self::TYPE_CAMELNAME => array('id', 'userId', 'roleId', 'reserve', ), - self::TYPE_COLNAME => array(UserRoleTableMap::COL_ID, UserRoleTableMap::COL_USERID, UserRoleTableMap::COL_ROLEID, UserRoleTableMap::COL_RESERVE, ), - self::TYPE_FIELDNAME => array('id', 'userId', 'roleId', 'reserve', ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'UserId', 'RoleId', 'Reserve', ], + self::TYPE_CAMELNAME => ['id', 'userId', 'roleId', 'reserve', ], + self::TYPE_COLNAME => [UserRoleTableMap::COL_ID, UserRoleTableMap::COL_USERID, UserRoleTableMap::COL_ROLEID, UserRoleTableMap::COL_RESERVE, ], + self::TYPE_FIELDNAME => ['id', 'userId', 'roleId', 'reserve', ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array + */ + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'UserId' => 1, 'RoleId' => 2, 'Reserve' => 3, ], + self::TYPE_CAMELNAME => ['id' => 0, 'userId' => 1, 'roleId' => 2, 'reserve' => 3, ], + self::TYPE_COLNAME => [UserRoleTableMap::COL_ID => 0, UserRoleTableMap::COL_USERID => 1, UserRoleTableMap::COL_ROLEID => 2, UserRoleTableMap::COL_RESERVE => 3, ], + self::TYPE_FIELDNAME => ['id' => 0, 'userId' => 1, 'roleId' => 2, 'reserve' => 3, ], + self::TYPE_NUM => [0, 1, 2, 3, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'UserId' => 1, 'RoleId' => 2, 'Reserve' => 3, ), - self::TYPE_CAMELNAME => array('id' => 0, 'userId' => 1, 'roleId' => 2, 'reserve' => 3, ), - self::TYPE_COLNAME => array(UserRoleTableMap::COL_ID => 0, UserRoleTableMap::COL_USERID => 1, UserRoleTableMap::COL_ROLEID => 2, UserRoleTableMap::COL_RESERVE => 3, ), - self::TYPE_FIELDNAME => array('id' => 0, 'userId' => 1, 'roleId' => 2, 'reserve' => 3, ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'UserRole.Id' => 'ID', + 'id' => 'ID', + 'userRole.id' => 'ID', + 'UserRoleTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'userRoles.id' => 'ID', + 'UserId' => 'USERID', + 'UserRole.UserId' => 'USERID', + 'userId' => 'USERID', + 'userRole.userId' => 'USERID', + 'UserRoleTableMap::COL_USERID' => 'USERID', + 'COL_USERID' => 'USERID', + 'userRoles.userId' => 'USERID', + 'RoleId' => 'ROLEID', + 'UserRole.RoleId' => 'ROLEID', + 'roleId' => 'ROLEID', + 'userRole.roleId' => 'ROLEID', + 'UserRoleTableMap::COL_ROLEID' => 'ROLEID', + 'COL_ROLEID' => 'ROLEID', + 'userRoles.roleId' => 'ROLEID', + 'Reserve' => 'RESERVE', + 'UserRole.Reserve' => 'RESERVE', + 'reserve' => 'RESERVE', + 'userRole.reserve' => 'RESERVE', + 'UserRoleTableMap::COL_RESERVE' => 'RESERVE', + 'COL_RESERVE' => 'RESERVE', + 'userRoles.reserve' => 'RESERVE', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('userRoles'); @@ -144,49 +189,51 @@ public function initialize() $this->addForeignKey('userId', 'UserId', 'INTEGER', 'users', 'id', true, 30, 0); $this->addForeignKey('roleId', 'RoleId', 'INTEGER', 'roles', 'id', true, null, 0); $this->addColumn('reserve', 'Reserve', 'BOOLEAN', true, 1, false); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array( + $this->addRelation('User', '\\TechWilk\\Rota\\User', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('Role', '\\TechWilk\\Rota\\Role', RelationMap::MANY_TO_ONE, array( + $this->addRelation('Role', '\\TechWilk\\Rota\\Role', RelationMap::MANY_TO_ONE, array ( 0 => - array( + array ( 0 => ':roleId', 1 => ':id', ), ), null, null, null, false); - $this->addRelation('EventPerson', '\\TechWilk\\Rota\\EventPerson', RelationMap::ONE_TO_MANY, array( + $this->addRelation('EventPerson', '\\TechWilk\\Rota\\EventPerson', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userRoleId', 1 => ':id', ), ), null, null, 'Eventpeople', false); - $this->addRelation('SwapRelatedByOldUserRoleId', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array( + $this->addRelation('SwapRelatedByOldUserRoleId', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':oldUserRoleId', 1 => ':id', ), ), null, null, 'SwapsRelatedByOldUserRoleId', false); - $this->addRelation('SwapRelatedByNewUserRoleId', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array( + $this->addRelation('SwapRelatedByNewUserRoleId', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':newUserRoleId', 1 => ':id', ), ), null, null, 'SwapsRelatedByNewUserRoleId', false); - } // buildRelations() + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -194,14 +241,14 @@ public function buildRelations() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -216,14 +263,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -240,10 +287,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? UserRoleTableMap::CLASS_DEFAULT : UserRoleTableMap::OM_CLASS; } @@ -251,17 +298,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (UserRole object, last column rank) + * @return array (UserRole object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = UserRoleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = UserRoleTableMap::getInstanceFromPool($key))) { @@ -277,7 +324,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: UserRoleTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -285,13 +332,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -321,12 +368,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(UserRoleTableMap::COL_ID); @@ -342,68 +390,84 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(UserRoleTableMap::DATABASE_NAME)->getTable(UserRoleTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(UserRoleTableMap::COL_ID); + $criteria->removeSelectColumn(UserRoleTableMap::COL_USERID); + $criteria->removeSelectColumn(UserRoleTableMap::COL_ROLEID); + $criteria->removeSelectColumn(UserRoleTableMap::COL_RESERVE); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.userId'); + $criteria->removeSelectColumn($alias . '.roleId'); + $criteria->removeSelectColumn($alias . '.reserve'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(UserRoleTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(UserRoleTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new UserRoleTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(UserRoleTableMap::DATABASE_NAME)->getTable(UserRoleTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a UserRole or Criteria object OR a primary key value. * - * @param mixed $values Criteria or UserRole object or primary key or array of primary keys + * @param mixed $values Criteria or UserRole object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(UserRoleTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(UserRoleTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\UserRole) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\UserRole) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(UserRoleTableMap::DATABASE_NAME); - $criteria->add(UserRoleTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(UserRoleTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = UserRoleQuery::create()->mergeWith($criteria); + $query = UserRoleQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - UserRoleTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + UserRoleTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { UserRoleTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the userRoles table. @@ -411,7 +475,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return UserRoleQuery::create()->doDeleteAll($con); } @@ -419,13 +483,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a UserRole or Criteria object. * - * @param mixed $criteria Criteria or UserRole object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or UserRole object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserRoleTableMap::DATABASE_NAME); @@ -437,7 +501,7 @@ public static function doInsert($criteria, ConnectionInterface $con = null) $criteria = $criteria->buildCriteria(); // build Criteria from UserRole object } - if ($criteria->containsKey(UserRoleTableMap::COL_ID) && $criteria->keyContainsValue(UserRoleTableMap::COL_ID)) { + if ($criteria->containsKey(UserRoleTableMap::COL_ID) && $criteria->keyContainsValue(UserRoleTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserRoleTableMap::COL_ID.')'); } @@ -451,7 +515,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // UserRoleTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -UserRoleTableMap::buildTableMap(); + +} diff --git a/generated-classes/TechWilk/Rota/Map/UserTableMap.php b/generated-classes/TechWilk/Rota/Map/UserTableMap.php index 44c7c865..a371f2ea 100644 --- a/generated-classes/TechWilk/Rota/Map/UserTableMap.php +++ b/generated-classes/TechWilk/Rota/Map/UserTableMap.php @@ -14,6 +14,7 @@ use TechWilk\Rota\User; use TechWilk\Rota\UserQuery; + /** * This class defines the structure of the 'users' table. * @@ -23,7 +24,6 @@ * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). - * */ class UserTableMap extends TableMap { @@ -33,164 +33,293 @@ class UserTableMap extends TableMap /** * The (dot-path) name of this class */ - const CLASS_NAME = 'TechWilk.Rota.Map.UserTableMap'; + public const CLASS_NAME = 'TechWilk.Rota.Map.UserTableMap'; /** * The default database name for this class */ - const DATABASE_NAME = 'default'; + public const DATABASE_NAME = 'default'; /** * The table name for this class */ - const TABLE_NAME = 'users'; + public const TABLE_NAME = 'users'; + + /** + * The PHP name of this class (PascalCase) + */ + public const TABLE_PHP_NAME = 'User'; /** * The related Propel class for this table */ - const OM_CLASS = '\\TechWilk\\Rota\\User'; + public const OM_CLASS = '\\TechWilk\\Rota\\User'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'TechWilk.Rota.User'; + public const CLASS_DEFAULT = 'TechWilk.Rota.User'; /** * The total number of columns */ - const NUM_COLUMNS = 16; + public const NUM_COLUMNS = 16; /** * The number of lazy-loaded columns */ - const NUM_LAZY_LOAD_COLUMNS = 0; + public const NUM_LAZY_LOAD_COLUMNS = 0; /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 16; + public const NUM_HYDRATE_COLUMNS = 16; /** * the column name for the id field */ - const COL_ID = 'users.id'; + public const COL_ID = 'users.id'; /** * the column name for the firstName field */ - const COL_FIRSTNAME = 'users.firstName'; + public const COL_FIRSTNAME = 'users.firstName'; /** * the column name for the lastName field */ - const COL_LASTNAME = 'users.lastName'; + public const COL_LASTNAME = 'users.lastName'; /** * the column name for the username field */ - const COL_USERNAME = 'users.username'; + public const COL_USERNAME = 'users.username'; /** * the column name for the password field */ - const COL_PASSWORD = 'users.password'; + public const COL_PASSWORD = 'users.password'; /** * the column name for the isAdmin field */ - const COL_ISADMIN = 'users.isAdmin'; + public const COL_ISADMIN = 'users.isAdmin'; /** * the column name for the email field */ - const COL_EMAIL = 'users.email'; + public const COL_EMAIL = 'users.email'; /** * the column name for the mobile field */ - const COL_MOBILE = 'users.mobile'; + public const COL_MOBILE = 'users.mobile'; /** * the column name for the isOverviewRecipient field */ - const COL_ISOVERVIEWRECIPIENT = 'users.isOverviewRecipient'; + public const COL_ISOVERVIEWRECIPIENT = 'users.isOverviewRecipient'; /** * the column name for the recieveReminderEmails field */ - const COL_RECIEVEREMINDEREMAILS = 'users.recieveReminderEmails'; + public const COL_RECIEVEREMINDEREMAILS = 'users.recieveReminderEmails'; /** * the column name for the isBandAdmin field */ - const COL_ISBANDADMIN = 'users.isBandAdmin'; + public const COL_ISBANDADMIN = 'users.isBandAdmin'; /** * the column name for the isEventEditor field */ - const COL_ISEVENTEDITOR = 'users.isEventEditor'; + public const COL_ISEVENTEDITOR = 'users.isEventEditor'; /** * the column name for the lastLogin field */ - const COL_LASTLOGIN = 'users.lastLogin'; + public const COL_LASTLOGIN = 'users.lastLogin'; /** * the column name for the passwordChanged field */ - const COL_PASSWORDCHANGED = 'users.passwordChanged'; + public const COL_PASSWORDCHANGED = 'users.passwordChanged'; /** * the column name for the created field */ - const COL_CREATED = 'users.created'; + public const COL_CREATED = 'users.created'; /** * the column name for the updated field */ - const COL_UPDATED = 'users.updated'; + public const COL_UPDATED = 'users.updated'; /** * The default string format for model objects of the related table */ - const DEFAULT_STRING_FORMAT = 'YAML'; + public const DEFAULT_STRING_FORMAT = 'YAML'; /** * holds an array of fieldnames * * first dimension keys are the type constants * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' + * + * @var array */ - protected static $fieldNames = array( - self::TYPE_PHPNAME => array('Id', 'FirstName', 'LastName', 'Username', 'Password', 'IsAdmin', 'Email', 'Mobile', 'IsOverviewRecipient', 'RecieveReminderEmails', 'IsBandAdmin', 'IsEventEditor', 'LastLogin', 'PasswordChanged', 'Created', 'Updated', ), - self::TYPE_CAMELNAME => array('id', 'firstName', 'lastName', 'username', 'password', 'isAdmin', 'email', 'mobile', 'isOverviewRecipient', 'recieveReminderEmails', 'isBandAdmin', 'isEventEditor', 'lastLogin', 'passwordChanged', 'created', 'updated', ), - self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_FIRSTNAME, UserTableMap::COL_LASTNAME, UserTableMap::COL_USERNAME, UserTableMap::COL_PASSWORD, UserTableMap::COL_ISADMIN, UserTableMap::COL_EMAIL, UserTableMap::COL_MOBILE, UserTableMap::COL_ISOVERVIEWRECIPIENT, UserTableMap::COL_RECIEVEREMINDEREMAILS, UserTableMap::COL_ISBANDADMIN, UserTableMap::COL_ISEVENTEDITOR, UserTableMap::COL_LASTLOGIN, UserTableMap::COL_PASSWORDCHANGED, UserTableMap::COL_CREATED, UserTableMap::COL_UPDATED, ), - self::TYPE_FIELDNAME => array('id', 'firstName', 'lastName', 'username', 'password', 'isAdmin', 'email', 'mobile', 'isOverviewRecipient', 'recieveReminderEmails', 'isBandAdmin', 'isEventEditor', 'lastLogin', 'passwordChanged', 'created', 'updated', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) - ); + protected static $fieldNames = [ + self::TYPE_PHPNAME => ['Id', 'FirstName', 'LastName', 'Username', 'Password', 'IsAdmin', 'Email', 'Mobile', 'IsOverviewRecipient', 'RecieveReminderEmails', 'IsBandAdmin', 'IsEventEditor', 'LastLogin', 'PasswordChanged', 'Created', 'Updated', ], + self::TYPE_CAMELNAME => ['id', 'firstName', 'lastName', 'username', 'password', 'isAdmin', 'email', 'mobile', 'isOverviewRecipient', 'recieveReminderEmails', 'isBandAdmin', 'isEventEditor', 'lastLogin', 'passwordChanged', 'created', 'updated', ], + self::TYPE_COLNAME => [UserTableMap::COL_ID, UserTableMap::COL_FIRSTNAME, UserTableMap::COL_LASTNAME, UserTableMap::COL_USERNAME, UserTableMap::COL_PASSWORD, UserTableMap::COL_ISADMIN, UserTableMap::COL_EMAIL, UserTableMap::COL_MOBILE, UserTableMap::COL_ISOVERVIEWRECIPIENT, UserTableMap::COL_RECIEVEREMINDEREMAILS, UserTableMap::COL_ISBANDADMIN, UserTableMap::COL_ISEVENTEDITOR, UserTableMap::COL_LASTLOGIN, UserTableMap::COL_PASSWORDCHANGED, UserTableMap::COL_CREATED, UserTableMap::COL_UPDATED, ], + self::TYPE_FIELDNAME => ['id', 'firstName', 'lastName', 'username', 'password', 'isAdmin', 'email', 'mobile', 'isOverviewRecipient', 'recieveReminderEmails', 'isBandAdmin', 'isEventEditor', 'lastLogin', 'passwordChanged', 'created', 'updated', ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ] + ]; /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + * + * @var array */ - protected static $fieldKeys = array( - self::TYPE_PHPNAME => array('Id' => 0, 'FirstName' => 1, 'LastName' => 2, 'Username' => 3, 'Password' => 4, 'IsAdmin' => 5, 'Email' => 6, 'Mobile' => 7, 'IsOverviewRecipient' => 8, 'RecieveReminderEmails' => 9, 'IsBandAdmin' => 10, 'IsEventEditor' => 11, 'LastLogin' => 12, 'PasswordChanged' => 13, 'Created' => 14, 'Updated' => 15, ), - self::TYPE_CAMELNAME => array('id' => 0, 'firstName' => 1, 'lastName' => 2, 'username' => 3, 'password' => 4, 'isAdmin' => 5, 'email' => 6, 'mobile' => 7, 'isOverviewRecipient' => 8, 'recieveReminderEmails' => 9, 'isBandAdmin' => 10, 'isEventEditor' => 11, 'lastLogin' => 12, 'passwordChanged' => 13, 'created' => 14, 'updated' => 15, ), - self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_FIRSTNAME => 1, UserTableMap::COL_LASTNAME => 2, UserTableMap::COL_USERNAME => 3, UserTableMap::COL_PASSWORD => 4, UserTableMap::COL_ISADMIN => 5, UserTableMap::COL_EMAIL => 6, UserTableMap::COL_MOBILE => 7, UserTableMap::COL_ISOVERVIEWRECIPIENT => 8, UserTableMap::COL_RECIEVEREMINDEREMAILS => 9, UserTableMap::COL_ISBANDADMIN => 10, UserTableMap::COL_ISEVENTEDITOR => 11, UserTableMap::COL_LASTLOGIN => 12, UserTableMap::COL_PASSWORDCHANGED => 13, UserTableMap::COL_CREATED => 14, UserTableMap::COL_UPDATED => 15, ), - self::TYPE_FIELDNAME => array('id' => 0, 'firstName' => 1, 'lastName' => 2, 'username' => 3, 'password' => 4, 'isAdmin' => 5, 'email' => 6, 'mobile' => 7, 'isOverviewRecipient' => 8, 'recieveReminderEmails' => 9, 'isBandAdmin' => 10, 'isEventEditor' => 11, 'lastLogin' => 12, 'passwordChanged' => 13, 'created' => 14, 'updated' => 15, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) - ); + protected static $fieldKeys = [ + self::TYPE_PHPNAME => ['Id' => 0, 'FirstName' => 1, 'LastName' => 2, 'Username' => 3, 'Password' => 4, 'IsAdmin' => 5, 'Email' => 6, 'Mobile' => 7, 'IsOverviewRecipient' => 8, 'RecieveReminderEmails' => 9, 'IsBandAdmin' => 10, 'IsEventEditor' => 11, 'LastLogin' => 12, 'PasswordChanged' => 13, 'Created' => 14, 'Updated' => 15, ], + self::TYPE_CAMELNAME => ['id' => 0, 'firstName' => 1, 'lastName' => 2, 'username' => 3, 'password' => 4, 'isAdmin' => 5, 'email' => 6, 'mobile' => 7, 'isOverviewRecipient' => 8, 'recieveReminderEmails' => 9, 'isBandAdmin' => 10, 'isEventEditor' => 11, 'lastLogin' => 12, 'passwordChanged' => 13, 'created' => 14, 'updated' => 15, ], + self::TYPE_COLNAME => [UserTableMap::COL_ID => 0, UserTableMap::COL_FIRSTNAME => 1, UserTableMap::COL_LASTNAME => 2, UserTableMap::COL_USERNAME => 3, UserTableMap::COL_PASSWORD => 4, UserTableMap::COL_ISADMIN => 5, UserTableMap::COL_EMAIL => 6, UserTableMap::COL_MOBILE => 7, UserTableMap::COL_ISOVERVIEWRECIPIENT => 8, UserTableMap::COL_RECIEVEREMINDEREMAILS => 9, UserTableMap::COL_ISBANDADMIN => 10, UserTableMap::COL_ISEVENTEDITOR => 11, UserTableMap::COL_LASTLOGIN => 12, UserTableMap::COL_PASSWORDCHANGED => 13, UserTableMap::COL_CREATED => 14, UserTableMap::COL_UPDATED => 15, ], + self::TYPE_FIELDNAME => ['id' => 0, 'firstName' => 1, 'lastName' => 2, 'username' => 3, 'password' => 4, 'isAdmin' => 5, 'email' => 6, 'mobile' => 7, 'isOverviewRecipient' => 8, 'recieveReminderEmails' => 9, 'isBandAdmin' => 10, 'isEventEditor' => 11, 'lastLogin' => 12, 'passwordChanged' => 13, 'created' => 14, 'updated' => 15, ], + self::TYPE_NUM => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ] + ]; + + /** + * Holds a list of column names and their normalized version. + * + * @var array + */ + protected $normalizedColumnNameMap = [ + 'Id' => 'ID', + 'User.Id' => 'ID', + 'id' => 'ID', + 'user.id' => 'ID', + 'UserTableMap::COL_ID' => 'ID', + 'COL_ID' => 'ID', + 'users.id' => 'ID', + 'FirstName' => 'FIRSTNAME', + 'User.FirstName' => 'FIRSTNAME', + 'firstName' => 'FIRSTNAME', + 'user.firstName' => 'FIRSTNAME', + 'UserTableMap::COL_FIRSTNAME' => 'FIRSTNAME', + 'COL_FIRSTNAME' => 'FIRSTNAME', + 'users.firstName' => 'FIRSTNAME', + 'LastName' => 'LASTNAME', + 'User.LastName' => 'LASTNAME', + 'lastName' => 'LASTNAME', + 'user.lastName' => 'LASTNAME', + 'UserTableMap::COL_LASTNAME' => 'LASTNAME', + 'COL_LASTNAME' => 'LASTNAME', + 'users.lastName' => 'LASTNAME', + 'Username' => 'USERNAME', + 'User.Username' => 'USERNAME', + 'username' => 'USERNAME', + 'user.username' => 'USERNAME', + 'UserTableMap::COL_USERNAME' => 'USERNAME', + 'COL_USERNAME' => 'USERNAME', + 'users.username' => 'USERNAME', + 'Password' => 'PASSWORD', + 'User.Password' => 'PASSWORD', + 'password' => 'PASSWORD', + 'user.password' => 'PASSWORD', + 'UserTableMap::COL_PASSWORD' => 'PASSWORD', + 'COL_PASSWORD' => 'PASSWORD', + 'users.password' => 'PASSWORD', + 'IsAdmin' => 'ISADMIN', + 'User.IsAdmin' => 'ISADMIN', + 'isAdmin' => 'ISADMIN', + 'user.isAdmin' => 'ISADMIN', + 'UserTableMap::COL_ISADMIN' => 'ISADMIN', + 'COL_ISADMIN' => 'ISADMIN', + 'users.isAdmin' => 'ISADMIN', + 'Email' => 'EMAIL', + 'User.Email' => 'EMAIL', + 'email' => 'EMAIL', + 'user.email' => 'EMAIL', + 'UserTableMap::COL_EMAIL' => 'EMAIL', + 'COL_EMAIL' => 'EMAIL', + 'users.email' => 'EMAIL', + 'Mobile' => 'MOBILE', + 'User.Mobile' => 'MOBILE', + 'mobile' => 'MOBILE', + 'user.mobile' => 'MOBILE', + 'UserTableMap::COL_MOBILE' => 'MOBILE', + 'COL_MOBILE' => 'MOBILE', + 'users.mobile' => 'MOBILE', + 'IsOverviewRecipient' => 'ISOVERVIEWRECIPIENT', + 'User.IsOverviewRecipient' => 'ISOVERVIEWRECIPIENT', + 'isOverviewRecipient' => 'ISOVERVIEWRECIPIENT', + 'user.isOverviewRecipient' => 'ISOVERVIEWRECIPIENT', + 'UserTableMap::COL_ISOVERVIEWRECIPIENT' => 'ISOVERVIEWRECIPIENT', + 'COL_ISOVERVIEWRECIPIENT' => 'ISOVERVIEWRECIPIENT', + 'users.isOverviewRecipient' => 'ISOVERVIEWRECIPIENT', + 'RecieveReminderEmails' => 'RECIEVEREMINDEREMAILS', + 'User.RecieveReminderEmails' => 'RECIEVEREMINDEREMAILS', + 'recieveReminderEmails' => 'RECIEVEREMINDEREMAILS', + 'user.recieveReminderEmails' => 'RECIEVEREMINDEREMAILS', + 'UserTableMap::COL_RECIEVEREMINDEREMAILS' => 'RECIEVEREMINDEREMAILS', + 'COL_RECIEVEREMINDEREMAILS' => 'RECIEVEREMINDEREMAILS', + 'users.recieveReminderEmails' => 'RECIEVEREMINDEREMAILS', + 'IsBandAdmin' => 'ISBANDADMIN', + 'User.IsBandAdmin' => 'ISBANDADMIN', + 'isBandAdmin' => 'ISBANDADMIN', + 'user.isBandAdmin' => 'ISBANDADMIN', + 'UserTableMap::COL_ISBANDADMIN' => 'ISBANDADMIN', + 'COL_ISBANDADMIN' => 'ISBANDADMIN', + 'users.isBandAdmin' => 'ISBANDADMIN', + 'IsEventEditor' => 'ISEVENTEDITOR', + 'User.IsEventEditor' => 'ISEVENTEDITOR', + 'isEventEditor' => 'ISEVENTEDITOR', + 'user.isEventEditor' => 'ISEVENTEDITOR', + 'UserTableMap::COL_ISEVENTEDITOR' => 'ISEVENTEDITOR', + 'COL_ISEVENTEDITOR' => 'ISEVENTEDITOR', + 'users.isEventEditor' => 'ISEVENTEDITOR', + 'LastLogin' => 'LASTLOGIN', + 'User.LastLogin' => 'LASTLOGIN', + 'lastLogin' => 'LASTLOGIN', + 'user.lastLogin' => 'LASTLOGIN', + 'UserTableMap::COL_LASTLOGIN' => 'LASTLOGIN', + 'COL_LASTLOGIN' => 'LASTLOGIN', + 'users.lastLogin' => 'LASTLOGIN', + 'PasswordChanged' => 'PASSWORDCHANGED', + 'User.PasswordChanged' => 'PASSWORDCHANGED', + 'passwordChanged' => 'PASSWORDCHANGED', + 'user.passwordChanged' => 'PASSWORDCHANGED', + 'UserTableMap::COL_PASSWORDCHANGED' => 'PASSWORDCHANGED', + 'COL_PASSWORDCHANGED' => 'PASSWORDCHANGED', + 'users.passwordChanged' => 'PASSWORDCHANGED', + 'Created' => 'CREATED', + 'User.Created' => 'CREATED', + 'created' => 'CREATED', + 'user.created' => 'CREATED', + 'UserTableMap::COL_CREATED' => 'CREATED', + 'COL_CREATED' => 'CREATED', + 'users.created' => 'CREATED', + 'Updated' => 'UPDATED', + 'User.Updated' => 'UPDATED', + 'updated' => 'UPDATED', + 'user.updated' => 'UPDATED', + 'UserTableMap::COL_UPDATED' => 'UPDATED', + 'COL_UPDATED' => 'UPDATED', + 'users.updated' => 'UPDATED', + ]; /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void - * @throws PropelException + * @throws \Propel\Runtime\Exception\PropelException */ - public function initialize() + public function initialize(): void { // attributes $this->setName('users'); @@ -216,97 +345,99 @@ public function initialize() $this->addColumn('passwordChanged', 'PasswordChanged', 'TIMESTAMP', false, null, null); $this->addColumn('created', 'Created', 'TIMESTAMP', false, null, null); $this->addColumn('updated', 'Updated', 'TIMESTAMP', false, null, null); - } // initialize() + } /** * Build the RelationMap objects for this table relationships + * + * @return void */ - public function buildRelations() + public function buildRelations(): void { - $this->addRelation('CalendarToken', '\\TechWilk\\Rota\\CalendarToken', RelationMap::ONE_TO_MANY, array( + $this->addRelation('CalendarToken', '\\TechWilk\\Rota\\CalendarToken', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'CalendarTokens', false); - $this->addRelation('Comment', '\\TechWilk\\Rota\\Comment', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Comment', '\\TechWilk\\Rota\\Comment', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'Comments', false); - $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Event', '\\TechWilk\\Rota\\Event', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':createdBy', 1 => ':id', ), ), null, null, 'Events', false); - $this->addRelation('Availability', '\\TechWilk\\Rota\\Availability', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Availability', '\\TechWilk\\Rota\\Availability', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'Availabilities', false); - $this->addRelation('Notification', '\\TechWilk\\Rota\\Notification', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Notification', '\\TechWilk\\Rota\\Notification', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'Notifications', false); - $this->addRelation('SocialAuth', '\\TechWilk\\Rota\\SocialAuth', RelationMap::ONE_TO_MANY, array( + $this->addRelation('SocialAuth', '\\TechWilk\\Rota\\SocialAuth', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'SocialAuths', false); - $this->addRelation('Statistic', '\\TechWilk\\Rota\\Statistic', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Statistic', '\\TechWilk\\Rota\\Statistic', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userid', 1 => ':id', ), ), null, null, 'Statistics', false); - $this->addRelation('Swap', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array( + $this->addRelation('Swap', '\\TechWilk\\Rota\\Swap', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':requestedBy', 1 => ':id', ), ), null, null, 'Swaps', false); - $this->addRelation('UserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::ONE_TO_MANY, array( + $this->addRelation('UserRole', '\\TechWilk\\Rota\\UserRole', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'UserRoles', false); - $this->addRelation('UserPermission', '\\TechWilk\\Rota\\UserPermission', RelationMap::ONE_TO_MANY, array( + $this->addRelation('UserPermission', '\\TechWilk\\Rota\\UserPermission', RelationMap::ONE_TO_MANY, array ( 0 => - array( + array ( 0 => ':userId', 1 => ':id', ), ), null, null, 'UserPermissions', false); - } // buildRelations() + } /** * * Gets the list of behaviors registered for this table * - * @return array Associative array (name => parameters) of behaviors + * @return array Associative array (name => parameters) of behaviors */ - public function getBehaviors() + public function getBehaviors(): array { - return array( - 'timestampable' => array('create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() + return [ + 'timestampable' => ['create_column' => 'created', 'update_column' => 'updated', 'disable_created_at' => 'false', 'disable_updated_at' => 'false'], + ]; + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -314,14 +445,14 @@ public function getBehaviors() * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * - * @return string The primary key hash of the row + * @return string|null The primary key hash of the row */ - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyHashFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): ?string { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { @@ -336,14 +467,14 @@ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * - * @param array $row resultset row. - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function getPrimaryKeyFromRow(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM @@ -360,10 +491,10 @@ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = Tabl * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * - * @param boolean $withPrefix Whether or not to return the path with the class name + * @param bool $withPrefix Whether to return the path with the class name * @return string path.to.ClassName */ - public static function getOMClass($withPrefix = true) + public static function getOMClass(bool $withPrefix = true): string { return $withPrefix ? UserTableMap::CLASS_DEFAULT : UserTableMap::OM_CLASS; } @@ -371,17 +502,17 @@ public static function getOMClass($withPrefix = true) /** * Populates an object of the default type or an object that inherit from the default. * - * @param array $row row returned by DataFetcher->fetch(). - * @param int $offset The 0-based offset for reading from the resultset row. + * @param array $row Row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (User object, last column rank) + * @return array (User object, last column rank) */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + public static function populateObject(array $row, int $offset = 0, string $indexType = TableMap::TYPE_NUM): array { $key = UserTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) { @@ -397,7 +528,7 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: UserTableMap::addInstanceToPool($obj, $key); } - return array($obj, $col); + return [$obj, $col]; } /** @@ -405,13 +536,13 @@ public static function populateObject($row, $offset = 0, $indexType = TableMap:: * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher - * @return array - * @throws PropelException Any exceptions caught during processing will be + * @return array + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function populateObjects(DataFetcherInterface $dataFetcher) + public static function populateObjects(DataFetcherInterface $dataFetcher): array { - $results = array(); + $results = []; // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); @@ -441,12 +572,13 @@ public static function populateObjects(DataFetcherInterface $dataFetcher) * XML schema will not be added to the select list and only loaded * on demand. * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be + * @param Criteria $criteria Object containing the columns to add. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function addSelectColumns(Criteria $criteria, $alias = null) + public static function addSelectColumns(Criteria $criteria, ?string $alias = null): void { if (null === $alias) { $criteria->addSelectColumn(UserTableMap::COL_ID); @@ -486,68 +618,108 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) } /** - * Returns the TableMap related to this object. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be + * Remove all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be removed as they are only loaded on demand. + * + * @param Criteria $criteria Object containing the columns to remove. + * @param string|null $alias Optional table alias + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. + * @return void */ - public static function getTableMap() + public static function removeSelectColumns(Criteria $criteria, ?string $alias = null): void { - return Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME)->getTable(UserTableMap::TABLE_NAME); + if (null === $alias) { + $criteria->removeSelectColumn(UserTableMap::COL_ID); + $criteria->removeSelectColumn(UserTableMap::COL_FIRSTNAME); + $criteria->removeSelectColumn(UserTableMap::COL_LASTNAME); + $criteria->removeSelectColumn(UserTableMap::COL_USERNAME); + $criteria->removeSelectColumn(UserTableMap::COL_PASSWORD); + $criteria->removeSelectColumn(UserTableMap::COL_ISADMIN); + $criteria->removeSelectColumn(UserTableMap::COL_EMAIL); + $criteria->removeSelectColumn(UserTableMap::COL_MOBILE); + $criteria->removeSelectColumn(UserTableMap::COL_ISOVERVIEWRECIPIENT); + $criteria->removeSelectColumn(UserTableMap::COL_RECIEVEREMINDEREMAILS); + $criteria->removeSelectColumn(UserTableMap::COL_ISBANDADMIN); + $criteria->removeSelectColumn(UserTableMap::COL_ISEVENTEDITOR); + $criteria->removeSelectColumn(UserTableMap::COL_LASTLOGIN); + $criteria->removeSelectColumn(UserTableMap::COL_PASSWORDCHANGED); + $criteria->removeSelectColumn(UserTableMap::COL_CREATED); + $criteria->removeSelectColumn(UserTableMap::COL_UPDATED); + } else { + $criteria->removeSelectColumn($alias . '.id'); + $criteria->removeSelectColumn($alias . '.firstName'); + $criteria->removeSelectColumn($alias . '.lastName'); + $criteria->removeSelectColumn($alias . '.username'); + $criteria->removeSelectColumn($alias . '.password'); + $criteria->removeSelectColumn($alias . '.isAdmin'); + $criteria->removeSelectColumn($alias . '.email'); + $criteria->removeSelectColumn($alias . '.mobile'); + $criteria->removeSelectColumn($alias . '.isOverviewRecipient'); + $criteria->removeSelectColumn($alias . '.recieveReminderEmails'); + $criteria->removeSelectColumn($alias . '.isBandAdmin'); + $criteria->removeSelectColumn($alias . '.isEventEditor'); + $criteria->removeSelectColumn($alias . '.lastLogin'); + $criteria->removeSelectColumn($alias . '.passwordChanged'); + $criteria->removeSelectColumn($alias . '.created'); + $criteria->removeSelectColumn($alias . '.updated'); + } } /** - * Add a TableMap instance to the database for this tableMap class. + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. */ - public static function buildTableMap() + public static function getTableMap(): TableMap { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(UserTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new UserTableMap()); - } + return Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME)->getTable(UserTableMap::TABLE_NAME); } /** * Performs a DELETE on the database, given a User or Criteria object OR a primary key value. * - * @param mixed $values Criteria or User object or primary key or array of primary keys + * @param mixed $values Criteria or User object or primary key or array of primary keys * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete($values, ConnectionInterface $con = null) + public static function doDelete($values, ?ConnectionInterface $con = null): int { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); - } + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); + } - if ($values instanceof Criteria) { - // rename for clarity + if ($values instanceof Criteria) { + // rename for clarity $criteria = $values; - } elseif ($values instanceof \TechWilk\Rota\User) { // it's a model object + } elseif ($values instanceof \TechWilk\Rota\User) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks + } else { // it's a primary key, or an array of pks $criteria = new Criteria(UserTableMap::DATABASE_NAME); - $criteria->add(UserTableMap::COL_ID, (array) $values, Criteria::IN); - } + $criteria->add(UserTableMap::COL_ID, (array) $values, Criteria::IN); + } - $query = UserQuery::create()->mergeWith($criteria); + $query = UserQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { - UserTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks + if ($values instanceof Criteria) { + UserTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { UserTableMap::removeInstanceFromPool($singleval); } - } + } - return $query->delete($con); - } + return $query->delete($con); + } /** * Deletes all rows from the users table. @@ -555,7 +727,7 @@ public static function doDelete($values, ConnectionInterface $con = null) * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(ConnectionInterface $con = null) + public static function doDeleteAll(?ConnectionInterface $con = null): int { return UserQuery::create()->doDeleteAll($con); } @@ -563,13 +735,13 @@ public static function doDeleteAll(ConnectionInterface $con = null) /** * Performs an INSERT on the database, given a User or Criteria object. * - * @param mixed $criteria Criteria or User object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or User object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be + * @return mixed The new primary key. + * @throws \Propel\Runtime\Exception\PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert($criteria, ConnectionInterface $con = null) + public static function doInsert($criteria, ?ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); @@ -591,7 +763,5 @@ public static function doInsert($criteria, ConnectionInterface $con = null) return $query->doInsert($con); }); } -} // UserTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -UserTableMap::buildTableMap(); + +} diff --git a/generated-conf/config.php b/generated-conf/config.php index 1195e3a7..c298c65f 100644 --- a/generated-conf/config.php +++ b/generated-conf/config.php @@ -2,10 +2,10 @@ require __DIR__.'/../config/database.php'; $serviceContainer = \Propel\Runtime\Propel::getServiceContainer(); -$serviceContainer->checkVersion('2.0.0-dev'); +$serviceContainer->checkVersion(2); $serviceContainer->setAdapterClass('default', 'mysql'); -$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); +$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle('default'); $manager->setConfiguration([ 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], @@ -21,10 +21,10 @@ ], ]); $manager->setName('default'); -$serviceContainer->setConnectionManager('default', $manager); +$serviceContainer->setConnectionManager($manager); $serviceContainer->setAdapterClass('test', 'sqlite'); -$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); +$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle('test'); $manager->setConfiguration([ 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', 'dsn' => 'sqlite:/var/tmp/test.db', @@ -37,7 +37,7 @@ 1 => 'vendor', ], ]); -$manager->setName('test'); -$serviceContainer->setConnectionManager('test', $manager); +$serviceContainer->setConnectionManager($manager); $serviceContainer->setDefaultDatasource('default'); +require_once __DIR__ . '/./loadDatabase.php'; diff --git a/generated-conf/loadDatabase.php b/generated-conf/loadDatabase.php new file mode 100644 index 00000000..ad980881 --- /dev/null +++ b/generated-conf/loadDatabase.php @@ -0,0 +1,67 @@ +initDatabaseMapFromDumps(array ( + 'default' => + array ( + 'tablesByName' => + array ( + 'availability' => '\\TechWilk\\Rota\\Map\\AvailabilityTableMap', + 'calendarTokens' => '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap', + 'comments' => '\\TechWilk\\Rota\\Map\\CommentTableMap', + 'documents' => '\\TechWilk\\Rota\\Map\\DocumentTableMap', + 'emails' => '\\TechWilk\\Rota\\Map\\EmailTableMap', + 'eventGroups' => '\\TechWilk\\Rota\\Map\\EventGroupTableMap', + 'eventPeople' => '\\TechWilk\\Rota\\Map\\EventPersonTableMap', + 'eventSubTypes' => '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap', + 'eventTypes' => '\\TechWilk\\Rota\\Map\\EventTypeTableMap', + 'events' => '\\TechWilk\\Rota\\Map\\EventTableMap', + 'groups' => '\\TechWilk\\Rota\\Map\\GroupTableMap', + 'locations' => '\\TechWilk\\Rota\\Map\\LocationTableMap', + 'loginFailures' => '\\TechWilk\\Rota\\Map\\LoginFailureTableMap', + 'notificationClicks' => '\\TechWilk\\Rota\\Map\\NotificationClickTableMap', + 'notifications' => '\\TechWilk\\Rota\\Map\\NotificationTableMap', + 'pendingUsers' => '\\TechWilk\\Rota\\Map\\PendingUserTableMap', + 'permissionGroupPermissions' => '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap', + 'permissionGroups' => '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap', + 'permissions' => '\\TechWilk\\Rota\\Map\\PermissionTableMap', + 'roles' => '\\TechWilk\\Rota\\Map\\RoleTableMap', + 'settings' => '\\TechWilk\\Rota\\Map\\SettingsTableMap', + 'socialAuth' => '\\TechWilk\\Rota\\Map\\SocialAuthTableMap', + 'statistics' => '\\TechWilk\\Rota\\Map\\StatisticTableMap', + 'swaps' => '\\TechWilk\\Rota\\Map\\SwapTableMap', + 'userPermissions' => '\\TechWilk\\Rota\\Map\\UserPermissionTableMap', + 'userRoles' => '\\TechWilk\\Rota\\Map\\UserRoleTableMap', + 'users' => '\\TechWilk\\Rota\\Map\\UserTableMap', + ), + 'tablesByPhpName' => + array ( + '\\Availability' => '\\TechWilk\\Rota\\Map\\AvailabilityTableMap', + '\\CalendarToken' => '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap', + '\\Comment' => '\\TechWilk\\Rota\\Map\\CommentTableMap', + '\\Document' => '\\TechWilk\\Rota\\Map\\DocumentTableMap', + '\\Email' => '\\TechWilk\\Rota\\Map\\EmailTableMap', + '\\Event' => '\\TechWilk\\Rota\\Map\\EventTableMap', + '\\EventGroup' => '\\TechWilk\\Rota\\Map\\EventGroupTableMap', + '\\EventPerson' => '\\TechWilk\\Rota\\Map\\EventPersonTableMap', + '\\EventSubType' => '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap', + '\\EventType' => '\\TechWilk\\Rota\\Map\\EventTypeTableMap', + '\\Group' => '\\TechWilk\\Rota\\Map\\GroupTableMap', + '\\Location' => '\\TechWilk\\Rota\\Map\\LocationTableMap', + '\\LoginFailure' => '\\TechWilk\\Rota\\Map\\LoginFailureTableMap', + '\\Notification' => '\\TechWilk\\Rota\\Map\\NotificationTableMap', + '\\NotificationClick' => '\\TechWilk\\Rota\\Map\\NotificationClickTableMap', + '\\PendingUser' => '\\TechWilk\\Rota\\Map\\PendingUserTableMap', + '\\Permission' => '\\TechWilk\\Rota\\Map\\PermissionTableMap', + '\\PermissionGroup' => '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap', + '\\PermissionGroupPermission' => '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap', + '\\Role' => '\\TechWilk\\Rota\\Map\\RoleTableMap', + '\\Settings' => '\\TechWilk\\Rota\\Map\\SettingsTableMap', + '\\SocialAuth' => '\\TechWilk\\Rota\\Map\\SocialAuthTableMap', + '\\Statistic' => '\\TechWilk\\Rota\\Map\\StatisticTableMap', + '\\Swap' => '\\TechWilk\\Rota\\Map\\SwapTableMap', + '\\User' => '\\TechWilk\\Rota\\Map\\UserTableMap', + '\\UserPermission' => '\\TechWilk\\Rota\\Map\\UserPermissionTableMap', + '\\UserRole' => '\\TechWilk\\Rota\\Map\\UserRoleTableMap', + ), + ), +)); diff --git a/generated-sql/default.sql b/generated-sql/default.sql index c766b67b..0fb3653d 100644 --- a/generated-sql/default.sql +++ b/generated-sql/default.sql @@ -1,555 +1,616 @@ ------------------------------------------------------------------------ --- availability ------------------------------------------------------------------------ -DROP TABLE IF EXISTS [availability]; +# This is a fix for InnoDB in MySQL >= 4.1.x +# It "suspends judgement" for fkey relationships until are tables are set. +SET FOREIGN_KEY_CHECKS = 0; -CREATE TABLE [availability] -( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [eventId] INTEGER(30) NOT NULL, - [userId] INTEGER NOT NULL, - [available] BOOLEAN NOT NULL DEFAULT 1, - [comment] VARCHAR(64) NOT NULL, - UNIQUE ([id]), - FOREIGN KEY ([userId]) REFERENCES [users] ([id]), - FOREIGN KEY ([eventId]) REFERENCES [events] ([id]) -); - ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -- calendarTokens ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [calendarTokens]; +DROP TABLE IF EXISTS `calendarTokens`; -CREATE TABLE [calendarTokens] -( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [token] VARCHAR(30) NOT NULL, - [userId] INTEGER(30) NOT NULL, - [format] VARCHAR(5) NOT NULL, - [description] VARCHAR(100), - [revoked] INTEGER(1) DEFAULT 0 NOT NULL, - [revokedDate] TIMESTAMP, - [lastFetched] TIMESTAMP, - [created] TIMESTAMP, - [updated] TIMESTAMP, - UNIQUE ([token]), - FOREIGN KEY ([userId]) REFERENCES [users] ([id]) -); - ------------------------------------------------------------------------ --- discussion ------------------------------------------------------------------------ - -DROP TABLE IF EXISTS [discussion]; - -CREATE TABLE [discussion] +CREATE TABLE `calendarTokens` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [topicParent] INTEGER(6) DEFAULT 0 NOT NULL, - [CategoryParent] INTEGER(6) DEFAULT 0 NOT NULL, - [userID] INTEGER(6) DEFAULT 0 NOT NULL, - [topic] MEDIUMTEXT NOT NULL, - [topicName] MEDIUMTEXT NOT NULL, - [date] TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ --- discussionCategories ------------------------------------------------------------------------ - -DROP TABLE IF EXISTS [discussionCategories]; - -CREATE TABLE [discussionCategories] + `id` INTEGER NOT NULL AUTO_INCREMENT, + `token` VARCHAR(30) NOT NULL, + `userId` INTEGER(30) NOT NULL, + `format` VARCHAR(5) NOT NULL, + `description` VARCHAR(100), + `revoked` TINYINT(1) DEFAULT 0 NOT NULL, + `revokedDate` TIMESTAMP NULL, + `lastFetched` TIMESTAMP NULL, + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `token` (`token`), + INDEX `calendarTokens_fi_2596c7` (`userId`), + CONSTRAINT `calendarTokens_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- comments +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `comments`; + +CREATE TABLE `comments` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(255) DEFAULT '' NOT NULL, - [description] MEDIUMTEXT NOT NULL, - [parent] INTEGER(1) DEFAULT 0 NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `eventId` INTEGER DEFAULT 0 NOT NULL, + `userId` INTEGER DEFAULT 0 NOT NULL, + `text` VARCHAR(255), + `removed` TINYINT(1) DEFAULT 0, + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`), + INDEX `comments_fi_c07e67` (`eventId`), + INDEX `comments_fi_2596c7` (`userId`), + CONSTRAINT `comments_fk_c07e67` + FOREIGN KEY (`eventId`) + REFERENCES `events` (`id`), + CONSTRAINT `comments_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- documents ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [documents]; +DROP TABLE IF EXISTS `documents`; -CREATE TABLE [documents] +CREATE TABLE `documents` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [title] VARCHAR(127) DEFAULT '' NOT NULL, - [description] MEDIUMTEXT NOT NULL, - [url] VARCHAR(127) DEFAULT '' NOT NULL, - [link] MEDIUMTEXT NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `title` VARCHAR(127) DEFAULT '' NOT NULL, + `description` TEXT NOT NULL, + `url` VARCHAR(127) DEFAULT '' NOT NULL, + `link` TEXT NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- emails ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [emails]; +DROP TABLE IF EXISTS `emails`; -CREATE TABLE [emails] +CREATE TABLE `emails` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [emailTo] VARCHAR(100) DEFAULT '' NOT NULL, - [emailBcc] VARCHAR(100) DEFAULT '' NOT NULL, - [emailFrom] VARCHAR(100) NOT NULL, - [subject] VARCHAR(150) NOT NULL, - [message] MEDIUMTEXT NOT NULL, - [error] MEDIUMTEXT, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `emailTo` VARCHAR(100) DEFAULT '' NOT NULL, + `emailBcc` VARCHAR(100) DEFAULT '' NOT NULL, + `emailFrom` VARCHAR(100) NOT NULL, + `subject` VARCHAR(150) NOT NULL, + `message` TEXT NOT NULL, + `error` TEXT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- eventGroups ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [eventGroups]; +DROP TABLE IF EXISTS `eventGroups`; -CREATE TABLE [eventGroups] +CREATE TABLE `eventGroups` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(128) DEFAULT '' NOT NULL, - [description] MEDIUMTEXT NOT NULL, - [archived] INTEGER(1) DEFAULT 0 NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(128) DEFAULT '' NOT NULL, + `description` TEXT NOT NULL, + `archived` TINYINT(1) DEFAULT 0 NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- eventPeople ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [eventPeople]; +DROP TABLE IF EXISTS `eventPeople`; -CREATE TABLE [eventPeople] +CREATE TABLE `eventPeople` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [eventId] INTEGER DEFAULT 0 NOT NULL, - [userRoleId] INTEGER DEFAULT 0 NOT NULL, - [notified] SMALLINT(1) DEFAULT 0 NOT NULL, - [removed] SMALLINT(1) DEFAULT 0, - UNIQUE ([id]), - FOREIGN KEY ([eventId]) REFERENCES [events] ([id]), - FOREIGN KEY ([userRoleId]) REFERENCES [userRoles] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `eventId` INTEGER DEFAULT 0 NOT NULL, + `userRoleId` INTEGER DEFAULT 0 NOT NULL, + `notified` SMALLINT(1) DEFAULT 0 NOT NULL, + `removed` SMALLINT(1) DEFAULT 0, + PRIMARY KEY (`id`), + INDEX `eventPeople_fi_c07e67` (`eventId`), + INDEX `eventPeople_fi_f11fe6` (`userRoleId`), + CONSTRAINT `eventPeople_fk_c07e67` + FOREIGN KEY (`eventId`) + REFERENCES `events` (`id`), + CONSTRAINT `eventPeople_fk_f11fe6` + FOREIGN KEY (`userRoleId`) + REFERENCES `userRoles` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- eventSubTypes ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [eventSubTypes]; +DROP TABLE IF EXISTS `eventSubTypes`; -CREATE TABLE [eventSubTypes] +CREATE TABLE `eventSubTypes` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(128) DEFAULT '' NOT NULL, - [description] MEDIUMTEXT NOT NULL, - UNIQUE ([id]) -); + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(128) DEFAULT '' NOT NULL, + `description` TEXT NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -- eventTypes ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [eventTypes]; +DROP TABLE IF EXISTS `eventTypes`; -CREATE TABLE [eventTypes] +CREATE TABLE `eventTypes` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(30) NOT NULL, - [description] MEDIUMTEXT NOT NULL, - [defaultDay] INTEGER(1), - [defaultTime] TIME, - [defaultRepitition] INTEGER(3), - [defaultLocationId] INTEGER(30), - [rehearsal] INTEGER(2) DEFAULT 0 NOT NULL, - [groupformat] INTEGER(1) DEFAULT 0 NOT NULL, - UNIQUE ([id]), - FOREIGN KEY ([defaultLocationId]) REFERENCES [locations] ([id]) + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` VARCHAR(30) NOT NULL, + `description` TEXT NOT NULL, + `defaultDay` INTEGER(1), + `defaultTime` TIME, + `defaultRepitition` INTEGER(3), + `defaultLocationId` INTEGER(30), + `rehearsal` INTEGER(2) DEFAULT 0 NOT NULL, + `groupformat` INTEGER(1) DEFAULT 0 NOT NULL, + PRIMARY KEY (`id`), + INDEX `eventTypes_fi_c58e0b` (`defaultLocationId`), + CONSTRAINT `eventTypes_fk_c58e0b` + FOREIGN KEY (`defaultLocationId`) + REFERENCES `locations` (`id`) ON DELETE SET NULL -); +) ENGINE=InnoDB; ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -- events ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [events]; +DROP TABLE IF EXISTS `events`; -CREATE TABLE [events] +CREATE TABLE `events` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [date] TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - [name] MEDIUMTEXT NOT NULL, - [createdBy] INTEGER(5) DEFAULT 0 NOT NULL, - [rehearsalDate] TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - [type] INTEGER(30) DEFAULT 0 NOT NULL, - [subType] INTEGER(30) DEFAULT 0 NOT NULL, - [location] INTEGER DEFAULT 0 NOT NULL, - [notified] INTEGER(2) DEFAULT 0 NOT NULL, - [rehearsal] INTEGER DEFAULT 0 NOT NULL, - [comment] MEDIUMTEXT NOT NULL, - [removed] SMALLINT(1) DEFAULT 0, - [eventGroup] INTEGER(30) NOT NULL, - [sermonTitle] VARCHAR(64) DEFAULT '' NOT NULL, - [bibleVerse] VARCHAR(64) DEFAULT '' NOT NULL, - [created] TIMESTAMP, - [updated] TIMESTAMP, - UNIQUE ([id]), - FOREIGN KEY ([createdBy]) REFERENCES [users] ([id]), - FOREIGN KEY ([type]) REFERENCES [eventTypes] ([id]), - FOREIGN KEY ([subType]) REFERENCES [eventSubTypes] ([id]), - FOREIGN KEY ([location]) REFERENCES [locations] ([id]), - FOREIGN KEY ([eventGroup]) REFERENCES [eventGroups] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(6) NOT NULL AUTO_INCREMENT, + `date` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', + `name` TEXT NOT NULL, + `createdBy` INTEGER DEFAULT 0 NOT NULL, + `rehearsalDate` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', + `type` INTEGER(30) DEFAULT 0 NOT NULL, + `subType` INTEGER(30) DEFAULT 0 NOT NULL, + `location` INTEGER DEFAULT 0 NOT NULL, + `notified` INTEGER(2) DEFAULT 0 NOT NULL, + `rehearsal` INTEGER DEFAULT 0 NOT NULL, + `removed` SMALLINT(1) DEFAULT 0, + `eventGroup` INTEGER(30), + `sermonTitle` VARCHAR(64), + `bibleVerse` VARCHAR(64), + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`), + INDEX `events_fi_40a46e` (`createdBy`), + INDEX `events_fi_80afae` (`type`), + INDEX `events_fi_8cc9da` (`subType`), + INDEX `events_fi_fb6343` (`location`), + INDEX `events_fi_c5f971` (`eventGroup`), + CONSTRAINT `events_fk_40a46e` + FOREIGN KEY (`createdBy`) + REFERENCES `users` (`id`), + CONSTRAINT `events_fk_80afae` + FOREIGN KEY (`type`) + REFERENCES `eventTypes` (`id`), + CONSTRAINT `events_fk_8cc9da` + FOREIGN KEY (`subType`) + REFERENCES `eventSubTypes` (`id`), + CONSTRAINT `events_fk_fb6343` + FOREIGN KEY (`location`) + REFERENCES `locations` (`id`), + CONSTRAINT `events_fk_c5f971` + FOREIGN KEY (`eventGroup`) + REFERENCES `eventGroups` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- availability +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `availability`; + +CREATE TABLE `availability` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `eventId` INTEGER NOT NULL, + `userId` INTEGER NOT NULL, + `available` TINYINT(1) DEFAULT 1 NOT NULL, + `comment` VARCHAR(64), + PRIMARY KEY (`id`), + INDEX `availability_fi_2596c7` (`userId`), + INDEX `availability_fi_c07e67` (`eventId`), + CONSTRAINT `availability_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`), + CONSTRAINT `availability_fk_c07e67` + FOREIGN KEY (`eventId`) + REFERENCES `events` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- groups ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [groups]; +DROP TABLE IF EXISTS `groups`; -CREATE TABLE [groups] +CREATE TABLE `groups` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(25) DEFAULT '' NOT NULL, - [rehearsal] INTEGER(1) DEFAULT 0 NOT NULL, - [formatgroup] INTEGER(2) DEFAULT 0 NOT NULL, - [description] MEDIUMTEXT, - [allowRoleSwaps] INTEGER(1) DEFAULT 1 NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(3) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(25) DEFAULT '' NOT NULL, + `rehearsal` INTEGER(1) DEFAULT 0 NOT NULL, + `formatgroup` INTEGER(2) DEFAULT 0 NOT NULL, + `description` TEXT, + `allowRoleSwaps` TINYINT(1) DEFAULT 1 NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- locations ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [locations]; +DROP TABLE IF EXISTS `locations`; -CREATE TABLE [locations] +CREATE TABLE `locations` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] MEDIUMTEXT NOT NULL, - [address] MEDIUMTEXT, - UNIQUE ([id]) -); + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` TEXT NOT NULL, + `address` TEXT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -- notificationClicks ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [notificationClicks]; +DROP TABLE IF EXISTS `notificationClicks`; -CREATE TABLE [notificationClicks] +CREATE TABLE `notificationClicks` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [notificationId] INTEGER(30) NOT NULL, - [referer] VARCHAR(50) NOT NULL, - [timestamp] TIMESTAMP, - UNIQUE ([id]), - FOREIGN KEY ([notificationId]) REFERENCES [notifications] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `notificationId` INTEGER(30) NOT NULL, + `referer` VARCHAR(50) NOT NULL, + `timestamp` TIMESTAMP NULL, + PRIMARY KEY (`id`), + INDEX `notificationClicks_fi_1e5260` (`notificationId`), + CONSTRAINT `notificationClicks_fk_1e5260` + FOREIGN KEY (`notificationId`) + REFERENCES `notifications` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- notifications ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [notifications]; +DROP TABLE IF EXISTS `notifications`; -CREATE TABLE [notifications] +CREATE TABLE `notifications` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [timestamp] TIMESTAMP DEFAULT (datetime(CURRENT_TIMESTAMP, 'localtime')) NOT NULL, - [userId] INTEGER(30) NOT NULL, - [summary] VARCHAR(40) NOT NULL, - [body] MEDIUMTEXT NOT NULL, - [link] VARCHAR(150), - [type] INTEGER(2) NOT NULL, - [seen] INTEGER(1) DEFAULT 0 NOT NULL, - [dismissed] INTEGER(1) DEFAULT 0 NOT NULL, - [archived] INTEGER(1) DEFAULT 0 NOT NULL, - UNIQUE ([id]), - FOREIGN KEY ([userId]) REFERENCES [users] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userId` INTEGER(30) NOT NULL, + `summary` VARCHAR(40) NOT NULL, + `body` TEXT NOT NULL, + `link` VARCHAR(150), + `type` INTEGER(2) NOT NULL, + `seen` TINYINT(1) DEFAULT 0 NOT NULL, + `dismissed` TINYINT(1) DEFAULT 0 NOT NULL, + `archived` TINYINT(1) DEFAULT 0 NOT NULL, + PRIMARY KEY (`id`), + INDEX `notifications_fi_2596c7` (`userId`), + CONSTRAINT `notifications_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- pendingUsers ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [pendingUsers]; +DROP TABLE IF EXISTS `pendingUsers`; -CREATE TABLE [pendingUsers] +CREATE TABLE `pendingUsers` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [socialId] BIGINT(30), - [firstName] VARCHAR(100) NOT NULL, - [lastName] VARCHAR(100) NOT NULL, - [email] VARCHAR(100) NOT NULL, - [approved] INTEGER(1) DEFAULT 0 NOT NULL, - [declined] INTEGER(1) DEFAULT 0 NOT NULL, - [source] VARCHAR(50) NOT NULL, - UNIQUE ([socialId]), - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `socialId` BIGINT(30), + `firstName` VARCHAR(100) NOT NULL, + `lastName` VARCHAR(100) NOT NULL, + `email` VARCHAR(100) NOT NULL, + `approved` TINYINT(1) DEFAULT 0 NOT NULL, + `declined` TINYINT(1) DEFAULT 0 NOT NULL, + `source` VARCHAR(50) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `userId` (`socialId`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- roles ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [roles]; +DROP TABLE IF EXISTS `roles`; -CREATE TABLE [roles] +CREATE TABLE `roles` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [groupId] INTEGER(6) DEFAULT 0 NOT NULL, - [name] VARCHAR(15) DEFAULT '' NOT NULL, - [description] MEDIUMTEXT NOT NULL, - [rehersalId] INTEGER(6) DEFAULT 0 NOT NULL, - [allowRoleSwaps] INTEGER(1), - UNIQUE ([id]), - FOREIGN KEY ([groupId]) REFERENCES [groups] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `groupId` INTEGER(6) DEFAULT 0 NOT NULL, + `name` VARCHAR(15) DEFAULT '' NOT NULL, + `description` TEXT NOT NULL, + `rehersalId` INTEGER(6) DEFAULT 0 NOT NULL, + `allowRoleSwaps` TINYINT(1), + PRIMARY KEY (`id`), + INDEX `roles_fi_1264f9` (`groupId`), + CONSTRAINT `roles_fk_1264f9` + FOREIGN KEY (`groupId`) + REFERENCES `groups` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- settings ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [settings]; +DROP TABLE IF EXISTS `settings`; -CREATE TABLE [settings] +CREATE TABLE `settings` ( - [siteurl] MEDIUMTEXT NOT NULL, - [owner] MEDIUMTEXT NOT NULL, - [notificationemail] MEDIUMTEXT, - [adminemailaddress] MEDIUMTEXT, - [norehearsalemail] MEDIUMTEXT, - [yesrehearsal] MEDIUMTEXT, - [newusermessage] MEDIUMTEXT, - [version] VARCHAR(20), - [lang_locale] VARCHAR(20), - [event_sorting_latest] INTEGER(1), - [snapshot_show_two_month] INTEGER(1), - [snapshot_reduce_skills_by_group] INTEGER(1), - [logged_in_show_snapshot_button] INTEGER(1), - [time_format_long] VARCHAR(50), - [time_format_normal] VARCHAR(50), - [time_format_short] VARCHAR(50), - [time_only_format] VARCHAR(20), - [date_only_format] VARCHAR(20), - [day_only_format] VARCHAR(20), - [users_start_with_myevents] INTEGER(1), - [time_zone] VARCHAR(50), - [google_group_calendar] VARCHAR(100), - [overviewemail] MEDIUMTEXT, - [group_sorting_name] INTEGER(1), - [debug_mode] INTEGER(1) DEFAULT 0, - [days_to_alert] INTEGER(2) DEFAULT 5, - [token] VARCHAR(100) DEFAULT '', - [skin] VARCHAR(20) DEFAULT '' -); - ------------------------------------------------------------------------ + `siteurl` TEXT NOT NULL, + `owner` TEXT NOT NULL, + `notificationemail` TEXT, + `adminemailaddress` TEXT, + `norehearsalemail` TEXT, + `yesrehearsal` TEXT, + `newusermessage` TEXT, + `version` VARCHAR(20), + `lang_locale` VARCHAR(20), + `event_sorting_latest` INTEGER(1), + `snapshot_show_two_month` INTEGER(1), + `snapshot_reduce_skills_by_group` INTEGER(1), + `logged_in_show_snapshot_button` INTEGER(1), + `time_format_long` VARCHAR(50), + `time_format_normal` VARCHAR(50), + `time_format_short` VARCHAR(50), + `time_only_format` VARCHAR(20), + `date_only_format` VARCHAR(20), + `day_only_format` VARCHAR(20), + `users_start_with_myevents` INTEGER(1), + `time_zone` VARCHAR(50), + `google_group_calendar` VARCHAR(100), + `overviewemail` TEXT, + `group_sorting_name` INTEGER(1), + `debug_mode` INTEGER(1) DEFAULT 0, + `days_to_alert` INTEGER(2) DEFAULT 5, + `token` VARCHAR(100) DEFAULT '', + `skin` VARCHAR(20) DEFAULT '' +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- socialAuth ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [socialAuth]; +DROP TABLE IF EXISTS `socialAuth`; -CREATE TABLE [socialAuth] +CREATE TABLE `socialAuth` ( - [userId] INTEGER(30) NOT NULL, - [platform] MEDIUMTEXT NOT NULL, - [socialId] BIGINT(30) NOT NULL, - [meta] MEDIUMTEXT, - [revoked] INTEGER(1) DEFAULT 0 NOT NULL, - PRIMARY KEY ([userId], [platform], [socialId]), - UNIQUE ([socialId]), - UNIQUE ([userId]), - UNIQUE ([platform]), - FOREIGN KEY ([userId]) REFERENCES [users] ([id]) -); - ------------------------------------------------------------------------ + `userId` INTEGER(30) NOT NULL, + `platform` VARCHAR(10) NOT NULL, + `socialId` BIGINT(30) NOT NULL, + `meta` TEXT, + `revoked` TINYINT(1) DEFAULT 0 NOT NULL, + PRIMARY KEY (`userId`,`platform`,`socialId`), + UNIQUE INDEX `socialId` (`socialId`), + CONSTRAINT `socialAuth_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- statistics ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [statistics]; +DROP TABLE IF EXISTS `statistics`; -CREATE TABLE [statistics] +CREATE TABLE `statistics` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [userid] INTEGER(6) DEFAULT 0, - [date] TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - [type] MEDIUMTEXT NOT NULL, - [detail1] MEDIUMTEXT NOT NULL, - [detail2] MEDIUMTEXT NOT NULL, - [detail3] MEDIUMTEXT NOT NULL, - [script] MEDIUMTEXT NOT NULL, - UNIQUE ([id]), - FOREIGN KEY ([userid]) REFERENCES [users] ([id]) -); - ------------------------------------------------------------------------ --- subscriptions ------------------------------------------------------------------------ - -DROP TABLE IF EXISTS [subscriptions]; - -CREATE TABLE [subscriptions] -( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [userid] INTEGER(6) DEFAULT 0 NOT NULL, - [categoryid] INTEGER(4) DEFAULT 0 NOT NULL, - [topicid] INTEGER(4) DEFAULT 0 NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `userid` INTEGER(6) DEFAULT 0, + `date` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', + `type` TEXT NOT NULL, + `detail1` TEXT NOT NULL, + `detail2` TEXT NOT NULL, + `detail3` TEXT NOT NULL, + `script` TEXT NOT NULL, + PRIMARY KEY (`id`), + INDEX `statistics_fi_2596c7` (`userid`), + CONSTRAINT `statistics_fk_2596c7` + FOREIGN KEY (`userid`) + REFERENCES `users` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- swaps ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [swaps]; +DROP TABLE IF EXISTS `swaps`; -CREATE TABLE [swaps] +CREATE TABLE `swaps` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [eventPersonId] INTEGER DEFAULT 0 NOT NULL, - [oldUserRoleId] INTEGER DEFAULT 0 NOT NULL, - [newUserRoleId] INTEGER DEFAULT 0 NOT NULL, - [accepted] INTEGER(1) DEFAULT 0 NOT NULL, - [declined] INTEGER(1) DEFAULT 0 NOT NULL, - [requestedBy] INTEGER NOT NULL, - [verificationCode] VARCHAR(18) NOT NULL, - [created] TIMESTAMP, - [updated] TIMESTAMP, - UNIQUE ([id]), - FOREIGN KEY ([eventPersonId]) REFERENCES [eventPeople] ([id]), - FOREIGN KEY ([oldUserRoleId]) REFERENCES [userRoles] ([id]), - FOREIGN KEY ([newUserRoleId]) REFERENCES [userRoles] ([id]), - FOREIGN KEY ([requestedBy]) REFERENCES [users] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `eventPersonId` INTEGER DEFAULT 0 NOT NULL, + `oldUserRoleId` INTEGER DEFAULT 0 NOT NULL, + `newUserRoleId` INTEGER DEFAULT 0 NOT NULL, + `accepted` INTEGER(1) DEFAULT 0 NOT NULL, + `declined` INTEGER(1) DEFAULT 0 NOT NULL, + `requestedBy` INTEGER NOT NULL, + `verificationCode` VARCHAR(18) NOT NULL, + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`), + INDEX `swaps_fi_2e6337` (`eventPersonId`), + INDEX `swaps_fi_fd4ea7` (`oldUserRoleId`), + INDEX `swaps_fi_11ab3c` (`newUserRoleId`), + INDEX `swaps_fi_53db89` (`requestedBy`), + CONSTRAINT `swaps_fk_2e6337` + FOREIGN KEY (`eventPersonId`) + REFERENCES `eventPeople` (`id`), + CONSTRAINT `swaps_fk_fd4ea7` + FOREIGN KEY (`oldUserRoleId`) + REFERENCES `userRoles` (`id`), + CONSTRAINT `swaps_fk_11ab3c` + FOREIGN KEY (`newUserRoleId`) + REFERENCES `userRoles` (`id`), + CONSTRAINT `swaps_fk_53db89` + FOREIGN KEY (`requestedBy`) + REFERENCES `users` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- userRoles ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [userRoles]; +DROP TABLE IF EXISTS `userRoles`; -CREATE TABLE [userRoles] +CREATE TABLE `userRoles` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [userId] INTEGER(30) DEFAULT 0 NOT NULL, - [roleId] INTEGER DEFAULT 0 NOT NULL, - [reserve] INTEGER DEFAULT 0 NOT NULL, - UNIQUE ([id]), - FOREIGN KEY ([userId]) REFERENCES [users] ([id]), - FOREIGN KEY ([roleId]) REFERENCES [roles] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `userId` INTEGER(30) DEFAULT 0 NOT NULL, + `roleId` INTEGER DEFAULT 0 NOT NULL, + `reserve` TINYINT(1) DEFAULT 0 NOT NULL, + PRIMARY KEY (`id`), + INDEX `userRoles_fi_2596c7` (`userId`), + INDEX `userRoles_fi_c19afe` (`roleId`), + CONSTRAINT `userRoles_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`), + CONSTRAINT `userRoles_fk_c19afe` + FOREIGN KEY (`roleId`) + REFERENCES `roles` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- users ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [users]; +DROP TABLE IF EXISTS `users`; -CREATE TABLE [users] +CREATE TABLE `users` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [firstName] VARCHAR(30) DEFAULT '' NOT NULL, - [lastName] VARCHAR(30) DEFAULT '' NOT NULL, - [username] VARCHAR(30) DEFAULT '' NOT NULL, - [password] VARCHAR(200) DEFAULT '' NOT NULL, - [isAdmin] CHAR(2) DEFAULT '0' NOT NULL, - [email] VARCHAR(255), - [mobile] VARCHAR(15) DEFAULT '' NOT NULL, - [isOverviewRecipient] CHAR(2) DEFAULT '0' NOT NULL, - [recieveReminderEmails] INTEGER(1) DEFAULT 1 NOT NULL, - [isBandAdmin] CHAR(2) DEFAULT '0' NOT NULL, - [isEventEditor] CHAR(2) DEFAULT '0' NOT NULL, - [lastLogin] TIMESTAMP, - [passwordChanged] TIMESTAMP, - [created] TIMESTAMP, - [updated] TIMESTAMP, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `firstName` VARCHAR(30) DEFAULT '' NOT NULL, + `lastName` VARCHAR(30) DEFAULT '' NOT NULL, + `username` VARCHAR(30) DEFAULT '' NOT NULL, + `password` VARCHAR(200) DEFAULT '' NOT NULL, + `isAdmin` CHAR(2) DEFAULT '0' NOT NULL, + `email` VARCHAR(255), + `mobile` VARCHAR(15) DEFAULT '' NOT NULL, + `isOverviewRecipient` CHAR(2) DEFAULT '0' NOT NULL, + `recieveReminderEmails` TINYINT(1) DEFAULT 1 NOT NULL, + `isBandAdmin` CHAR(2) DEFAULT '0' NOT NULL, + `isEventEditor` CHAR(2) DEFAULT '0' NOT NULL, + `lastLogin` TIMESTAMP NULL, + `passwordChanged` TIMESTAMP NULL, + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- userPermissions ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [userPermissions]; +DROP TABLE IF EXISTS `userPermissions`; -CREATE TABLE [userPermissions] +CREATE TABLE `userPermissions` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [userId] INTEGER(30) DEFAULT 0 NOT NULL, - [permissionId] INTEGER DEFAULT 0 NOT NULL, - [created] TIMESTAMP, - [updated] TIMESTAMP, - UNIQUE ([id]), - FOREIGN KEY ([userId]) REFERENCES [users] ([id]), - FOREIGN KEY ([permissionId]) REFERENCES [permissions] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `userId` INTEGER(30) DEFAULT 0 NOT NULL, + `permissionId` INTEGER DEFAULT 0 NOT NULL, + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`), + INDEX `userPermissions_fi_2596c7` (`userId`), + INDEX `userPermissions_fi_5234cd` (`permissionId`), + CONSTRAINT `userPermissions_fk_2596c7` + FOREIGN KEY (`userId`) + REFERENCES `users` (`id`), + CONSTRAINT `userPermissions_fk_5234cd` + FOREIGN KEY (`permissionId`) + REFERENCES `permissions` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- permissionGroups ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [permissionGroups]; +DROP TABLE IF EXISTS `permissionGroups`; -CREATE TABLE [permissionGroups] +CREATE TABLE `permissionGroups` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(255), - [description] MEDIUMTEXT, - [created] TIMESTAMP, - [updated] TIMESTAMP, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255), + `description` TEXT, + `created` TIMESTAMP NULL, + `updated` TIMESTAMP NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- permissionGroupPermissions ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [permissionGroupPermissions]; +DROP TABLE IF EXISTS `permissionGroupPermissions`; -CREATE TABLE [permissionGroupPermissions] +CREATE TABLE `permissionGroupPermissions` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [permissionId] INTEGER(30) DEFAULT 0 NOT NULL, - [permissionGroupId] INTEGER DEFAULT 0 NOT NULL, - UNIQUE ([id]), - FOREIGN KEY ([permissionId]) REFERENCES [permissions] ([id]), - FOREIGN KEY ([permissionGroupId]) REFERENCES [permissionGroups] ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER NOT NULL AUTO_INCREMENT, + `permissionId` INTEGER(30) DEFAULT 0 NOT NULL, + `permissionGroupId` INTEGER DEFAULT 0 NOT NULL, + PRIMARY KEY (`id`), + INDEX `permissionGroupPermissions_fi_5234cd` (`permissionId`), + INDEX `permissionGroupPermissions_fi_32d04a` (`permissionGroupId`), + CONSTRAINT `permissionGroupPermissions_fk_5234cd` + FOREIGN KEY (`permissionId`) + REFERENCES `permissions` (`id`), + CONSTRAINT `permissionGroupPermissions_fk_32d04a` + FOREIGN KEY (`permissionGroupId`) + REFERENCES `permissionGroups` (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- permissions ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [permissions]; +DROP TABLE IF EXISTS `permissions`; -CREATE TABLE [permissions] +CREATE TABLE `permissions` ( - [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - [name] VARCHAR(255), - [description] MEDIUMTEXT, - [slug] VARCHAR(10) NOT NULL, - UNIQUE ([id]) -); - ------------------------------------------------------------------------ + `id` INTEGER(30) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255), + `description` TEXT, + `slug` VARCHAR(10) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- -- loginFailures ------------------------------------------------------------------------ +-- --------------------------------------------------------------------- -DROP TABLE IF EXISTS [loginFailures]; +DROP TABLE IF EXISTS `loginFailures`; -CREATE TABLE [loginFailures] +CREATE TABLE `loginFailures` ( - [username] VARCHAR(30) NOT NULL, - [ipAddress] VARCHAR(15) NOT NULL, - [timestamp] TIMESTAMP DEFAULT (datetime(CURRENT_TIMESTAMP, 'localtime')) NOT NULL -); + `username` VARCHAR(30) NOT NULL, + `ipAddress` VARCHAR(15) NOT NULL, + `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB; + +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; diff --git a/tests/Integration/BaseTestCase.php b/tests/Integration/BaseTestCase.php index 5e80c49d..66ce4144 100644 --- a/tests/Integration/BaseTestCase.php +++ b/tests/Integration/BaseTestCase.php @@ -121,9 +121,9 @@ protected function loadDatabase() * Propel ORM config. */ $serviceContainer = Propel::getServiceContainer(); - $serviceContainer->checkVersion('2.0.0-dev'); + $serviceContainer->checkVersion(2); $serviceContainer->setAdapterClass('default', 'sqlite'); - $manager = new ConnectionManagerSingle(); + $manager = new ConnectionManagerSingle('default'); $manager->setConfiguration([ 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', 'dsn' => 'sqlite:/var/tmp/test.db', @@ -137,7 +137,7 @@ protected function loadDatabase() ], ]); $manager->setName('default'); - $serviceContainer->setConnectionManager('default', $manager); + $serviceContainer->setConnectionManager($manager); $serviceContainer->setDefaultDatasource('default'); // delete test db (if exists) and create a new one From 26167cdc277833b04da342751305abca4b7e458a Mon Sep 17 00:00:00 2001 From: Christopher Wilkinson Date: Thu, 27 Feb 2025 20:54:38 +0000 Subject: [PATCH 4/6] Update test class syntax --- config/auth.default.php | 2 ++ config/database.default.php | 2 ++ config/email.default.php | 2 ++ config/recording.default.php | 2 ++ tests/Integration/DashboardTest.php | 4 ++-- tests/Integration/InstallationTest.php | 2 +- tests/Integration/LoginLogoutTest.php | 2 +- tests/Integration/RolePagesTest.php | 4 ++-- tests/Integration/UserPagesTest.php | 4 ++-- tests/Unit/BaseTestCase.php | 6 +++--- tests/Unit/CryptTest.php | 3 ++- tests/Unit/EmailAddressTest.php | 5 ++--- 12 files changed, 23 insertions(+), 15 deletions(-) diff --git a/config/auth.default.php b/config/auth.default.php index 5845fe9b..c1cc5cb3 100644 --- a/config/auth.default.php +++ b/config/auth.default.php @@ -1,5 +1,7 @@ setEmail('test@example.com'); @@ -24,7 +24,7 @@ public static function setUpBeforeClass() /** * Logout user is after tests run. */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { unset($_SESSION['userId']); } diff --git a/tests/Integration/InstallationTest.php b/tests/Integration/InstallationTest.php index 1bbeaca5..df96a06b 100644 --- a/tests/Integration/InstallationTest.php +++ b/tests/Integration/InstallationTest.php @@ -12,7 +12,7 @@ class InstallationTest extends BaseTestCase /** * Ensure database is empty. */ - public function setUp() + public function setUp(): void { $users = UserQuery::create()->find(); if (!empty($users)) { diff --git a/tests/Integration/LoginLogoutTest.php b/tests/Integration/LoginLogoutTest.php index ca4f6f82..74d1052f 100644 --- a/tests/Integration/LoginLogoutTest.php +++ b/tests/Integration/LoginLogoutTest.php @@ -9,7 +9,7 @@ class LoginLogoutTest extends BaseTestCase /** * Create an admin user. */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { $user = new User(); $user->setEmail('test@example.com'); diff --git a/tests/Integration/RolePagesTest.php b/tests/Integration/RolePagesTest.php index f462c022..59bd55bf 100644 --- a/tests/Integration/RolePagesTest.php +++ b/tests/Integration/RolePagesTest.php @@ -13,7 +13,7 @@ class RolePagesTest extends BaseTestCase /** * Ensure user is logged in before tests run. */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { $user = new User(); $user->setEmail('test@example.com'); @@ -52,7 +52,7 @@ public static function setUpBeforeClass() /** * Logout user is after tests run. */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { unset($_SESSION['userId']); } diff --git a/tests/Integration/UserPagesTest.php b/tests/Integration/UserPagesTest.php index 68e384fe..1674cffb 100644 --- a/tests/Integration/UserPagesTest.php +++ b/tests/Integration/UserPagesTest.php @@ -13,7 +13,7 @@ class UserPagesTest extends BaseTestCase /** * Ensure user is logged in before tests run. */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { $user = new User(); $user->setEmail('test@example.com'); @@ -52,7 +52,7 @@ public static function setUpBeforeClass() /** * Logout user is after tests run. */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { unset($_SESSION['userId']); } diff --git a/tests/Unit/BaseTestCase.php b/tests/Unit/BaseTestCase.php index 73afcf5d..52fafb9b 100644 --- a/tests/Unit/BaseTestCase.php +++ b/tests/Unit/BaseTestCase.php @@ -14,9 +14,9 @@ * Propel ORM config. */ $serviceContainer = \Propel\Runtime\Propel::getServiceContainer(); -$serviceContainer->checkVersion('2.0.0-dev'); +$serviceContainer->checkVersion(2); $serviceContainer->setAdapterClass('default', 'sqlite'); -$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); +$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle('default'); $manager->setConfiguration([ 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', 'dsn' => 'sqlite:/var/tmp/test.db', @@ -30,7 +30,7 @@ ], ]); $manager->setName('default'); -$serviceContainer->setConnectionManager('default', $manager); +$serviceContainer->setConnectionManager($manager); $serviceContainer->setDefaultDatasource('default'); $sqlManager = new \Propel\Generator\Manager\SqlManager(); diff --git a/tests/Unit/CryptTest.php b/tests/Unit/CryptTest.php index 129060aa..31322599 100644 --- a/tests/Unit/CryptTest.php +++ b/tests/Unit/CryptTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit; +use InvalidArgumentException; use TechWilk\Rota\Crypt; class CryptTest extends BaseTestCase @@ -74,12 +75,12 @@ public function providerTestGenerateIntInvalidConstraints() /** * @param string $min * @param string $max - * @expectedException InvalidArgumentException * * @dataProvider providerTestGenerateIntInvalidConstraints */ public function testGenerateIntInvalidConstraints($min, $max) { + $this->expectException(InvalidArgumentException::class); $crypt = new Crypt(); $crypt->generateInt($min, $max); } diff --git a/tests/Unit/EmailAddressTest.php b/tests/Unit/EmailAddressTest.php index 521d8b9c..5e7c9571 100644 --- a/tests/Unit/EmailAddressTest.php +++ b/tests/Unit/EmailAddressTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit; +use InvalidArgumentException; use TechWilk\Rota\EmailAddress; class EmailAddressTest extends BaseTestCase @@ -37,14 +38,12 @@ public function providerTestInvalidEmails() /** * @param string $email - * @expectedException InvalidArgumentException * * @dataProvider providerTestInvalidEmails */ public function testInvalidEmails($email) { + $this->expectException(InvalidArgumentException::class); $emailObject = new EmailAddress($email); - - //$this->assertNotEqual((string)$emailObject, $email); } } From 481f3d1fdf5beeb43f0247c87d04e547d31c0c9c Mon Sep 17 00:00:00 2001 From: Christopher Wilkinson Date: Thu, 27 Feb 2025 20:55:12 +0000 Subject: [PATCH 5/6] Fix installation steps with latest propel update --- src/classes/Controller/InstallController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/classes/Controller/InstallController.php b/src/classes/Controller/InstallController.php index d4671d0d..1d1706e5 100644 --- a/src/classes/Controller/InstallController.php +++ b/src/classes/Controller/InstallController.php @@ -4,6 +4,7 @@ use Locale; use Propel\Generator\Application; +use Propel\Runtime\ActiveQuery\QueryExecutor\QueryExecutionException; use Propel\Runtime\Propel; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -41,6 +42,7 @@ public function getInstall(ServerRequestInterface $request, ResponseInterface $r } $stage = 3; } catch (\Propel\Runtime\Exception\PropelException $e) { + } catch (QueryExecutionException $e) { } return $this->view->render($response, 'install.twig', ['stage' => $stage]); @@ -61,8 +63,8 @@ public function getInstallDatabase(ServerRequestInterface $request, ResponseInte if ($e->getPrevious()->getCode() !== '42S02') { return $response; } + } catch (QueryExecutionException $e) { } - $site = new Site(); $config = $site->getConfig(); @@ -101,6 +103,8 @@ public function getInstallDatabase(ServerRequestInterface $request, ResponseInte if ($e->getPrevious()->getCode() === '42S02') { return $response->getBody()->write('Error installing database:'."\n".$outputString); } + } catch (QueryExecutionException $e) { + return $response->getBody()->write('Error installing database:'."\n".$outputString); } return $response->withStatus(302)->withHeader('Location', $this->router->pathFor('install')); From 381d9ca25abe80e582c09019d13e62a42416e57a Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 27 Feb 2025 20:55:33 +0000 Subject: [PATCH 6/6] Apply fixes from StyleCI --- generated-classes/TechWilk/Rota/User.php | 8 +- generated-conf/config.php | 46 +++---- generated-conf/loadDatabase.php | 128 +++++++++--------- .../PropelMigration_1494860053.php | 8 +- public/api/v1/index.php | 89 ++++++------ public/old/email.php | 16 +-- public/old/emails.php | 6 +- public/old/includes/config.php | 4 +- public/old/includes/functions.auth.php | 8 +- public/old/includes/functions.calendars.php | 6 +- public/old/includes/functions.database.php | 19 +-- public/old/includes/functions.discussion.php | 4 +- public/old/includes/functions.event.php | 39 +++--- public/old/includes/functions.facebook.php | 12 +- public/old/includes/functions.mail.php | 87 ++++++------ .../old/includes/functions.notifications.php | 34 ++--- public/old/includes/functions.php | 7 +- public/old/includes/functions.remove.php | 30 ++-- public/old/includes/functions.roles.php | 24 ++-- public/old/includes/functions.users.php | 66 ++++----- public/old/recordingUpload.php | 17 +-- .../UsernamePasswordInterface.php | 2 +- src/classes/AuthProviderInterface.php | 4 +- src/classes/Authentication.php | 6 +- src/classes/Authorisation.php | 3 +- src/classes/Controller/InstallController.php | 5 +- .../Controller/PendingUserController.php | 2 +- tests/Integration/BaseTestCase.php | 26 ++-- tests/Unit/BaseTestCase.php | 26 ++-- tests/Unit/CryptTest.php | 40 +++--- tests/Unit/EmailAddressTest.php | 14 +- 31 files changed, 392 insertions(+), 394 deletions(-) diff --git a/generated-classes/TechWilk/Rota/User.php b/generated-classes/TechWilk/Rota/User.php index 8ec997a8..53e9e1b6 100644 --- a/generated-classes/TechWilk/Rota/User.php +++ b/generated-classes/TechWilk/Rota/User.php @@ -70,8 +70,8 @@ public function setPassword($v) if (!password_verify($v, $this->password)) { $bcrypt_options = [ - 'cost' => 12, - ]; + 'cost' => 12, + ]; $this->password = password_hash($v, PASSWORD_BCRYPT, $bcrypt_options); $this->modifiedColumns[UserTableMap::COL_PASSWORD] = true; @@ -165,7 +165,7 @@ public function getProfileImage($size) break; default: return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/tn/'.$photoFingerprint.'.'.$extension; - break; + break; } } } @@ -183,7 +183,7 @@ public function getProfileImage($size) break; default: return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=50&d=mm'; - break; + break; } } diff --git a/generated-conf/config.php b/generated-conf/config.php index c298c65f..58e22eec 100644 --- a/generated-conf/config.php +++ b/generated-conf/config.php @@ -7,18 +7,18 @@ $serviceContainer->setAdapterClass('default', 'mysql'); $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle('default'); $manager->setConfiguration([ - 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', - 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], - 'user' => $config['db']['user'], - 'password' => $config['db']['pass'], - 'attributes' => [ - 'ATTR_EMULATE_PREPARES' => false, - 'ATTR_TIMEOUT' => 30, - ], - 'model_paths' => [ - 0 => 'src', - 1 => 'vendor', - ], + 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', + 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], + 'user' => $config['db']['user'], + 'password' => $config['db']['pass'], + 'attributes' => [ + 'ATTR_EMULATE_PREPARES' => false, + 'ATTR_TIMEOUT' => 30, + ], + 'model_paths' => [ + 0 => 'src', + 1 => 'vendor', + ], ]); $manager->setName('default'); $serviceContainer->setConnectionManager($manager); @@ -26,18 +26,18 @@ $serviceContainer->setAdapterClass('test', 'sqlite'); $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle('test'); $manager->setConfiguration([ - 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', - 'dsn' => 'sqlite:/var/tmp/test.db', - 'attributes' => [ - 'ATTR_EMULATE_PREPARES' => false, - 'ATTR_TIMEOUT' => 30, - ], - 'model_paths' => [ - 0 => 'src', - 1 => 'vendor', - ], + 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', + 'dsn' => 'sqlite:/var/tmp/test.db', + 'attributes' => [ + 'ATTR_EMULATE_PREPARES' => false, + 'ATTR_TIMEOUT' => 30, + ], + 'model_paths' => [ + 0 => 'src', + 1 => 'vendor', + ], ]); $serviceContainer->setConnectionManager($manager); $serviceContainer->setDefaultDatasource('default'); -require_once __DIR__ . '/./loadDatabase.php'; +require_once __DIR__.'/./loadDatabase.php'; diff --git a/generated-conf/loadDatabase.php b/generated-conf/loadDatabase.php index ad980881..b308d019 100644 --- a/generated-conf/loadDatabase.php +++ b/generated-conf/loadDatabase.php @@ -1,67 +1,65 @@ initDatabaseMapFromDumps(array ( - 'default' => - array ( - 'tablesByName' => - array ( - 'availability' => '\\TechWilk\\Rota\\Map\\AvailabilityTableMap', - 'calendarTokens' => '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap', - 'comments' => '\\TechWilk\\Rota\\Map\\CommentTableMap', - 'documents' => '\\TechWilk\\Rota\\Map\\DocumentTableMap', - 'emails' => '\\TechWilk\\Rota\\Map\\EmailTableMap', - 'eventGroups' => '\\TechWilk\\Rota\\Map\\EventGroupTableMap', - 'eventPeople' => '\\TechWilk\\Rota\\Map\\EventPersonTableMap', - 'eventSubTypes' => '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap', - 'eventTypes' => '\\TechWilk\\Rota\\Map\\EventTypeTableMap', - 'events' => '\\TechWilk\\Rota\\Map\\EventTableMap', - 'groups' => '\\TechWilk\\Rota\\Map\\GroupTableMap', - 'locations' => '\\TechWilk\\Rota\\Map\\LocationTableMap', - 'loginFailures' => '\\TechWilk\\Rota\\Map\\LoginFailureTableMap', - 'notificationClicks' => '\\TechWilk\\Rota\\Map\\NotificationClickTableMap', - 'notifications' => '\\TechWilk\\Rota\\Map\\NotificationTableMap', - 'pendingUsers' => '\\TechWilk\\Rota\\Map\\PendingUserTableMap', - 'permissionGroupPermissions' => '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap', - 'permissionGroups' => '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap', - 'permissions' => '\\TechWilk\\Rota\\Map\\PermissionTableMap', - 'roles' => '\\TechWilk\\Rota\\Map\\RoleTableMap', - 'settings' => '\\TechWilk\\Rota\\Map\\SettingsTableMap', - 'socialAuth' => '\\TechWilk\\Rota\\Map\\SocialAuthTableMap', - 'statistics' => '\\TechWilk\\Rota\\Map\\StatisticTableMap', - 'swaps' => '\\TechWilk\\Rota\\Map\\SwapTableMap', - 'userPermissions' => '\\TechWilk\\Rota\\Map\\UserPermissionTableMap', - 'userRoles' => '\\TechWilk\\Rota\\Map\\UserRoleTableMap', - 'users' => '\\TechWilk\\Rota\\Map\\UserTableMap', - ), - 'tablesByPhpName' => - array ( - '\\Availability' => '\\TechWilk\\Rota\\Map\\AvailabilityTableMap', - '\\CalendarToken' => '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap', - '\\Comment' => '\\TechWilk\\Rota\\Map\\CommentTableMap', - '\\Document' => '\\TechWilk\\Rota\\Map\\DocumentTableMap', - '\\Email' => '\\TechWilk\\Rota\\Map\\EmailTableMap', - '\\Event' => '\\TechWilk\\Rota\\Map\\EventTableMap', - '\\EventGroup' => '\\TechWilk\\Rota\\Map\\EventGroupTableMap', - '\\EventPerson' => '\\TechWilk\\Rota\\Map\\EventPersonTableMap', - '\\EventSubType' => '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap', - '\\EventType' => '\\TechWilk\\Rota\\Map\\EventTypeTableMap', - '\\Group' => '\\TechWilk\\Rota\\Map\\GroupTableMap', - '\\Location' => '\\TechWilk\\Rota\\Map\\LocationTableMap', - '\\LoginFailure' => '\\TechWilk\\Rota\\Map\\LoginFailureTableMap', - '\\Notification' => '\\TechWilk\\Rota\\Map\\NotificationTableMap', - '\\NotificationClick' => '\\TechWilk\\Rota\\Map\\NotificationClickTableMap', - '\\PendingUser' => '\\TechWilk\\Rota\\Map\\PendingUserTableMap', - '\\Permission' => '\\TechWilk\\Rota\\Map\\PermissionTableMap', - '\\PermissionGroup' => '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap', - '\\PermissionGroupPermission' => '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap', - '\\Role' => '\\TechWilk\\Rota\\Map\\RoleTableMap', - '\\Settings' => '\\TechWilk\\Rota\\Map\\SettingsTableMap', - '\\SocialAuth' => '\\TechWilk\\Rota\\Map\\SocialAuthTableMap', - '\\Statistic' => '\\TechWilk\\Rota\\Map\\StatisticTableMap', - '\\Swap' => '\\TechWilk\\Rota\\Map\\SwapTableMap', - '\\User' => '\\TechWilk\\Rota\\Map\\UserTableMap', - '\\UserPermission' => '\\TechWilk\\Rota\\Map\\UserPermissionTableMap', - '\\UserRole' => '\\TechWilk\\Rota\\Map\\UserRoleTableMap', - ), - ), -)); +$serviceContainer->initDatabaseMapFromDumps([ + 'default' => [ + 'tablesByName' => [ + 'availability' => '\\TechWilk\\Rota\\Map\\AvailabilityTableMap', + 'calendarTokens' => '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap', + 'comments' => '\\TechWilk\\Rota\\Map\\CommentTableMap', + 'documents' => '\\TechWilk\\Rota\\Map\\DocumentTableMap', + 'emails' => '\\TechWilk\\Rota\\Map\\EmailTableMap', + 'eventGroups' => '\\TechWilk\\Rota\\Map\\EventGroupTableMap', + 'eventPeople' => '\\TechWilk\\Rota\\Map\\EventPersonTableMap', + 'eventSubTypes' => '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap', + 'eventTypes' => '\\TechWilk\\Rota\\Map\\EventTypeTableMap', + 'events' => '\\TechWilk\\Rota\\Map\\EventTableMap', + 'groups' => '\\TechWilk\\Rota\\Map\\GroupTableMap', + 'locations' => '\\TechWilk\\Rota\\Map\\LocationTableMap', + 'loginFailures' => '\\TechWilk\\Rota\\Map\\LoginFailureTableMap', + 'notificationClicks' => '\\TechWilk\\Rota\\Map\\NotificationClickTableMap', + 'notifications' => '\\TechWilk\\Rota\\Map\\NotificationTableMap', + 'pendingUsers' => '\\TechWilk\\Rota\\Map\\PendingUserTableMap', + 'permissionGroupPermissions' => '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap', + 'permissionGroups' => '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap', + 'permissions' => '\\TechWilk\\Rota\\Map\\PermissionTableMap', + 'roles' => '\\TechWilk\\Rota\\Map\\RoleTableMap', + 'settings' => '\\TechWilk\\Rota\\Map\\SettingsTableMap', + 'socialAuth' => '\\TechWilk\\Rota\\Map\\SocialAuthTableMap', + 'statistics' => '\\TechWilk\\Rota\\Map\\StatisticTableMap', + 'swaps' => '\\TechWilk\\Rota\\Map\\SwapTableMap', + 'userPermissions' => '\\TechWilk\\Rota\\Map\\UserPermissionTableMap', + 'userRoles' => '\\TechWilk\\Rota\\Map\\UserRoleTableMap', + 'users' => '\\TechWilk\\Rota\\Map\\UserTableMap', + ], + 'tablesByPhpName' => [ + '\\Availability' => '\\TechWilk\\Rota\\Map\\AvailabilityTableMap', + '\\CalendarToken' => '\\TechWilk\\Rota\\Map\\CalendarTokenTableMap', + '\\Comment' => '\\TechWilk\\Rota\\Map\\CommentTableMap', + '\\Document' => '\\TechWilk\\Rota\\Map\\DocumentTableMap', + '\\Email' => '\\TechWilk\\Rota\\Map\\EmailTableMap', + '\\Event' => '\\TechWilk\\Rota\\Map\\EventTableMap', + '\\EventGroup' => '\\TechWilk\\Rota\\Map\\EventGroupTableMap', + '\\EventPerson' => '\\TechWilk\\Rota\\Map\\EventPersonTableMap', + '\\EventSubType' => '\\TechWilk\\Rota\\Map\\EventSubTypeTableMap', + '\\EventType' => '\\TechWilk\\Rota\\Map\\EventTypeTableMap', + '\\Group' => '\\TechWilk\\Rota\\Map\\GroupTableMap', + '\\Location' => '\\TechWilk\\Rota\\Map\\LocationTableMap', + '\\LoginFailure' => '\\TechWilk\\Rota\\Map\\LoginFailureTableMap', + '\\Notification' => '\\TechWilk\\Rota\\Map\\NotificationTableMap', + '\\NotificationClick' => '\\TechWilk\\Rota\\Map\\NotificationClickTableMap', + '\\PendingUser' => '\\TechWilk\\Rota\\Map\\PendingUserTableMap', + '\\Permission' => '\\TechWilk\\Rota\\Map\\PermissionTableMap', + '\\PermissionGroup' => '\\TechWilk\\Rota\\Map\\PermissionGroupTableMap', + '\\PermissionGroupPermission' => '\\TechWilk\\Rota\\Map\\PermissionGroupPermissionTableMap', + '\\Role' => '\\TechWilk\\Rota\\Map\\RoleTableMap', + '\\Settings' => '\\TechWilk\\Rota\\Map\\SettingsTableMap', + '\\SocialAuth' => '\\TechWilk\\Rota\\Map\\SocialAuthTableMap', + '\\Statistic' => '\\TechWilk\\Rota\\Map\\StatisticTableMap', + '\\Swap' => '\\TechWilk\\Rota\\Map\\SwapTableMap', + '\\User' => '\\TechWilk\\Rota\\Map\\UserTableMap', + '\\UserPermission' => '\\TechWilk\\Rota\\Map\\UserPermissionTableMap', + '\\UserRole' => '\\TechWilk\\Rota\\Map\\UserRoleTableMap', + ], + ], +]); diff --git a/generated-migrations/PropelMigration_1494860053.php b/generated-migrations/PropelMigration_1494860053.php index 468dd151..9bfeb5cc 100644 --- a/generated-migrations/PropelMigration_1494860053.php +++ b/generated-migrations/PropelMigration_1494860053.php @@ -40,7 +40,7 @@ public function postDown(MigrationManager $manager) public function getUpSQL() { return [ - 'default' => ' + 'default' => ' # This is a fix for InnoDB in MySQL >= 4.1.x # It "suspends judgement" for fkey relationships until are tables are set. SET FOREIGN_KEY_CHECKS = 0; @@ -160,7 +160,7 @@ public function getUpSQL() # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; ', -]; + ]; } /** @@ -172,7 +172,7 @@ public function getUpSQL() public function getDownSQL() { return [ - 'default' => ' + 'default' => ' # This is a fix for InnoDB in MySQL >= 4.1.x # It "suspends judgement" for fkey relationships until are tables are set. SET FOREIGN_KEY_CHECKS = 0; @@ -270,6 +270,6 @@ public function getDownSQL() # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; ', -]; + ]; } } diff --git a/public/api/v1/index.php b/public/api/v1/index.php index 5fe8861e..32dbd166 100644 --- a/public/api/v1/index.php +++ b/public/api/v1/index.php @@ -17,68 +17,65 @@ function isAdmin() } } -if (isAdmin()): +if (isAdmin()) { + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Start of API + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Start of API -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -require_once __DIR__.'/../../../vendor/autoload.php'; + require_once __DIR__.'/../../../vendor/autoload.php'; -require_once __DIR__.'/../../../generated-conf/config.php'; + require_once __DIR__.'/../../../generated-conf/config.php'; -// Create and configure Slim app -$app = new \Slim\App(['settings' => $config]); + // Create and configure Slim app + $app = new \Slim\App(['settings' => $config]); -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Containers for DI -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Containers for DI + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -$container = $app->getContainer(); + $container = $app->getContainer(); -$container['db'] = function ($c) { - $db_config = $c['settings']['db']; - $db = new Database($db_config); + $container['db'] = function ($c) { + $db_config = $c['settings']['db']; + $db = new Database($db_config); - return $db; -}; + return $db; + }; -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Define app routes -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Define app routes + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// ~~~~~~~~~~~~~~~ Series ~~~~~~~~~~~~~~~ + // ~~~~~~~~~~~~~~~ Series ~~~~~~~~~~~~~~~ -$app->post('/series', function ($request, $response, $args) { - $postData = $request->getParsedBody(); + $app->post('/series', function ($request, $response, $args) { + $postData = $request->getParsedBody(); - $name = filter_var($postData['name'], FILTER_SANITIZE_STRING); - $description = filter_var($postData['description'], FILTER_SANITIZE_STRING); + $name = filter_var($postData['name'], FILTER_SANITIZE_STRING); + $description = filter_var($postData['description'], FILTER_SANITIZE_STRING); - $series = new EventGroup(); - $series->setName($name); - $series->setDescription($description); - $series->save(); + $series = new EventGroup(); + $series->setName($name); + $series->setDescription($description); + $series->save(); - $data = [ - 'data' => [ - 'id' => $series->getId(), - 'name' => $series->getName(), - 'description' => $series->getDescription(), - ], - ]; + $data = [ + 'data' => [ + 'id' => $series->getId(), + 'name' => $series->getName(), + 'description' => $series->getDescription(), + ], + ]; - return $response->withJson($data); -}); + return $response->withJson($data); + }); -// Run app -$app->run(); + // Run app + $app->run(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // End of very very very basic auth // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -else: -http_response_code(401); - -endif; +} else { + http_response_code(401); +} diff --git a/public/old/email.php b/public/old/email.php index 81b8643d..d584c79c 100644 --- a/public/old/email.php +++ b/public/old/email.php @@ -44,15 +44,15 @@ switch ($action) { case 'individual': - if ($userRoleId && $eventId) { - echo '

Function not complete, please wait while we finish writing it.

Apologies for any inconvinence.

'; - } + if ($userRoleId && $eventId) { + echo '

Function not complete, please wait while we finish writing it.

Apologies for any inconvinence.

'; + } break; case 'everyone': - echo '

Function not complete, please wait while we finish writing it.

Apologies for any inconvinence.

'; + echo '

Function not complete, please wait while we finish writing it.

Apologies for any inconvinence.

'; + break; + default: + echo '

Error: Insufficient parameters.

'; + echo '

Please inform the system administrator

'; break; - default: - echo '

Error: Insufficient parameters.

'; - echo '

Please inform the system administrator

'; - break; } diff --git a/public/old/emails.php b/public/old/emails.php index d8c8b5af..eefc1cf4 100755 --- a/public/old/emails.php +++ b/public/old/emails.php @@ -71,7 +71,7 @@ if ($editskillID != '') { $sql = ("INSERT INTO eventPeople (eventID, skillID) VALUES ('$editeventID', '$editskillID')"); if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } // After we have inserted the data, we want to head back to the main page @@ -81,14 +81,14 @@ if ($editbandID != '') { $sqlbandMembers = "SELECT * FROM bandMembers WHERE bandID = '$editbandID'"; - $resultbandMembers = mysqli_query(db(), $sqlbandMembers) or die(mysqli_error(db())); + $resultbandMembers = mysqli_query(db(), $sqlbandMembers) or exit(mysqli_error(db())); while ($bandMember = mysqli_fetch_array($resultbandMembers, MYSQLI_ASSOC)) { $editskillID = $bandMember['skillID']; $sql = ("INSERT INTO eventPeople (eventID, skillID) VALUES ('$editeventID', '$editskillID')"); if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } diff --git a/public/old/includes/config.php b/public/old/includes/config.php index b9efcc93..b217b2e4 100644 --- a/public/old/includes/config.php +++ b/public/old/includes/config.php @@ -17,10 +17,10 @@ } // Connect to the database server -$dbh = @mysqli_connect($config['db']['host'], $config['db']['user'], $config['db']['pass']) or die('Connection to '.$config['db']['host']." with login '".$config['db']['user']."'/'$pwdMasked' failed."); +$dbh = @mysqli_connect($config['db']['host'], $config['db']['user'], $config['db']['pass']) or exit('Connection to '.$config['db']['host']." with login '".$config['db']['user']."'/'$pwdMasked' failed."); // Choose the right database -$db = @mysqli_select_db($dbh, $config['db']['dbname']) or die("Connection made, but database '".$config['db']['dbname']."' was not found."); +$db = @mysqli_select_db($dbh, $config['db']['dbname']) or exit("Connection made, but database '".$config['db']['dbname']."' was not found."); // allow config to be fetched in functions diff --git a/public/old/includes/functions.auth.php b/public/old/includes/functions.auth.php index 883167b1..49ac990e 100644 --- a/public/old/includes/functions.auth.php +++ b/public/old/includes/functions.auth.php @@ -11,7 +11,7 @@ function setSessionAndRedirect($username) } $sql = "SELECT * FROM users WHERE username = '$username'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $_SESSION['db_is_logged_in'] = true; @@ -23,7 +23,7 @@ function setSessionAndRedirect($username) $_SESSION['onlyShowUserEvents'] = $users_start_with_myevents; // 1 if users_start_with_myevents is set in settings, can be changed by user during session //statistic - if (($debug) && (siteSettings()->getVersion() == '2.6.0')) { + if ($debug && (siteSettings()->getVersion() == '2.6.0')) { insertStatistics('user', __FILE__, 'login', null, $_SERVER['HTTP_USER_AGENT']); } @@ -36,7 +36,7 @@ function setSessionAndRedirect($username) // Update last login timestamp $currentTimestamp = date('Y-m-d H:i:s'); $sql = "UPDATE users SET lastLogin = '$currentTimestamp' WHERE id = '".$row['id']."'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); // redirect $redirectUrl = 'index.php'; @@ -44,7 +44,7 @@ function setSessionAndRedirect($username) $redirectFromSession = strip_tags($_SESSION['redirectUrl']); unset($_SESSION['redirectUrl']); // check is url is on same domain and prevents redirecting to logout page - if (strncmp(strtolower(siteSettings()->getSiteUrl().'/'), strtolower($redirectFromSession), (strlen(siteSettings()->getSiteUrl()) + 1)) == 0 && strpos($redirectFromSession, 'logout.php') === false) { + if (strncmp(strtolower(siteSettings()->getSiteUrl().'/'), strtolower($redirectFromSession), strlen(siteSettings()->getSiteUrl()) + 1) == 0 && strpos($redirectFromSession, 'logout.php') === false) { $redirectUrl = $redirectFromSession; } } diff --git a/public/old/includes/functions.calendars.php b/public/old/includes/functions.calendars.php index b61e1171..9aa3e7ee 100644 --- a/public/old/includes/functions.calendars.php +++ b/public/old/includes/functions.calendars.php @@ -14,7 +14,7 @@ function createCalendarToken($userId, $format, $description) if (mysqli_query(db(), $sql)) { return $token; } else { - die(mysqli_error(db())); + exit(mysqli_error(db())); return; } @@ -27,7 +27,7 @@ function checkCalendarToken($userId, $format, $token) $token = mysqli_real_escape_string(db(), $token); $sql = "SELECT COUNT(*) AS count FROM calendarTokens WHERE userId = $userId AND format = '$format' AND token = '$token' AND revoked = false"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->count == 1) { @@ -54,7 +54,7 @@ function calendarTokensForUser($userId) $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT id, format, description, created, revoked FROM calendarTokens WHERE userId = $userId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($ob = mysqli_fetch_object($result)) { $calendars[] = $ob; } diff --git a/public/old/includes/functions.database.php b/public/old/includes/functions.database.php index 3569471d..9ef12782 100755 --- a/public/old/includes/functions.database.php +++ b/public/old/includes/functions.database.php @@ -24,25 +24,25 @@ function executeDbSql($sql) { if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db()).', SQL: '.$sql); + exit('Error: '.mysqli_error(db()).', SQL: '.$sql); } } function updateDatabase() { $sql = 'SELECT VERSION( ) AS mysqli_version'; - $result = mysqli_query(db(), $sql) or die('MySQL-Error: '.mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit('MySQL-Error: '.mysqli_error(db())); $dbv = mysqli_fetch_array($result, MYSQLI_ASSOC); $mysqli_version = $dbv['mysqli_version']; //echo $mysqli_version."
"; $sql = "SHOW COLUMNS from settings like 'version'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $num_rows = mysqli_num_rows($result); if ($num_rows > 0) { $sql = 'SELECT version FROM settings'; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $version = $row['version']; @@ -121,7 +121,7 @@ function updateDatabase() executeDbSql("update settings set version = '2.2.1'"); notifyInfo(__FILE__, 'db-update='.$version.'->2.2.1', $_SESSION['userid']); case '2.2.1': - $sql = "CREATE TABLE IF NOT EXISTS `statistics` ( + $sql = "CREATE TABLE IF NOT EXISTS `statistics` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userid` int(6) NOT NULL DEFAULT '0', `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -153,7 +153,8 @@ function updateDatabase() insertStatistics('system', __FILE__, 'db-update', '2.3.3', $version); case '2.3.3': if (substr($mysqli_version, 0, 1) == 5) { - executeDbSql(" + executeDbSql( + " CREATE FUNCTION getBrowserInfo (user_agent VARCHAR(255)) RETURNS VARCHAR(100) DETERMINISTIC BEGIN DECLARE v_browser,v_os VARCHAR(20); @@ -194,7 +195,7 @@ function updateDatabase() RETURN CONCAT(v_browser ,' / ',v_os); END;" - ); + ); } executeDbSql("update settings set version = '2.3.4'"); notifyInfo(__FILE__, 'db-update='.$version.'->2.3.4', $_SESSION['userid']); @@ -228,7 +229,8 @@ function updateDatabase() case '2.4.4': if (substr($mysqli_version, 0, 1) == 5) { executeDbSql('DROP FUNCTION getBrowserInfo'); - executeDbSql(" + executeDbSql( + " CREATE FUNCTION getBrowserInfo (user_agent VARCHAR(255)) RETURNS VARCHAR(100) DETERMINISTIC BEGIN DECLARE v_browser,v_os VARCHAR(20); @@ -405,6 +407,5 @@ function updateDatabase() //todo in a later version: //executeDbSql("alter table settings CHANGE debug_mode verbose_statistics int(1) DEFAULT '0' "); break; - } } diff --git a/public/old/includes/functions.discussion.php b/public/old/includes/functions.discussion.php index 4a39c7c9..af0aafa5 100755 --- a/public/old/includes/functions.discussion.php +++ b/public/old/includes/functions.discussion.php @@ -45,8 +45,8 @@ function youtubeReplace($string) return preg_replace( '#(http://(www.)?youtube.com)?/(v/|watch\?v\=)([-|~_0-9A-Za-z]+)&?.*?#i', '', - $string - ); + $string + ); return $string; } diff --git a/public/old/includes/functions.event.php b/public/old/includes/functions.event.php index d90e7532..d2de8883 100755 --- a/public/old/includes/functions.event.php +++ b/public/old/includes/functions.event.php @@ -14,7 +14,7 @@ function addUserToEvent($eventId, $userRoleId) $sql = ("INSERT INTO eventPeople (eventId, userRoleId) VALUES ('$eventId', '$userRoleId')"); if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -29,7 +29,7 @@ function removeUserFromEvent($id, $userRoleId) { $sql = "DELETE FROM eventPeople WHERE eventId = '$id' AND userRoleId = '$userRoleId'"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -39,7 +39,7 @@ function createSwapEntry($eventPersonId, $newUserRoleId, $verified = 0) $newUserRoleId = filter_var($newUserRoleId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT userRoleId FROM eventPeople WHERE id = '$eventPersonId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $oldUserRoleId = $row['userRoleId']; } @@ -49,7 +49,7 @@ function createSwapEntry($eventPersonId, $newUserRoleId, $verified = 0) $declined = 0; $sql = "UPDATE eventPeople SET userRoleId = '$newUserRoleId', $notified = 0, $deleted = 0 WHERE id = '$eventPersonId'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } else { $verified = 0; $declined = 0; @@ -83,7 +83,7 @@ function createSwapEntry($eventPersonId, $newUserRoleId, $verified = 0) function verificationCodeForSwap($swapId) { $sql = "SELECT verificationCode FROM swaps WHERE id = '$swapId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $verificationCode = $row['verificationCode']; } @@ -166,7 +166,7 @@ function notifySwapCreated($swapId, $message = '') $verificationCode = verificationCodeForSwap($swapId); - $result = mysqli_query(db(), $query) or die(mysqli_error(db())); + $result = mysqli_query(db(), $query) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); @@ -229,7 +229,7 @@ function notifySwapAccepted($swapId, $message = '') $verificationCode = verificationCodeForSwap($swapId); - $result = mysqli_query(db(), $query) or die(mysqli_error(db())); + $result = mysqli_query(db(), $query) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); @@ -311,7 +311,7 @@ function notifySwapDeclined($swapId, $message = '') $verificationCode = verificationCodeForSwap($swapId); - $result = mysqli_query(db(), $query) or die(mysqli_error(db())); + $result = mysqli_query(db(), $query) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); @@ -366,7 +366,7 @@ function canDeclineSwap($swapId) WHERE sw.id = $swapId AND sw.declined = 0 AND sw.accepted = 0"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $swap = mysqli_fetch_object($result); if (!isset($swap->id)) { @@ -397,7 +397,7 @@ function canAcceptSwap($swapId) WHERE sw.id = $swapId AND sw.declined = 0 AND sw.accepted = 0"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $swap = mysqli_fetch_object($result); if (!isset($swap->id)) { @@ -420,7 +420,7 @@ function swapDetailsWithId($swapId) $swapId = filter_var($swapId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT * FROM swaps WHERE id = $swapId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob; @@ -444,7 +444,7 @@ function rolesOfUserAtEvent($userId, $eventId) WHERE eventId = '$eventId' AND userId = '$userId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($entry = mysqli_fetch_object($result)) { $a[] = $entry; @@ -472,7 +472,7 @@ function rolesUserCanCoverAtEvent($userId, $eventId) WHERE eventId = '$eventId' AND ur.roleId IN (SELECT roleId FROM userRoles WHERE userId = '$userId')"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($entry = mysqli_fetch_object($result)) { $a[] = $entry; @@ -484,7 +484,7 @@ function rolesUserCanCoverAtEvent($userId, $eventId) function numberOfRolesOfUserAtEvent($userId, $eventId) { $sql = "SELECT COUNT(ur.userId) AS numberOfRoles FROM eventPeople ep INNER JOIN userRoles ur ON ur.id = ep.userRoleId WHERE eventId = '$eventId' AND userId = '$userId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->numberOfRoles; @@ -496,7 +496,7 @@ function removeSeries($seriesId) $sql = "UPDATE eventGroups SET archived = true WHERE id = '$seriesId'"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -505,7 +505,7 @@ function addPeopleBand($bandId, $userRoleId) $sql = "INSERT INTO bandMembers (bandId, userRoleId) VALUES ('$bandId', '$userRoleId')"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -516,14 +516,13 @@ function getEventUrl($eventId) function getEventDetails($eventID, $separator, $type = 4, $apprev_description = true, $prefix = '') { - //type=0 -> all details //type=1 -> only groupID in 10,11,2 //type=2 -> only event date and event type //type=4 -> only event type $sqlSettings = 'SELECT * FROM settings'; - $resultSettings = mysqli_query(db(), $sqlSettings) or die(mysqli_error(db())); + $resultSettings = mysqli_query(db(), $sqlSettings) or exit(mysqli_error(db())); $rowSettings = mysqli_fetch_array($resultSettings, MYSQLI_ASSOC); $lang_locale = $rowSettings['lang_locale']; $time_format_normal = $rowSettings['time_format_normal']; @@ -555,7 +554,7 @@ function getEventDetails($eventID, $separator, $type = 4, $apprev_description = } $sql = $sql.'ORDER BY e.id, g.id desc, role, firstname, lastname '; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $returnValue = ''; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { @@ -602,9 +601,9 @@ function getEventDetails($eventID, $separator, $type = 4, $apprev_description = break; case 8: break; - } } + //return trim(substr($returnValue,strlen($separator)-1)); return substr($returnValue, strlen($separator)); } diff --git a/public/old/includes/functions.facebook.php b/public/old/includes/functions.facebook.php index 353a9e92..075ada83 100644 --- a/public/old/includes/functions.facebook.php +++ b/public/old/includes/functions.facebook.php @@ -16,10 +16,10 @@ function facebookIsEnabled() function facebook() { $fb = new Facebook\Facebook([ - 'app_id' => siteConfig()['auth']['facebook']['appId'], - 'app_secret' => siteConfig()['auth']['facebook']['appSecret'], - 'default_graph_version' => 'v2.2', - ]); + 'app_id' => siteConfig()['auth']['facebook']['appId'], + 'app_secret' => siteConfig()['auth']['facebook']['appSecret'], + 'default_graph_version' => 'v2.2', + ]); return $fb; } @@ -66,10 +66,10 @@ function getFacebookUserAccessToken($fb) $tokenMetadata = $oAuth2Client->debugToken($accessToken); // Validation (these will throw FacebookSDKException's when they fail) - $tokenMetadata->validateAppId($config['auth']['facebook']['appId']); // Replace {app-id} with your app id + $tokenMetadata->validateAppId($config['auth']['facebook']['appId']); // Replace {app-id} with your app id // If you know the user ID this access token belongs to, you can validate it here //$tokenMetadata->validateUserId('123'); - $tokenMetadata->validateExpiration(); + $tokenMetadata->validateExpiration(); if (!$accessToken->isLongLived()) { // Exchanges a short-lived access token for a long-lived one diff --git a/public/old/includes/functions.mail.php b/public/old/includes/functions.mail.php index bdf0002c..9009eba7 100755 --- a/public/old/includes/functions.mail.php +++ b/public/old/includes/functions.mail.php @@ -119,7 +119,7 @@ function sendViaSendmail($to, $subject, $message, $from, $bcc = '') //-------------------------------------------------------------------------------- //general mail footer $sqlSettings = 'SELECT * FROM settings'; - $resultSettings = mysqli_query(db(), $sqlSettings) or die(mysqli_error(db())); + $resultSettings = mysqli_query(db(), $sqlSettings) or exit(mysqli_error(db())); $rowSettings = mysqli_fetch_array($resultSettings, MYSQLI_ASSOC); $version = $rowSettings['version']; $owner = $rowSettings['owner']; @@ -162,9 +162,9 @@ function sendViaMailgun($to, $subject, $message, $from, $bcc = '') $domain = siteConfig()['email']['mailgun']['domain']; $status = $mg->sendMessage($domain, ['from' => $from, - 'to' => $to, - 'subject' => $subject, - 'text' => $message, ]); + 'to' => $to, + 'subject' => $subject, + 'text' => $message, ]); if ($status->http_response_code = 200) { return true; @@ -193,7 +193,7 @@ function notifySubscribers($id, $type, $userid) AS topicname FROM subscriptions WHERE topicid = '$id' AND userid != '$userid'"; $message = 'There has been a new post in the following discussion: '; } - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $postname = $row['name']; @@ -217,7 +217,7 @@ function mailNewUser($userId, $password = '*******') { $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT firstName, lastName, email, username FROM users WHERE id = $userId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $user = mysqli_fetch_object($result); if (strlen($user->email) == 0) { @@ -263,12 +263,13 @@ function emailTemplate($message, $name, $date, $location, $rehearsal, $rotaoutpu $message = str_replace('[date]', $date, $message); $message = str_replace('[location]', $location, $message); $message = str_replace('[rehearsal]', $rehearsal, $message); - if (is_array($rotaoutput)): - foreach ($rotaoutput as $key => $skill): + if (is_array($rotaoutput)) { + foreach ($rotaoutput as $key => $skill) { $skillfinal = $skillfinal.$skill.' '; - endforeach; else: + } + } else { $skillfinal = $rotaoutput; - endif; + } $message = str_replace('[rotaoutput]', $skillfinal, $message); $message = str_replace('[siteurl]', $siteurl, $message); $message = str_replace('[username]', $username, $message); @@ -276,6 +277,7 @@ function emailTemplate($message, $name, $date, $location, $rehearsal, $rotaoutpu $message = str_replace('[rotadetails]', $rotadetails, $message); $message = str_replace('[eventdetails]', $eventdetails, $message); $message = str_replace('[comment]', $comment, $message); + // echo '

' . $message . '

'; return $message; } @@ -305,11 +307,11 @@ function notifyIndividual($userID, $eventID, $skillID) (SELECT `rehearsal` FROM groups WHERE `skills`.`groupID` = `groups`.`groupID`) AS `rehearsal`, GROUP_CONCAT(skill) AS joinedskill FROM skills WHERE skillID IN (SELECT skillID FROM eventPeople WHERE eventID = '$eventID') AND skillID = '$skillID' GROUP BY userID, groupID ORDER BY groupID"; - $userresult = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $userresult = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($userresult, MYSQLI_ASSOC)) { $eventsql = "SELECT *, DATE_FORMAT(date,'%W, %M %e') AS sundayDate, DATE_FORMAT(rehearsalDate,'%W, %M %e @ %h:%i %p') AS rehearsalDateFormatted FROM events WHERE id = $eventID ORDER BY date"; - $eventresult = mysqli_query(db(), $eventsql) or die(mysqli_error(db())); + $eventresult = mysqli_query(db(), $eventsql) or exit(mysqli_error(db())); $location = $row['eventLocationFormatted']; @@ -337,7 +339,7 @@ function notifyIndividual($userID, $eventID, $skillID) $temp_user_id = $row['userid']; $sql = "UPDATE eventPeople SET notified = '1' WHERE skillID = '$skillID' AND eventID = '$eventID'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); $message = $row['notificationmessage']; $siteurl = $row['siteurl']; @@ -386,7 +388,7 @@ function notifyEveryoneForEvent($eventId) ORDER BY g.id"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $countarray = []; while ($ob = mysqli_fetch_object($result)) { @@ -405,7 +407,7 @@ function notifyEveryoneForEvent($eventId) WHERE e.id = $eventId ORDER BY date"; - $eventresult = mysqli_query(db(), $eventsql) or die(mysqli_error(db())); + $eventresult = mysqli_query(db(), $eventsql) or exit(mysqli_error(db())); $location = $ob->location; while ($eventrow = mysqli_fetch_array($eventresult, MYSQLI_ASSOC)) { @@ -437,13 +439,14 @@ function notifyEveryoneForEvent($eventId) ur.userId = '$temp_user_id' AND ep.eventId = '$eventId'"; - $roleResult = mysqli_query(db(), $roleSql) or die(mysqli_error(db())); + $roleResult = mysqli_query(db(), $roleSql) or exit(mysqli_error(db())); $roles = []; while ($roleRow = mysqli_fetch_array($roleResult, MYSQLI_ASSOC)) { - if (($roleRow['name'] == '') || ($roleRow['name'] == $roleRow['description'])): - $roles[] = $roleRow['description']; else: + if (($roleRow['name'] == '') || ($roleRow['name'] == $roleRow['description'])) { + $roles[] = $roleRow['description']; + } else { $roles[] = $roleRow['description'].' - '.$roleRow['name']; - endif; + } } $updateID = $ob->userId; @@ -503,7 +506,7 @@ function notifyEveryoneForEvent($eventId) ep.eventId = '$eventId' AND ur.userId IN (".implode(', ', $countarray).')'; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } $sql = "UPDATE @@ -514,7 +517,7 @@ function notifyEveryoneForEvent($eventId) e.id = '$eventId' AND e.id NOT IN (SELECT ep.eventId FROM eventPeople ep WHERE ep.notified = 0 AND ep.eventId = e.id)"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); return $countarray; } @@ -526,7 +529,7 @@ function notifyUserForEvent($userId, $eventId, $subject, $message) $eventId = filter_var($eventId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT firstName, lastName, email, recieveReminderEmails FROM users WHERE id = $userId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $user = mysqli_fetch_object($result); if (!$user->email) { @@ -563,7 +566,7 @@ function notifyUserForEvent($userId, $eventId, $subject, $message) e.id = $eventId GROUP BY date,id,location,type"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $event = mysqli_fetch_object($result); $eventDetails = strftime(siteSettings()->getTimeFormatNormal(), strtotime($event->date)); @@ -581,7 +584,7 @@ function notifyUserForEvent($userId, $eventId, $subject, $message) WHERE e.id = $eventId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $roles = mysqli_fetch_object($result); $templateValues = [ @@ -654,7 +657,7 @@ function sendEventEmailToGroups($eventId, $subject, $message, $groups) g.id IN ($groupsString) AND ep.eventId = $eventId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $errors = []; while ($ob = mysqli_fetch_object($result)) { $status = sendEventMessageEmailToUser($ob->userId, $eventId, $subject, $message); @@ -664,7 +667,7 @@ function sendEventEmailToGroups($eventId, $subject, $message, $groups) } $sql = "SELECT name FROM groups WHERE id IN ($groupsString)"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $groupNames = ''; while ($group = mysqli_fetch_object($result)) { $groupNames .= $group->name.', '; @@ -689,7 +692,7 @@ function getGroupEmailSubject() function getGroupEmailMessage() { $sql = 'SELECT overviewemail FROM settings'; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->overviewemail; @@ -715,7 +718,7 @@ function sendGroupEmail($subject, $message, $groups) g.id IN ($groupsString) "; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $errors = []; while ($ob = mysqli_fetch_object($result)) { $status = sendUpcomingEventsToUser($ob->userId, $subject, $message); @@ -725,7 +728,7 @@ function sendGroupEmail($subject, $message, $groups) } $sql = "SELECT name FROM groups WHERE id IN ($groupsString)"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $groupNames = ''; while ($group = mysqli_fetch_object($result)) { $groupNames .= $group->name.', '; @@ -749,7 +752,7 @@ function sendEventMessageEmailToUser($userId, $eventId, $subject, $message) $eventId = filter_var($eventId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT firstName, lastName, email, isOverviewRecipient FROM users WHERE id = $userId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $user = mysqli_fetch_object($result); if (!$user->email) { @@ -789,12 +792,12 @@ function sendEventMessageEmailToUser($userId, $eventId, $subject, $message) GROUP BY e.id"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); setlocale(LC_TIME, siteSettings()->getLangLocale()); //de_DE $eventDetails = ''; - $date; + $ob = mysqli_fetch_object($result); $date = $ob->date; @@ -844,7 +847,7 @@ function sendUpcomingEventsToUser($userId, $subject, $message) $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT firstName, lastName, email, isOverviewRecipient FROM users WHERE id = $userId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $user = mysqli_fetch_object($result); if (!$user->email) { @@ -863,7 +866,7 @@ function sendUpcomingEventsToUser($userId, $subject, $message) $crlf = " \n"; $sql = 'SELECT lang_locale, time_format_normal, adminemailaddress, owner FROM settings'; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); //siteSettings() = mysqli_fetch_object($result); // todo: fix settings in this function @@ -881,8 +884,8 @@ function sendUpcomingEventsToUser($userId, $subject, $message) AND e.date >= CURRENT_DATE() AND e.removed = 0"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); - $events; + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); + while ($ob = mysqli_fetch_object($result)) { $events[] = $ob->id; } @@ -925,12 +928,12 @@ function sendUpcomingEventsToUser($userId, $subject, $message) ) sub GROUP BY date,id,location,type"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); setlocale(LC_TIME, $lang_locale); //de_DE $eventDetails = ''; - $date; + while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $date = $row['date']; @@ -980,7 +983,7 @@ function notifyAttack($fileName, $attackType, $attackerID) Now() AS `attackTime` FROM settings"; - $userresult = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $userresult = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($userresult, MYSQLI_ASSOC)) { $subject = 'SECURITY-ALERT - Attack blocked successfully'; @@ -1010,7 +1013,7 @@ function notifyInfo($fileName, $infoMsg, $userID) (SELECT CONCAT(`firstname`, ' ', `lastname`) FROM users WHERE `users`.id = $userID) AS `name` FROM settings"; - $userresult = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $userresult = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($userresult, MYSQLI_ASSOC)) { $subject = 'Info - '.$infoMsg.' - '.$row[name]; @@ -1063,7 +1066,7 @@ function mailToDb($to, $subject, $message, $from, $bcc = '') $bcc = mysqli_real_escape_string(db(), $bcc); $sql = "INSERT INTO emails (emailTo, emailBcc, emailFrom, subject, message) VALUES ('$to', '$bcc', '$from', '$subject', '$message')"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); return mysqli_insert_id(db()); } @@ -1074,5 +1077,5 @@ function logFailedMailWithId($id, $error) $error = mysqli_real_escape_string(db(), $error); $sql = "UPDATE emails SET error = '$error' WHERE id = '$id'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } diff --git a/public/old/includes/functions.notifications.php b/public/old/includes/functions.notifications.php index 4af84860..17e7c29f 100644 --- a/public/old/includes/functions.notifications.php +++ b/public/old/includes/functions.notifications.php @@ -5,17 +5,17 @@ function swapTypesArray() { return [ - 0 => 'general', - 1 => 'admin', - 2 => 'feature', - 3 => 'event', - 4 => 'reminder', - 5 => 'account', - 6 => 'swap', - 7 => 'swap-pending', - 8 => 'swap-approved', - 9 => 'email', - ]; + 0 => 'general', + 1 => 'admin', + 2 => 'feature', + 3 => 'event', + 4 => 'reminder', + 5 => 'account', + 6 => 'swap', + 7 => 'swap-pending', + 8 => 'swap-approved', + 9 => 'email', + ]; } function createNotificationForUser($userId, $summary, $body, $typeName, $link = null) @@ -49,10 +49,10 @@ function seenNotification($notificationId, $referer) $referer = mysqli_real_escape_string(db(), $referer); $sql = "UPDATE notifications SET seen = TRUE WHERE id = $notificationId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $sql = "INSERT INTO notificationClicks (notificationId, referer) VALUES ($notificationId, '$referer')"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); return true; } @@ -62,7 +62,7 @@ function dismissNotification($notificationId) $notificationId = filter_var($notificationId, FILTER_SANITIZE_NUMBER_INT); $sql = "UPDATE notifications SET dismissed = TRUE WHERE id = $notificationId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); return true; } @@ -72,7 +72,7 @@ function notificationLink($notificationId) $notificationId = filter_var($notificationId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT link FROM notifications WHERE id = $notificationId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->link; @@ -83,7 +83,7 @@ function notificationWithId($notificationId) $notificationId = filter_var($notificationId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT id, summary, body, link, type, seen, dismissed FROM notifications WHERE id = $notificationId LIMIT 1"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); $ob->type = notificationType($ob->type); @@ -94,7 +94,7 @@ function notificationWithId($notificationId) function notificationWithIdHasType($notificationId, $type) { $sql = "SELECT type FROM notifications WHERE id = $notificationId LIMIT 1"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return swapTypesArray()[$ob->type] == $type; diff --git a/public/old/includes/functions.php b/public/old/includes/functions.php index dd874c54..1d7a647d 100755 --- a/public/old/includes/functions.php +++ b/public/old/includes/functions.php @@ -89,7 +89,7 @@ function siteSettings() //if call is not during installation, //query real values from db for these variables $sql = 'SELECT * FROM settings'; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $owner = $row['owner']; @@ -157,18 +157,17 @@ function isLoggedIn() function subscribeto($userid, $categoryid, $topicid) { $query = "INSERT INTO subscriptions(userid, categoryid, topicid) VALUES ('$userid', '$categoryid', '$topicid')"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function unsubscribefrom($subscription) { $query = "DELETE FROM subscriptions WHERE id = '$subscription'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function insertStatistics($type, $script, $detail1 = '', $detail2 = '', $detail3 = '') { - //if type=logout, then update login record (session-statitic-id) and exit //fallthrough if no login_statistic_id in session if (strtolower($detail1) == 'logout') { diff --git a/public/old/includes/functions.remove.php b/public/old/includes/functions.remove.php index 33f40ceb..3cf6a393 100755 --- a/public/old/includes/functions.remove.php +++ b/public/old/includes/functions.remove.php @@ -24,89 +24,89 @@ function removeSkill($skillID) { $query = "DELETE FROM skills WHERE skillID = '$skillID'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removePost($postid) { $query = "DELETE FROM discussion WHERE id = '$postid'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removeCategory($areaid) { $query = "DELETE FROM discussionCategories WHERE id = '$areaid'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: discussion.php'); } function removeDiscussion($areaid) { $query = "DELETE FROM discussion WHERE id = '$areaid'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); $query = "DELETE FROM discussion WHERE topicParent = '$areaid'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: discussion.php'); } function removeeventtype($eventtypeid) { $query = "DELETE FROM eventTypes WHERE id = '$eventtypeid'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: editeventtype.php'); } function removelocation($location) { $query = "DELETE FROM locations WHERE id = '$location'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: locations.php'); } function removeGroup($groupId) { $query = "DELETE FROM groups WHERE id = '$groupId'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); $query = "DELETE FROM roles WHERE groupId = '$groupId'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: roles.php'); } function removeRole($roleId) { $query = "DELETE FROM roles WHERE id = '$roleId'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: roles.php'); } function removeBandMembers($bandMembersID) { $query = "DELETE FROM bandMembers WHERE bandMembersID = '$bandMembersID'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removeResource($id) { $query = "DELETE FROM documents WHERE id = '$id'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removeEvent($removeWholeEvent) { $query = "UPDATE events SET removed = 1 WHERE id = '$removeWholeEvent'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removeBand($removeBand) { $query = "DELETE FROM bands WHERE bandID = '$removeBand'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removeBandSkill($bandskillid) { $query = "DELETE FROM instruments WHERE id = '$bandskillid'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); header('Location: bandskills.php'); } diff --git a/public/old/includes/functions.roles.php b/public/old/includes/functions.roles.php index ef7665c4..27598826 100644 --- a/public/old/includes/functions.roles.php +++ b/public/old/includes/functions.roles.php @@ -30,7 +30,7 @@ function updateRole($id, $name, $description) $sql = "UPDATE roles SET name = '$name', description = '$description' WHERE id = '$id'"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -39,13 +39,13 @@ function updateGroup($key, $name, $description) $sql = "UPDATE groups SET name = '$name' WHERE groupId = '$key'"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } $sql = "UPDATE groups SET description = '$description' WHERE groupId = '$key'"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -54,7 +54,7 @@ function moveRoleGroups($roleID, $value) $sql = "UPDATE roles SET groupId = '$value' WHERE id = '$roleID'"; if (!mysqli_query(db(), $sql)) { - die('Error: '.mysqli_error(db())); + exit('Error: '.mysqli_error(db())); } } @@ -65,24 +65,24 @@ function addUserRole($userId, $roleId) // prevent duplicate roles $sql = "SELECT COUNT(*) AS count FROM userRoles WHERE roleId = '$roleId' AND userId = '$userId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->count < 1) { $query = "INSERT INTO userRoles (userId, roleId) VALUES ('$userId', '$roleId')"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } } function removeUserRoleWithId($userRoleId) { $query = "DELETE FROM userRoles WHERE id = '$userRoleId'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function removeUserRole($userId, $roleId) { $query = "DELETE FROM userRoles WHERE userId = '$userId' AND roleId = '$roleId'"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); } function setUserRoleReserveWithId($userRoleId) @@ -106,7 +106,7 @@ function setUserRoleRegularWithId($userRoleId) function groupIdWithRole($roleId) { $sql = "SELECT groupId FROM roles WHERE id = '$roleId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->groupId; @@ -115,7 +115,7 @@ function groupIdWithRole($roleId) function roleNameFromId($roleId) { $sql = "SELECT name FROM roles WHERE id = '$roleId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->name; @@ -124,7 +124,7 @@ function roleNameFromId($roleId) function roleCanSwapToOtherRoleInGroup($roleId) { $sql = "SELECT allowRoleSwaps, groupId FROM roles WHERE id = '$roleId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->allowRoleSwaps != null) { @@ -132,7 +132,7 @@ function roleCanSwapToOtherRoleInGroup($roleId) } $sql = "SELECT allowRoleSwaps FROM groups WHERE id = '".$ob->groupId."'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->allowRoleSwaps; diff --git a/public/old/includes/functions.users.php b/public/old/includes/functions.users.php index 1a404ab7..a5efde33 100755 --- a/public/old/includes/functions.users.php +++ b/public/old/includes/functions.users.php @@ -41,7 +41,7 @@ function addUser($firstName, $lastName, $email, $mobile) $sql = ("INSERT INTO users (firstName, lastName, username, email, mobile, password, created, updated) VALUES ('$firstName', '$lastName', '$username', '$email', '$mobile', '1', NOW(), NOW())"); - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); $id = mysqli_insert_id(db()); @@ -66,7 +66,7 @@ function updateUser($id, $firstName, $lastName, $email, $mobile) $mobile = filter_var($mobile, FILTER_SANITIZE_NUMBER_INT); $sql = "UPDATE users SET firstname = '$firstName', lastname = '$lastName', email = '$email', mobile = '$mobile' WHERE id = '$id'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } function updateUserContactDetails($id, $email, $mobile) @@ -76,20 +76,20 @@ function updateUserContactDetails($id, $email, $mobile) $mobile = filter_var($mobile, FILTER_SANITIZE_NUMBER_INT); $sql = "UPDATE users SET email = '$email', mobile = '$mobile' WHERE id = '$id'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } function removeUser($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $query = "DELETE FROM userRoles WHERE userId = $id"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); $query = "DELETE FROM socialAuth WHERE userId = $id"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); $query = "DELETE FROM notifications WHERE userId = $id"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); $query = "DELETE FROM users WHERE id = $id"; - mysqli_query(db(), $query) or die(mysqli_error(db())); + mysqli_query(db(), $query) or exit(mysqli_error(db())); return 1; } @@ -136,14 +136,14 @@ function updatePermissions($id, $isAdmin, $isBandAdmin, $isEventEditor, $isOverv isBandAdmin = '$isBandAdmin', isEventEditor = '$isEventEditor' WHERE id = '$id'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } function getNameWithId($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT firstName, lastName FROM users WHERE id = '$id'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); $name = $ob->firstName.' '.$ob->lastName; @@ -154,7 +154,7 @@ function getFirstNameWithId($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT firstName FROM users WHERE id = '$id'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->firstName; @@ -164,7 +164,7 @@ function getUsernameWithId($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT username FROM users WHERE id = '$id'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $username = $row['username']; } @@ -190,7 +190,7 @@ function getEmailWithId($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT email FROM users WHERE id = '$id'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $email = $row['email']; } @@ -207,7 +207,7 @@ function changePassword($userId, $plainTextNewPassword, $plainTextOldPassword) $hashedPassword = hashPassword($plainTextNewPassword); $currentTimestamp = date('Y-m-d H:i:s'); $sql = "UPDATE users SET password = '$hashedPassword', passwordChanged = '$currentTimestamp' WHERE id = '$userId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); return isPasswordCorrectWithId($userId, $plainTextNewPassword); } @@ -218,7 +218,7 @@ function forceChangePassword($userId, $plainTextNewPassword) $newPassword = hashPassword($plainTextNewPassword); $currentTimestamp = date('Y-m-d H:i:s'); $sql = "UPDATE users SET password = '$newPassword', passwordChanged = '$currentTimestamp' WHERE id = '$userId'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); insertStatistics('user', __FILE__, 'password force changed for user '.getNameWithId($userId), null, $_SERVER['HTTP_USER_AGENT']); } @@ -276,14 +276,14 @@ function logFailedLoginAttempt($username, $ipAddress) $username = mysqli_real_escape_string(db(), $username); $ipAddress = mysqli_real_escape_string(db(), $ipAddress); $sql = "INSERT INTO loginFailures (username, ipAddress) VALUES ('$username', '$ipAddress')"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } function userIsAdmin($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT isAdmin FROM users WHERE id = '$id'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->isAdmin) { return true; @@ -297,7 +297,7 @@ function userExistsWithSocialIdForPlatform($socialId, $platform) $socialId = filter_var($socialId, FILTER_SANITIZE_NUMBER_INT); $platform = mysqli_real_escape_string(db(), $platform); $sql = "SELECT COUNT(*) AS count FROM socialAuth WHERE socialId = $socialId AND platform = '$platform'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->count == 1) { @@ -310,7 +310,7 @@ function userExistsWithSocialIdForPlatform($socialId, $platform) function usersWhoAreAdmins() { $sql = 'SELECT id, firstName, lastName FROM users WHERE isAdmin = true ORDER BY lastName, firstName'; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($ob = mysqli_fetch_object($result)) { $admins[] = $ob; } @@ -321,7 +321,7 @@ function usersWhoAreAdmins() function allUsersNames() { $sql = 'SELECT id, firstName, lastName FROM users ORDER BY lastName, firstName'; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); while ($ob = mysqli_fetch_object($result)) { $users[] = $ob; } @@ -338,7 +338,7 @@ function createPendingUser($socialId, $firstName, $lastName, $email, $source) $source = mysqli_real_escape_string(db(), $source); $sql = "INSERT INTO pendingUsers (socialId, firstName, lastName, email, source) VALUES ($socialId, '$firstName', '$lastName', '$email', '$source')"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $pendingId = mysqli_insert_id(db()); $linkToApprove = 'pendingAccounts.php?id='.$pendingId; @@ -360,7 +360,7 @@ function pendingUserActioned($pendingAccountId) { $pendingAccountId = filter_var($pendingAccountId, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT approved, declined FROM pendingUsers WHERE id = $pendingAccountId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->approved == true || $ob->declined == true) { @@ -381,11 +381,11 @@ function approvePendingUser($pendingAccountId) // update approval bit $sql = "UPDATE pendingUsers SET approved = true WHERE id = $pendingAccountId"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); // create user $sql = "SELECT firstName, lastName, email, socialId, source FROM pendingUsers WHERE id = $pendingAccountId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $pendingUser = mysqli_fetch_object($result); $userId = addUser($pendingUser->firstName, $pendingUser->lastName, $pendingUser->email, ''); @@ -408,11 +408,11 @@ function mergePendingUserWithUserId($pendingAccountId, $userId) // update approval bit $sql = "UPDATE pendingUsers SET approved = true WHERE id = $pendingAccountId"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); // add facebook login id $sql = "SELECT firstName, lastName, email, socialId, source FROM pendingUsers WHERE id = $pendingAccountId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $pendingUser = mysqli_fetch_object($result); addSocialAuthToUserWithId($userId, $pendingUser->socialId, $pendingUser->source); updateUser($userId, $pendingUser->firstName, $pendingUser->lastName, $pendingUser->email, null); @@ -434,10 +434,10 @@ function declinePendingUser($pendingAccountId) // update declined bit $sql = "UPDATE pendingUsers SET declined = true WHERE id = $pendingAccountId"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); $sql = "SELECT socialId FROM pendingUsers WHERE id = $pendingAccountId"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $pendingUser = mysqli_fetch_object($result); createFacebookNotificationForFacebookUser($pendingUser->socialId, 'login.php', 'Your account request has been declined. Get in touch if you think we\'ve got this wrong.'); @@ -451,7 +451,7 @@ function addSocialAuthToUserWithId($userId, $socialId, $platform) $socialId = filter_var($socialId, FILTER_SANITIZE_NUMBER_INT); $platform = mysqli_real_escape_string(db(), $platform); $sql = "INSERT INTO socialAuth (userId, socialId, platform) VALUES ($userId, $socialId, '$platform')"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); } function removeSocialAuthFromUserWithId($userId, $platform) @@ -459,14 +459,14 @@ function removeSocialAuthFromUserWithId($userId, $platform) $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); $platform = mysqli_real_escape_string(db(), $platform); $sql = "DELETE FROM socialAuth WHERE userId = $userId AND platform = '$platform'"; - mysqli_query(db(), $sql) or die(mysqli_error(db())); + mysqli_query(db(), $sql) or exit(mysqli_error(db())); } function getUsernameWithSocialId($id) { $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT username FROM users u INNER JOIN socialAuth sa ON u.id = sa.userId WHERE sa.socialId = '$id'"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->username; @@ -477,7 +477,7 @@ function userIsLinkedToPlatform($userId, $platform) $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); $platform = mysqli_real_escape_string(db(), $platform); $sql = "SELECT COUNT(*) AS count FROM socialAuth WHERE userId = $userId AND platform = '$platform' AND revoked = 0"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); if ($ob->count == 1) { @@ -492,7 +492,7 @@ function userSocialIdForPlatform($userId, $platform) $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); $platform = mysqli_real_escape_string(db(), $platform); $sql = "SELECT socialId FROM socialAuth WHERE userId = $userId AND platform = '$platform' AND revoked = 0"; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $ob = mysqli_fetch_object($result); return $ob->socialId; @@ -501,7 +501,7 @@ function userSocialIdForPlatform($userId, $platform) function getProfileImageUrl($userId, $size = 'small') { $sql = 'SELECT sa.socialId, u.email FROM users u LEFT JOIN socialAuth sa ON sa.userId = u.id WHERE id = '.$userId; - $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); $user = mysqli_fetch_object($result); if ($user->socialId) { diff --git a/public/old/recordingUpload.php b/public/old/recordingUpload.php index 66245e28..9393f57c 100644 --- a/public/old/recordingUpload.php +++ b/public/old/recordingUpload.php @@ -34,11 +34,11 @@ // get token $response = $client->request( - 'POST', - 'v3/tokens.json', - ['form_params' => ['api_key' => siteConfig()['recording']['locomotivecms']['apiKey'], - 'email' => siteConfig()['recording']['locomotivecms']['email'], ]] - ); + 'POST', + 'v3/tokens.json', + ['form_params' => ['api_key' => siteConfig()['recording']['locomotivecms']['apiKey'], + 'email' => siteConfig()['recording']['locomotivecms']['email'], ]] +); if ($response->getStatusCode() == 201) { $token = json_decode($response->getBody())->token; } @@ -46,9 +46,10 @@ // test token if (isset($token)) { $response = $client->request( - 'GET', - 'v3/my_account.json', - ['query' => ['auth_token' => $token]]); + 'GET', + 'v3/my_account.json', + ['query' => ['auth_token' => $token]] + ); var_dump($response); } else { echo '

Unable to connect to main site

'; diff --git a/src/classes/AuthProvider/UsernamePasswordInterface.php b/src/classes/AuthProvider/UsernamePasswordInterface.php index 2c196f4d..93b5e9fb 100644 --- a/src/classes/AuthProvider/UsernamePasswordInterface.php +++ b/src/classes/AuthProvider/UsernamePasswordInterface.php @@ -9,7 +9,7 @@ interface UsernamePasswordInterface extends AuthProviderInterface public function checkCredentials($username, $password); /** - * @return string|null URL path to reset password (with full domain if required). Null is returned if user is unable to reset password, or the URL cannot be determined by the auth provider. + * @return string|null URL path to reset password (with full domain if required). Null is returned if user is unable to reset password, or the URL cannot be determined by the auth provider. */ public function getResetPasswordUrl(); } diff --git a/src/classes/AuthProviderInterface.php b/src/classes/AuthProviderInterface.php index 842b8fc3..36c1a671 100644 --- a/src/classes/AuthProviderInterface.php +++ b/src/classes/AuthProviderInterface.php @@ -5,12 +5,12 @@ interface AuthProviderInterface { /** - * @return bool True if auth method is enabled + * @return bool True if auth method is enabled */ public function isEnabled(); /** - * @return string Unique slug identifying the auth provider. + * @return string Unique slug identifying the auth provider. */ public function getAuthProviderSlug(); } diff --git a/src/classes/Authentication.php b/src/classes/Authentication.php index 440a0164..34c181c9 100644 --- a/src/classes/Authentication.php +++ b/src/classes/Authentication.php @@ -108,10 +108,10 @@ public function loginAttempt(EmailAddress $email, $password) $socialAuth->save(); $user = $socialAuth->getUser(); } - break; + break; default: $user = UserQuery::create()->filterByEmail($email)->findOne(); - break; + break; } if (is_null($user)) { @@ -213,7 +213,7 @@ public function verifyCallback($args) //$socialAuth->save(); $user = $socialAuth->getUser(); } - break; + break; } if (is_null($user)) { diff --git a/src/classes/Authorisation.php b/src/classes/Authorisation.php index aefe8eca..66ef4dcf 100644 --- a/src/classes/Authorisation.php +++ b/src/classes/Authorisation.php @@ -17,8 +17,7 @@ public function __construct(ContainerInterface $container) public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { - - // do something! + // do something! return $response; } diff --git a/src/classes/Controller/InstallController.php b/src/classes/Controller/InstallController.php index 1d1706e5..eb1a1944 100644 --- a/src/classes/Controller/InstallController.php +++ b/src/classes/Controller/InstallController.php @@ -188,7 +188,8 @@ protected function populateDefaultSettings() $settings->setDateOnlyFormat('%A'); $settings->setDayOnlyFormat('%A, %B %e'); - $settings->setNotificationEmail(<<<'EMAIL' + $settings->setNotificationEmail( + <<<'EMAIL' Dear [name] This is an automatic reminder. @@ -201,7 +202,7 @@ protected function populateDefaultSettings() Many thanks for your continued service! EMAIL -); + ); $settings->setToken(Crypt::generateToken(100)); $settings->setSkin('skin-blue'); diff --git a/src/classes/Controller/PendingUserController.php b/src/classes/Controller/PendingUserController.php index 360b64cc..25453c85 100644 --- a/src/classes/Controller/PendingUserController.php +++ b/src/classes/Controller/PendingUserController.php @@ -58,7 +58,7 @@ public function getSignUpForm(ServerRequestInterface $request, ResponseInterface $firstName = $names[0]; $lastName = $names[1]; $email = $meta['email']; - break; + break; } return $this->view->render($response, 'login-sign-up.twig', [ diff --git a/tests/Integration/BaseTestCase.php b/tests/Integration/BaseTestCase.php index 66ce4144..e34991eb 100644 --- a/tests/Integration/BaseTestCase.php +++ b/tests/Integration/BaseTestCase.php @@ -125,16 +125,16 @@ protected function loadDatabase() $serviceContainer->setAdapterClass('default', 'sqlite'); $manager = new ConnectionManagerSingle('default'); $manager->setConfiguration([ - 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', - 'dsn' => 'sqlite:/var/tmp/test.db', - 'attributes' => [ - 'ATTR_EMULATE_PREPARES' => false, - 'ATTR_TIMEOUT' => 30, - ], - 'model_paths' => [ - 0 => 'src', - 1 => 'vendor', - ], + 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', + 'dsn' => 'sqlite:/var/tmp/test.db', + 'attributes' => [ + 'ATTR_EMULATE_PREPARES' => false, + 'ATTR_TIMEOUT' => 30, + ], + 'model_paths' => [ + 0 => 'src', + 1 => 'vendor', + ], ]); $manager->setName('default'); $serviceContainer->setConnectionManager($manager); @@ -151,9 +151,9 @@ protected function installDatabase() $sqlManager = new SqlManager(); $sqlManager->setConnections( ['default' => [ - 'dsn' => 'sqlite:/var/tmp/test.db', - 'adapter' => 'sqlite', - ], + 'dsn' => 'sqlite:/var/tmp/test.db', + 'adapter' => 'sqlite', + ], ] ); $sqlManager->setWorkingDirectory(__DIR__.'/../../generated-sql'); diff --git a/tests/Unit/BaseTestCase.php b/tests/Unit/BaseTestCase.php index 52fafb9b..3b2ccb0c 100644 --- a/tests/Unit/BaseTestCase.php +++ b/tests/Unit/BaseTestCase.php @@ -18,16 +18,16 @@ $serviceContainer->setAdapterClass('default', 'sqlite'); $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle('default'); $manager->setConfiguration([ - 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', - 'dsn' => 'sqlite:/var/tmp/test.db', - 'attributes' => [ - 'ATTR_EMULATE_PREPARES' => false, - 'ATTR_TIMEOUT' => 30, - ], - 'model_paths' => [ - 0 => 'src', - 1 => 'vendor', - ], + 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', + 'dsn' => 'sqlite:/var/tmp/test.db', + 'attributes' => [ + 'ATTR_EMULATE_PREPARES' => false, + 'ATTR_TIMEOUT' => 30, + ], + 'model_paths' => [ + 0 => 'src', + 1 => 'vendor', + ], ]); $manager->setName('default'); $serviceContainer->setConnectionManager($manager); @@ -36,9 +36,9 @@ $sqlManager = new \Propel\Generator\Manager\SqlManager(); $sqlManager->setConnections( ['default' => [ - 'dsn' => 'sqlite:/var/tmp/test.db', - 'adapter' => 'sqlite', - ], + 'dsn' => 'sqlite:/var/tmp/test.db', + 'adapter' => 'sqlite', + ], ] ); $sqlManager->setWorkingDirectory(__DIR__.'/../../generated-sql'); diff --git a/tests/Unit/CryptTest.php b/tests/Unit/CryptTest.php index 31322599..fad51fd5 100644 --- a/tests/Unit/CryptTest.php +++ b/tests/Unit/CryptTest.php @@ -10,16 +10,16 @@ class CryptTest extends BaseTestCase public function providerTestGenerateToken() { return [ - [1], - [2], - [5], - [7], - [9], - [22], - [60], - [120], - [246], - ]; + [1], + [2], + [5], + [7], + [9], + [22], + [60], + [120], + [246], + ]; } /** @@ -39,13 +39,13 @@ public function testGenerateToken($length) public function providerTestGenerateIntBetween() { return [ - [1, 2], - [1, 100], - [2, 43], - [5, 555], - [7, 9233], - [5500, 6703], - ]; + [1, 2], + [1, 100], + [2, 43], + [5, 555], + [7, 9233], + [5500, 6703], + ]; } /** @@ -67,9 +67,9 @@ public function testGenerateIntBetween($min, $max) public function providerTestGenerateIntInvalidConstraints() { return [ - [100, 1], - [2, 2], - ]; + [100, 1], + [2, 2], + ]; } /** diff --git a/tests/Unit/EmailAddressTest.php b/tests/Unit/EmailAddressTest.php index 5e7c9571..9083bc81 100644 --- a/tests/Unit/EmailAddressTest.php +++ b/tests/Unit/EmailAddressTest.php @@ -10,9 +10,9 @@ class EmailAddressTest extends BaseTestCase public function providerTestValidEmails() { return [ - ['test@example.com'], - ['no-password@email.com'], - ]; + ['test@example.com'], + ['no-password@email.com'], + ]; } /** @@ -30,10 +30,10 @@ public function testValidEmails($email) public function providerTestInvalidEmails() { return [ - ['not-an-email'], - ['another-not-an-email'], - [''], - ]; + ['not-an-email'], + ['another-not-an-email'], + [''], + ]; } /**