Exemple #1
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;
 }
Exemple #2
0
 /**
  * @param string $url
  * @param string $resourceType
  * @param int $idResource
  *
  * @return \Orm\Zed\Url\Persistence\SpyUrl
  */
 public function createUrlForCurrentLocale($url, $resourceType, $idResource)
 {
     $this->checkUrlDoesNotExist($url);
     $fkLocale = $this->localeFacade->getCurrentLocale()->getIdLocale();
     $urlEntity = new SpyUrl();
     $urlEntity->setFkLocale($fkLocale)->setUrl($url)->setResource($resourceType, $idResource);
     $urlEntity->save();
     return $urlEntity;
 }
Exemple #3
0
 /**
  * @param \Orm\Zed\Url\Persistence\SpyUrl $urlEntity
  *
  * @return string
  */
 protected function buildLinks(SpyUrl $urlEntity)
 {
     $buttons[] = $this->generateEditButton(sprintf('/cms/redirect/edit?%s=%s', RedirectController::REQUEST_ID_URL, $urlEntity->getIdUrl()), 'Edit');
     $buttons[] = $this->generateRemoveButton('/cms/redirect/delete', 'Delete', [RedirectController::REQUEST_ID_URL_REDIRECT => $urlEntity->getSpyUrlRedirect()->getIdUrlRedirect()]);
     return implode(' ', $buttons);
 }