/** * @return array */ public function serialize() { if ($this->user->getPhone() == null) { throw new NotEnoughDataException('User phone is null'); } return ['phone' => $this->user->getPhone()->getValue(), 'user_promotions' => array_map(function (UserPromotion $userPromotion) { return $userPromotion->serializeForImport(); }, $this->userPromotions)]; }