Maybe this case should be handled before the loop... There seems to be already a similar expression:
https://github.com/MArcJ/Propel/blob/322163e236873ac7778115eaa7db054efb32fc21/runtime/lib/util/BasePeer.php#L350