/** * @param \Orm\Zed\Customer\Persistence\SpyCustomer $customerEntity * * @return bool */ protected function isEmailAvailableForCustomer(SpyCustomer $customerEntity) { $count = $this->queryContainer->queryCustomerByEmailApartFromIdCustomer($customerEntity->getEmail(), $customerEntity->getIdCustomer())->count(); return $count === 0; }
/** * @param \Generated\Shared\Transfer\AddressTransfer $addressTransfer * @param \Orm\Zed\Customer\Persistence\SpyCustomer $customer * * @throws \Spryker\Zed\Customer\Business\Exception\AddressNotFoundException * * @return \Orm\Zed\Customer\Persistence\SpyCustomerAddress */ protected function updateCustomerAddress(AddressTransfer $addressTransfer, SpyCustomer $customer) { $addressEntity = $this->queryContainer->queryAddressForCustomer($addressTransfer->getIdCustomerAddress(), $customer->getEmail())->findOne(); if (!$addressEntity) { throw new AddressNotFoundException(sprintf('Address not found for ID `%s` and customer email `%s`.', $addressTransfer->getIdCustomerAddress(), $customer->getEmail())); } $fkCountry = $this->retrieveFkCountry($addressTransfer); $addressEntity->fromArray($addressTransfer->modifiedToArray()); $addressEntity->setCustomer($customer); $addressEntity->setFkCountry($fkCountry); $addressEntity->save(); return $addressEntity; }