$userCart = new UserCart(UserCart::STATUS_CONFIRMED);
$userCartProducts = $this->createUserCartProducts($showcaseData, $productsData, $userCart, $paymentOptionAlias);
$paymentOption = $this->em->getRepository(PaymentOption::class)->findOneBy(['alias' => $ucPaymentOptionAlias]);
/ @var ActivityNameRepository $activityNameRepository */
$activityNameRepository = $this->em->getRepository(ActivityName::class);
$activityName = $activityNameRepository->getByAlias($showcaseData['activityNameAlias']);
/ @var Locality $locality */
$locality = $pickupCity ? $this->em->find(Locality::class, $pickupCity) : null;
return $userCart
->setShowcase($showcaseData['showcase'])
->setPaymentOption($paymentOption)
// ->setStatus(UserCart::STATUS_SENT)
->setUser($this->em->find(User::class, $userId))
->setUserCompany($this->em->find(Company::class, $companyId))
->setCompany($this->em->find(Company::class, $showcaseData['companyId']))
->setActivityId($showcaseData['activityId'])
->setActivityName($activityName)
->setCurrency($this->em->find(Unit::class, $showcaseData['currency']))
->setBrutMe($this->em->find(Unit::class, $showcaseData['brutMe']))
->setNetMe($this->em->find(Unit::class, $showcaseData['netMe']))
->setVolumeMe($this->em->find(Unit::class, $showcaseData['volumeMe']))
->setCountMe($this->em->find(Unit::class, $showcaseData['countMe']))
->setTotalBrut($totalGross)
->setTotalNet($totalNet)
->setTotalVolume($totalVolume)
->setTotalCount($totalCount)
->setTotalPriceClient($totalPriceClient)
->setTotalPriceOwner($totalPriceOwner)
->setUserCartProducts($userCartProducts)
->setProductsCount(count($userCartProducts))
->setProductPositions($this->getCountProductPosition($userCartProducts))
->setUserDeliveryAddress($userDeliveryAddress)
->setNearestLocation($nearestLocation)
->setPickupCity($locality)
->setPaymentTypeOptions($paymentTypeOptions)
->setDeliveryPrice($deliveryPrice)
->setDeliveryPriceMe($deliveryPriceMe)
->setDeliveryDate($deliveryDate)
->setDeliveryTime($deliveryTime)
->setYandexId($yandexId);
}
/**
* @param UserCart $userCart
* @param Product[] $products
*
* @return array
*/
В return указываю обект, в итоге получаю ошибку "Return value of Showcases\\Service\\UserCartService\\UserCartService::createUserCart() must be an instance of Showcases\\Entity\\UserCart, null returned"
в setYandexId (фу) нема return
Обсуждают сегодня