getRepository() public method

Returns the repository
public getRepository ( ) : WellCommerce\Bundle\DoctrineBundle\Repository\RepositoryInterface
return WellCommerce\Bundle\DoctrineBundle\Repository\RepositoryInterface
 private function findLayoutBox($identifier) : LayoutBoxInterface
 {
     $layoutBox = $this->manager->getRepository()->findOneBy(['identifier' => $identifier]);
     if (!$layoutBox instanceof LayoutBoxInterface) {
         throw new LayoutBoxNotFoundException($identifier);
     }
     return $layoutBox;
 }
 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 getUser($authorizationCode, UserProviderInterface $userProvider)
 {
     $accessToken = $this->getProvider()->getAccessToken('authorization_code', ['code' => $authorizationCode]);
     /** @var FacebookUser $userDetails */
     $userDetails = $this->getProvider()->getResourceOwner($accessToken);
     $email = $userDetails->getEmail();
     $user = $this->clientManager->getRepository()->findOneBy(['clientDetails.username' => $email]);
     if (!$user instanceof ClientInterface) {
         $user = $this->autoRegisterClient($userDetails);
     }
     return $user;
 }
Ejemplo n.º 4
0
 /**
  * Returns the resource by its identifier or throws an exception if it was not found
  *
  * @param integer $identifier
  *
  * @return object
  * @throws ResourceNotFoundException
  */
 protected function getResourceById($identifier)
 {
     $resource = $this->manager->getRepository()->find($identifier);
     if (null === $resource) {
         throw new ResourceNotFoundException($this->getResourceType(), $identifier);
     }
     return $resource;
 }
Ejemplo n.º 5
0
 private function getResourceById(int $identifier) : EntityInterface
 {
     $resource = $this->manager->getRepository()->find($identifier);
     if (null === $resource) {
         throw new ResourceNotFoundException($this->getResourceType(), $identifier);
     }
     return $resource;
 }
Ejemplo n.º 6
0
 public function generate(string $name, $id, string $locale, $values, int $iteration = 0) : string
 {
     $slug = Sluggable::makeSlug($name);
     $existsInValues = in_array($slug, (array) $values);
     // if slug is the same as other values, try to add locale part
     if ($existsInValues) {
         $slug = sprintf('%s-%s', $slug, $locale);
     }
     $route = $this->manager->getRepository()->findOneBy(['path' => $slug]);
     if (null !== $route) {
         // if passed identifier and locale are same as in route, assume we can change the slug directly
         if ($this->hasRouteSameLocaleAndId($route, $locale, $id)) {
             return $slug;
         } else {
             $iteration++;
             $slug = $this->makeSlugIterated($slug, $iteration);
             return $this->generate($slug, $id, $locale, $values, $iteration);
         }
     }
     return $slug;
 }
Ejemplo n.º 7
0
 private function findLocale(string $code) : LocaleInterface
 {
     return $this->localeManager->getRepository()->findOneBy(['code' => $code]);
 }