Skip to content

Loading…

Update PHP5ObjectBuilder.php #807

Open
wants to merge 1 commit into from

4 participants

@sh0dow

When PropelObjectArray is fetched using some relations it will have uninitialized property virtualColumns, so call ->toArray will fall with Undefined property... ::$virtualColumns in ...\om\Base...php

sh0dow Update PHP5ObjectBuilder.php
When PropelObjectArray is fetched using some relations it will have uninitialized property `virtualColumns`, so call ->toArray will fall with `Undefined property`... ::$virtualColumns in ...\om\Base...php
9993a46
@staabm
Propel member

I am not sure this is the right fix... Needs some further investigation

@marcj
Propel member

Tests?

@staabm
Propel member

@sh0dow are you able to provide a test which reproduces the issue with uninitialised properties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 25, 2013
  1. Update PHP5ObjectBuilder.php

    sh0dow committed
    When PropelObjectArray is fetched using some relations it will have uninitialized property `virtualColumns`, so call ->toArray will fall with `Undefined property`... ::$virtualColumns in ...\om\Base...php
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 generator/lib/builder/om/PHP5ObjectBuilder.php
View
8 generator/lib/builder/om/PHP5ObjectBuilder.php
@@ -2463,9 +2463,11 @@ public function toArray(\$keyType = BasePeer::$defaultKeyType, \$includeLazyLoad
$script .= "
);";
$script .= "
- \$virtualColumns = \$this->virtualColumns;
- foreach (\$virtualColumns as \$key => \$virtualColumn) {
- \$result[\$key] = \$virtualColumn;
+ if(isset(\$this->virtualColumns)) {
+ \$virtualColumns = \$this->virtualColumns;
+ foreach (\$virtualColumns as \$key => \$virtualColumn) {
+ \$result[\$key] = \$virtualColumn;
+ }
}
";
if ($hasFks) {
Something went wrong with that request. Please try again.