Skip to content

Commit

Permalink
trigger deprecation if strftime format is used
Browse files Browse the repository at this point in the history
  • Loading branch information
jwong-dayspring committed May 21, 2024
1 parent cca86e5 commit 292f314
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"require": {
"php": "^8.0|^7.4",
"phing/phing": "^2.17",
"ext-pdo": "*"
"ext-pdo": "*",
"symfony/deprecation-contracts": "^3.5"
},
"require-dev": {
"phpunit/phpunit": "^9.0.0",
Expand Down
4 changes: 2 additions & 2 deletions generator/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ propel.disableIdentifierQuoting = false
# it is nice to change the defaults.

propel.defaultTimeStampFormat = Y-m-d H:i:s
propel.defaultTimeFormat = %X
propel.defaultDateFormat = %x
propel.defaultTimeFormat = H:i:s
propel.defaultDateFormat = m/d/Y

propel.defaultKeyType = phpName

Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/ExtensionQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5ExtensionNodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5ExtensionObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5ExtensionPeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5InterfaceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5MultiExtendObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5NestedSetBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5NestedSetPeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5NodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5NodePeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
5 changes: 3 additions & 2 deletions generator/lib/builder/om/PHP5ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down Expand Up @@ -1017,7 +1017,8 @@ protected function addTemporalAccessorBody(&$script, Column $col)
$script .= "
}
if (strpos(\$format, '%') !== false) {
if (strpos(\$format, '%') !== false) {
trigger_deprecation('dayspring-tech/propel1', '1.9', 'Using strftime style \"%\" formatting is deprecated. PHP 8.1 deprecated strftime().');
return strftime(\$format, \$dt->format('U'));
}
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5PeerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/PHP5TableMapBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function addClassOpen(&$script)
*
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/builder/om/QueryInheritanceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function addClassOpen(&$script)
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$now = (new DateTime())->format(DateTimeInterface::ATOM);
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
Expand Down

0 comments on commit 292f314

Please sign in to comment.