+ /**
+ * Metadata for price sets.
+ *
+ * @var array
+ */
+ protected $priceSetMetadata = [];
+
+ /**
+ * Get form object.
+ *
+ * @return \CRM_Core_Form|NULL
+ */
+ public function getForm(): ?CRM_Core_Form {
+ return $this->form;
+ }
+
+ /**
+ * Set form object.
+ *
+ * @param \CRM_Core_Form|NULL $form
+ */
+ public function setForm(?CRM_Core_Form $form): void {
+ $this->form = $form;
+ }
+
+ /**
+ * The serialize & unserialize functions are to prevent the form being serialized & stored.
+ *
+ * The form could be potentially large & circular.
+ *
+ * We simply serialize the values needed to re-serialize the form.
+ *
+ * @return array
+ */
+ public function _serialize(): array {
+ return [
+ 'OverrideTotalAmount' => $this->getOverrideTotalAmount(),
+ 'OverrideFinancialType' => $this->getOverrideFinancialTypeID(),
+ 'PriceSelection' => $this->getPriceSelection(),
+ ];
+ }
+
+ /**
+ * Re-instantiate the the class with non-calculated variables.
+ *
+ * @param array $data
+ */
+ public function _unserialize(array $data): void {
+ foreach ($data as $key => $value) {
+ $fn = 'set' . $key;
+ $this->$fn($value);
+ }
+ }
+
+ /**
+ * Form object - if present the buildAmount hook will be called.
+ *
+ * @var \CRM_Member_Form_Membership|\CRM_Member_Form_MembershipRenewal
+ */
+ protected $form;
+