id = new Id(); $this->title = $plan->getTitle(); $this->description = $plan->getDescription(); $this->icon = $plan->getIcon(); $this->featureList = $plan->getFeatureList(); $this->price = $plan->getPrice(); $this->billingCycle = $plan->getBillingCycle(); $this->creditCount = $plan->getCreditCount(); $this->createdAt = new DateTimeImmutable(); $this->config = $plan->getConfig(); $this->plan = $plan; } public function getPlan(): ?PlanEntity { return $this->plan; } public function getConfig(): PlanConfig { if (!$this->config instanceof PlanConfig) { $this->config = new PlanConfig( array_merge( $this->plan ? $this->plan->getConfig()->toArray() : [], $this->config ?: [] ) ); } return $this->config; } public function resync() { $this->title = $this->plan->getTitle(); $this->description = $this->plan->getDescription(); $this->icon = $this->plan->getIcon(); $this->featureList = $this->plan->getFeatureList(); $this->creditCount = $this->plan->getCreditCount(); $this->config = $this->plan->getConfig(); } }