/** * @param array $attributes * @throws CException * @return PaymentContact */ public static function create(array $attributes) { $model = new PaymentContact(); $model->attributes = $attributes; if (!$model->save()) { throw new CException('Failed to save payment contact.'); } return $model; }
/** * @param array $attributes */ public function addBillingContact($attributes) { $contact = PaymentContact::create($attributes); $this->billingContactId = $contact->id; if (!$this->save(true, array('billingContactId'))) { throw new CException(sprintf('Failed to add billing contact for transaction #%d', $this->id)); } return $contact; }