예제 #1
0
파일: Address.php 프로젝트: kingsj/core
 /**
  * This object will be used if another one is not pased
  *
  * @return \XLite\Model\Address
  */
 protected function getDefaultModelObject()
 {
     if (!isset($this->address)) {
         $addressId = $this->getAddressId();
         if (isset($addressId)) {
             $this->address = \XLite\Core\Database::getRepo('XLite\\Model\\Address')->find($this->getAddressId());
         } else {
             $this->address = new \XLite\Model\Address();
             $profileId = $this->getProfileId();
             if (0 < intval($profileId)) {
                 $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->find($profileId);
                 if (isset($profile)) {
                     $this->address->setProfile($profile);
                 }
             }
             $this->address->setZipcode(\XLite\Core\Config::getInstance()->General->default_zipcode);
         }
     }
     return $this->address;
 }