diff --git a/runtime/lib/collection/PropelObjectCollection.php b/runtime/lib/collection/PropelObjectCollection.php index 265da242f..07dd69877 100644 --- a/runtime/lib/collection/PropelObjectCollection.php +++ b/runtime/lib/collection/PropelObjectCollection.php @@ -299,16 +299,10 @@ public function contains($element) private function getIdenticalObject(BaseObject $object) { - $objectHashCode = null; + $objectHashCode = $object->hashCode(); foreach ($this as $obj) { - if ($obj instanceof BaseObject) { - if (null === $objectHashCode) { - $objectHashCode = $object->hashCode(); - } - - if ($obj->hashCode() === $objectHashCode) { - return $obj; - } + if ($obj instanceof BaseObject && $obj->hashCode() === $objectHashCode) { + return $obj; } }