public function process(Document $document, $type)
 {
     $url = $document->getUrl();
     $baseUrl = $this->requestContext->getBaseUrl();
     if (empty($baseUrl) || strpos($url, $baseUrl) !== 0) {
         return;
     }
     $url = substr($url, strlen($baseUrl));
     $document->setUrl($url);
 }
예제 #2
0
 /**
  * @param string    $type
  * @param int       $typeId
  * @param string    $title
  * @param string    $description
  * @param \DateTime $publishDate
  * @param string    $url
  * @param Field[]   $fieldList
  */
 public function __construct($type, $typeId, $title, $description, \DateTime $publishDate, $url, $fieldList = [])
 {
     parent::__construct($title, $description, $publishDate, $url, []);
     $this->type = $type;
     $this->typeId = $typeId;
     $this->fieldList = new ArrayCollection();
     foreach ($fieldList as $field) {
         $this->addField($field);
     }
 }