/** * @return ModelAddress associated with parent */ public function getModelAddressByType($type) { $parentType = $this->addressType; return $this->hasOne(ModelAddress::className(), ['parentId' => 'id'])->where("parentType=:ptype AND type=:type", [':ptype' => $parentType, ':type' => $type])->one(); }
public static function deleteByParentIdType($parentId, $parentType) { ModelAddress::deleteByParentIdType($parentId, $parentType); }