Exemplo n.º 1
0
 /**
  * @return Address - associated with parent having type set to billing
  */
 public function getBillingAddress()
 {
     return $this->hasOne(Address::className(), ['id' => 'addressId'])->viaTable(CoreTables::TABLE_MODEL_ADDRESS, ['parentId' => 'id'], function ($query, $type = Address::TYPE_BILLING) {
         $modelAddress = CoreTables::TABLE_MODEL_ADDRESS;
         $query->onCondition("{$modelAddress}.parentType=:ptype AND {$modelAddress}.type=:type", [':ptype' => $this->addressType, ':type' => $type]);
     });
 }
Exemplo n.º 2
0
 /**
  * @return Address - associated address
  */
 public function getAddress()
 {
     return $this->hasOne(Address::className(), ['id' => 'addressId']);
 }