示例#1
0
 /**
  * @param string $url
  *
  * @throws \Spryker\Zed\Url\Business\Exception\MissingUrlException
  *
  * @return \Orm\Zed\Url\Persistence\SpyUrl
  */
 public function getUrlByPath($url)
 {
     $urlEntity = $this->urlQueryContainer->queryUrl($url)->findOne();
     if (!$urlEntity) {
         throw new MissingUrlException(sprintf('Tried to retrieve url %s, but it is missing', $url));
     }
     return $urlEntity;
 }
示例#2
0
 /**
  * @return void
  */
 public function testSaveUrlUpdatesSomething()
 {
     $url = new UrlTransfer();
     $urlQuery = $this->urlQueryContainer->queryUrl('/SoManyPageUrls');
     $redirect1 = $this->urlFacade->createRedirect('/SoManyPageUrls2');
     $redirect2 = $this->urlFacade->createRedirect('/SoManyPageUrls3');
     $url->setUrl('/SoManyPageUrls')->setFkLocale($this->localeFacade->createLocale('WERTZ')->getIdLocale())->setResourceType('redirect')->setResourceId($redirect1->getIdUrlRedirect());
     $url = $this->urlFacade->saveUrl($url);
     $this->assertEquals($redirect1->getIdUrlRedirect(), $urlQuery->findOne()->getResourceId());
     $url->setResourceId($redirect2->getIdUrlRedirect());
     $this->urlFacade->saveUrl($url);
     $this->assertEquals($redirect2->getIdUrlRedirect(), $urlQuery->findOne()->getResourceId());
 }