Skip to content

Commit 4e38948

Browse files
committed
Fix referrer coll checks
1 parent 459e063 commit 4e38948

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected function addMutatorClose(string &$script, Column $col)
121121
$script .= "
122122
123123
// update associated ".$tblFK->getPhpName()."
124-
if (\$this->$collName !== null) {
124+
if (\$this->$collName !== []) {
125125
foreach(\$this->$collName as \$referrerObject) {
126126
\$referrerObject->set".$colFK->getPhpName()."(\$v);
127127
}
@@ -564,9 +564,9 @@ public function get".$relCol."Join".$relCol2."(Criteria \$criteria = null, Conne
564564
\$criteria = clone \$criteria;
565565
}
566566
567-
if (\$this->$collName === null) {
567+
if (\$this->$collName === []) {
568568
if (\$this->isNew()) {
569-
\$this->$collName = array();
569+
\$this->$collName = [];
570570
} else {
571571
";
572572
foreach ($refFK->getForeignColumns() as $columnName) {
@@ -690,8 +690,8 @@ protected function addRefFKInit(string &$script, ForeignKey $refFK): void
690690
*/
691691
public function init$relCol()
692692
{
693-
if (\$this->$collName === null) {
694-
\$this->$collName = array();
693+
if (\$this->$collName === []) {
694+
\$this->$collName = [];
695695
}
696696
}
697697
";
@@ -816,9 +816,9 @@ public function get$relCol(Criteria \$criteria = null, Connection \$connection =
816816
\$criteria = clone \$criteria;
817817
}
818818
819-
if (\$this->$collName === null) {
819+
if (\$this->$collName === []) {
820820
if (\$this->isNew()) {
821-
\$this->$collName = array();
821+
\$this->$collName = [];
822822
} else {
823823
";
824824
foreach ($refFK->getLocalColumns() as $colFKName) {
@@ -972,7 +972,7 @@ protected function doSave(\$connection)
972972
// it seems to work as expected and is desireable since we are also enabling the copy()ing of these related rows
973973
//if ( $fk->getTable()->getName() != $table->getName() ) {
974974
$script .= "
975-
if (\$this->$collName !== null) {
975+
if (\$this->$collName !== []) {
976976
foreach(\$this->$collName as \$referrerFK) {
977977
if (!\$referrerFK->isDeleted()) {
978978
\$affectedRows += \$referrerFK->save(\$connection);
@@ -1158,7 +1158,7 @@ protected function doValidate(\$columns = null)
11581158
if ( $tblFK->getName() !== $table->getName() ) {
11591159
$collName = $this->getRefFKCollVarName($fk);
11601160
$script .= "
1161-
if (\$this->$collName !== null) {
1161+
if (\$this->$collName !== []) {
11621162
foreach(\$this->$collName as \$referrerFK) {
11631163
if (!\$referrerFK->validate(\$columns)) {
11641164
\$failureMap = array_merge(\$failureMap, \$referrerFK->getValidationFailures());

0 commit comments

Comments
 (0)