/** * Sets the properties of the current object to the value they had at a specific version * * @param ChildCustomerVersion $version The version object to use * @param ConnectionInterface $con the connection to use * @param array $loadedObjects objects that been loaded in a chain of populateFromVersion calls on referrer or fk objects. * * @return ChildCustomer The current object (for fluent API support) */ public function populateFromVersion($version, $con = null, &$loadedObjects = array()) { $loadedObjects['ChildCustomer'][$version->getId()][$version->getVersion()] = $this; $this->setId($version->getId()); $this->setTitleId($version->getTitleId()); $this->setLangId($version->getLangId()); $this->setRef($version->getRef()); $this->setFirstname($version->getFirstname()); $this->setLastname($version->getLastname()); $this->setEmail($version->getEmail()); $this->setPassword($version->getPassword()); $this->setAlgo($version->getAlgo()); $this->setReseller($version->getReseller()); $this->setSponsor($version->getSponsor()); $this->setDiscount($version->getDiscount()); $this->setRememberMeToken($version->getRememberMeToken()); $this->setRememberMeSerial($version->getRememberMeSerial()); $this->setEnable($version->getEnable()); $this->setConfirmationToken($version->getConfirmationToken()); $this->setCreatedAt($version->getCreatedAt()); $this->setUpdatedAt($version->getUpdatedAt()); $this->setVersion($version->getVersion()); $this->setVersionCreatedAt($version->getVersionCreatedAt()); $this->setVersionCreatedBy($version->getVersionCreatedBy()); if ($fkValues = $version->getOrderIds()) { $this->clearOrders(); $fkVersions = $version->getOrderVersions(); $query = ChildOrderVersionQuery::create(); foreach ($fkValues as $key => $value) { $c1 = $query->getNewCriterion(OrderVersionTableMap::ID, $value); $c2 = $query->getNewCriterion(OrderVersionTableMap::VERSION, $fkVersions[$key]); $c1->addAnd($c2); $query->addOr($c1); } foreach ($query->find($con) as $relatedVersion) { if (isset($loadedObjects['ChildOrder']) && isset($loadedObjects['ChildOrder'][$relatedVersion->getId()]) && isset($loadedObjects['ChildOrder'][$relatedVersion->getId()][$relatedVersion->getVersion()])) { $related = $loadedObjects['ChildOrder'][$relatedVersion->getId()][$relatedVersion->getVersion()]; } else { $related = new ChildOrder(); $related->populateFromVersion($relatedVersion, $con, $loadedObjects); $related->setNew(false); } $this->addOrder($related); $this->collOrdersPartial = false; } } return $this; }