0.01], [['metadata_json'], 'string'], [['provider', 'status', 'goal_type'], 'string', 'max' => 32], [['mode'], 'string', 'max' => 16], [['currency'], 'string', 'max' => 8], [['provider_payment_id', 'provider_checkout_id', 'provider_subscription_id', 'provider_customer_id'], 'string', 'max' => 190], ]; } public function beforeSave($insert) { if (!parent::beforeSave($insert)) { return false; } $now = date('Y-m-d H:i:s'); if ($insert && empty($this->created_at)) { $this->created_at = $now; } $this->updated_at = $now; if (empty($this->currency)) { $this->currency = 'USD'; } return true; } }