initResource() public method

Initializes new resource object
public initResource ( ) : WellCommerce\Bundle\DoctrineBundle\Entity\EntityInterface
return WellCommerce\Bundle\DoctrineBundle\Entity\EntityInterface
 private function createLocale(string $localeCode, string $targetLocaleCurrency) : LocaleInterface
 {
     $currency = $this->getTargetCurrency($targetLocaleCurrency);
     /** @var LocaleInterface $locale */
     $locale = $this->localeManager->initResource();
     $locale->setCode($localeCode);
     $locale->setEnabled(true);
     $locale->setCurrency($currency);
     $this->localeManager->createResource($locale);
     return $locale;
 }
 private function getProductDistinction(ProductInterface $product, ProductStatusInterface $status) : ProductDistinctionInterface
 {
     $distinction = $this->manager->getRepository()->findOneBy(['product' => $product, 'status' => $status]);
     if (!$distinction instanceof ProductDistinctionInterface) {
         /** @var ProductDistinctionInterface $distinction */
         $distinction = $this->manager->initResource();
         $distinction->setProduct($product);
         $distinction->setStatus($status);
     }
     return $distinction;
 }
 public function upload(UploadedFile $file, $dir) : MediaInterface
 {
     if (!$file->isValid()) {
         throw new InvalidMediaException('Passed file object is not valid');
     }
     /** @var MediaInterface $media */
     $media = $this->manager->initResource();
     $media->setName($file->getClientOriginalName());
     $media->setExtension($file->guessClientExtension());
     $media->setMime($file->getClientMimeType());
     $media->setSize($file->getClientSize());
     $errors = $this->validatorHelper->validate($media);
     if (0 !== count($errors)) {
         throw new InvalidMediaException($errors);
     }
     $this->manager->createResource($media);
     $file->move($this->getUploadDir($dir), $media->getPath());
     return $media;
 }
 /**
  * Automatic register process
  *
  * @param FacebookUser $facebookUser
  *
  * @return ClientInterface
  */
 protected function autoRegisterClient(FacebookUser $facebookUser)
 {
     $firstName = $facebookUser->getFirstName();
     $lastName = $facebookUser->getLastName();
     $email = $facebookUser->getEmail();
     /** @var $client ClientInterface */
     $client = $this->clientManager->initResource();
     $client->getClientDetails()->setUsername($email);
     $client->getClientDetails()->setPassword(Helper::generateRandomPassword());
     $client->getContactDetails()->setEmail($email);
     $client->getContactDetails()->setFirstName($firstName);
     $client->getContactDetails()->setLastName($lastName);
     $client->getContactDetails()->setPhone(' ');
     $client->getContactDetails()->setSecondaryPhone(' ');
     $this->clientManager->createResource($client);
     return $client;
 }
 /**
  * {@inheritdoc}
  */
 public function handleCreateRequest(Request $request)
 {
     $result = $this->manager->initResource();
     $data = $this->serializer->serialize($result, self::RESPONSE_FORMAT, ['group' => $this->getResourceType()]);
     return new Response($data);
 }