Пример #1
0
 /**
  * @api
  *
  * @param \Generated\Shared\Transfer\PageTransfer $pageTransfer
  * @param string $url @deprecated Will be removed with the next major
  *
  * @return \Generated\Shared\Transfer\UrlTransfer
  */
 public function createPageUrl(PageTransfer $pageTransfer, $url)
 {
     $pageManager = $this->getFactory()->createPageManager();
     // For BC reasons only
     if ($url) {
         $urlTransfer = new UrlTransfer();
         $urlTransfer->setUrl($url);
         $pageTransfer->setUrl($urlTransfer);
     }
     return $pageManager->createPageUrl($pageTransfer);
 }
Пример #2
0
 /**
  * @param \Orm\Zed\Url\Persistence\SpyUrl $url
  * @param array $data
  *
  * @return \Generated\Shared\Transfer\UrlTransfer
  */
 protected function createUrlTransfer($url, $data)
 {
     $urlTransfer = new UrlTransfer();
     $urlTransfer->fromArray($url->toArray(), true);
     $urlTransfer->setUrl($data[CmsRedirectForm::FIELD_FROM_URL]);
     $urlTransfer->setFkRedirect($url->getFkResourceRedirect());
     $urlTransfer->setResourceId($url->getResourceId());
     $urlTransfer->setResourceType($url->getResourceType());
     return $urlTransfer;
 }
Пример #3
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());
 }
Пример #4
0
 /**
  * @param \Generated\Shared\Transfer\UrlTransfer $urlTransfer
  * @param string $url
  * @param int|null $idResource
  * @param int|null $idLocale
  *
  * @return void
  */
 protected function updateTransferUrl(UrlTransfer $urlTransfer, $url, $idResource = null, $idLocale = null)
 {
     $urlTransfer->setResourceType(CategoryConstants::RESOURCE_TYPE_CATEGORY_NODE);
     if ($idResource !== null) {
         $urlTransfer->setResourceId($idResource);
     }
     if ($idLocale !== null) {
         $urlTransfer->setFkLocale($idLocale);
     }
     $urlTransfer->setUrl($url);
 }