Example #1
0
 /**
  * Creates a version of the current object and saves it.
  *
  * @param   ConnectionInterface $con the connection to use
  *
  * @return  ChildCustomerVersion A version object
  */
 public function addVersion($con = null)
 {
     $this->enforceVersion = false;
     $version = new ChildCustomerVersion();
     $version->setId($this->getId());
     $version->setRef($this->getRef());
     $version->setTitleId($this->getTitleId());
     $version->setFirstname($this->getFirstname());
     $version->setLastname($this->getLastname());
     $version->setEmail($this->getEmail());
     $version->setPassword($this->getPassword());
     $version->setAlgo($this->getAlgo());
     $version->setReseller($this->getReseller());
     $version->setLang($this->getLang());
     $version->setSponsor($this->getSponsor());
     $version->setDiscount($this->getDiscount());
     $version->setRememberMeToken($this->getRememberMeToken());
     $version->setRememberMeSerial($this->getRememberMeSerial());
     $version->setCreatedAt($this->getCreatedAt());
     $version->setUpdatedAt($this->getUpdatedAt());
     $version->setVersion($this->getVersion());
     $version->setVersionCreatedAt($this->getVersionCreatedAt());
     $version->setVersionCreatedBy($this->getVersionCreatedBy());
     $version->setCustomer($this);
     if ($relateds = $this->getOrders($con)->toKeyValue('Id', 'Version')) {
         $version->setOrderIds(array_keys($relateds));
         $version->setOrderVersions(array_values($relateds));
     }
     $version->save($con);
     return $version;
 }