* Navigation in Sidebar
* Seitenbaum: Jugendreisen und Reisemagazin mit einbeziehen; Ursprüngliche Sortierung berücksichtigen
* Neue Datenbank-Spalten für automatisch generierte Seitenübersichtsboxen und Datenbank
* Unterstützung statisch festgelegter URLs (page.real_url_path) - wird aus SEO-technischen Gründen benötigt, um vorerst die alten URLs zu behalten
* Redirect-Tabelle: Hier können alte URLs mit page-Einträge verknüpft werden. Bei Aufruf so einer URL wird auf die URL der verknüpften page umgeleitet
SQL:
UPDATE page SET template = 'overview' WHERE slug IN ('iran-reisen', 'marokko-urlaub');
UPDATE page SET `order` = 0 WHERE slug = 'aegypten-reisen';
UPDATE page SET `order` = 1 WHERE slug = 'israel-reisen';
UPDATE page SET `order` = 2 WHERE slug = 'jordanien-reisen';
UPDATE page SET `order` = 3 WHERE slug = 'iran-reisen';
UPDATE page SET `order` = 4 WHERE slug = 'marokko-urlaub';
UPDATE page SET `order` = 5 WHERE slug = 'oman-reisen';
UPDATE page SET `order` = 6 WHERE slug = 'tuerkei-urlaub';
UPDATE page SET template = 'overview' WHERE
(slug IN ('jugendreisen', 'reisemagazin') AND lvl = 0) OR
(catalog_id IN (6, 14) AND owner = 0);
-- Request URL /create-tree in browser to re-create the page tree
ALTER TABLE page ADD COLUMN real_url_path VARCHAR(200) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_140AB620E2652A2A ON page (real_url_path);
UPDATE page p INNER JOIN catalog c ON c.id = p.catalog_id SET p.real_url_path = CONCAT('/', c.slug, '/', p.slug, '.html');
ALTER TABLE page ADD COLUMN box_body TEXT DEFAULT NULL;
ALTER TABLE page ADD COLUMN box_image_url VARCHAR(200) DEFAULT NULL;
ALTER TABLE page ADD COLUMN box_star VARCHAR(255) DEFAULT NULL;
ALTER TABLE page ADD COLUMN box_discount VARCHAR(255) DEFAULT NULL;
ALTER TABLE page ADD COLUMN content_new TEXT DEFAULT NULL AFTER content;
ALTER TABLE page DROP COLUMN preview_image_url;
CREATE TABLE redirect (id INT AUTO_INCREMENT NOT NULL, page_id INT DEFAULT NULL, source_url_path VARCHAR(200) NOT NULL, UNIQUE INDEX UNIQ_C30C9E2B56207465 (source_url_path), INDEX IDX_C30C9E2BC4663E4 (page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
ALTER TABLE redirect ADD CONSTRAINT FK_C30C9E2BC4663E4 FOREIGN KEY (page_id) REFERENCES page (id);
ALTER TABLE redirect MODIFY COLUMN page_id INT NOT NULL;
git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3293 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
03f50fc03c
commit
6bb5c271c6
15 changed files with 596 additions and 125 deletions
|
|
@ -160,6 +160,13 @@ class Page
|
|||
*/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", length=65535, nullable=true)
|
||||
*
|
||||
* @todo Remove this field as soon as the new page is launched and instead use "content" again
|
||||
*/
|
||||
protected $contentNew;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
|
|
@ -238,10 +245,30 @@ class Page
|
|||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=true, unique=true)
|
||||
*/
|
||||
protected $realUrlPath;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=65535, nullable=true)
|
||||
*/
|
||||
protected $boxBody;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=true)
|
||||
*/
|
||||
protected $boxImageUrl;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $previewImageUrl;
|
||||
protected $boxStar;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $boxDiscount;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -553,7 +580,31 @@ class Page
|
|||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
return $this->contentNew ?? $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set contentNew
|
||||
*
|
||||
* @param string $contentNew
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setContentNew($contentNew)
|
||||
{
|
||||
$this->contentNew = $contentNew;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contentNew
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentNew()
|
||||
{
|
||||
return $this->contentNew;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -991,30 +1042,6 @@ class Page
|
|||
return $this->template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set previewImageUrl
|
||||
*
|
||||
* @param string $previewImageUrl
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setPreviewImageUrl($previewImageUrl)
|
||||
{
|
||||
$this->previewImageUrl = $previewImageUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get previewImageUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPreviewImageUrl()
|
||||
{
|
||||
return $this->previewImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelProgram
|
||||
*
|
||||
|
|
@ -1039,8 +1066,29 @@ class Page
|
|||
return $this->travelProgram;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $realUrlPath
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setRealUrlPath($realUrlPath)
|
||||
{
|
||||
$this->realUrlPath = $realUrlPath;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRealUrlPath()
|
||||
{
|
||||
return $this->realUrlPath;
|
||||
}
|
||||
|
||||
public function getUrlPath()
|
||||
{
|
||||
if ($this->realUrlPath !== null)
|
||||
{
|
||||
return $this->realUrlPath;
|
||||
}
|
||||
|
||||
$urlParts = [];
|
||||
$page = $this;
|
||||
do
|
||||
|
|
@ -1050,4 +1098,105 @@ class Page
|
|||
} while ($page !== null);
|
||||
return '/'. implode('/', array_reverse($urlParts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set boxBody
|
||||
*
|
||||
* @param string $boxBody
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setBoxBody($boxBody)
|
||||
{
|
||||
$this->boxBody = $boxBody;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get boxBody
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBoxBody()
|
||||
{
|
||||
return $this->boxBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set boxImageUrl
|
||||
*
|
||||
* @param string $boxImageUrl
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setBoxImageUrl($boxImageUrl)
|
||||
{
|
||||
$this->boxImageUrl = $boxImageUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get boxImageUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBoxImageUrl()
|
||||
{
|
||||
return $this->boxImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set boxStar
|
||||
*
|
||||
* @param string $boxStar
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setBoxStar($boxStar)
|
||||
{
|
||||
$this->boxStar = $boxStar;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get boxStar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBoxStar()
|
||||
{
|
||||
return $this->boxStar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set boxDiscount
|
||||
*
|
||||
* @param string $boxDiscount
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setBoxDiscount($boxDiscount)
|
||||
{
|
||||
$this->boxDiscount = $boxDiscount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get boxDiscount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBoxDiscount()
|
||||
{
|
||||
return $this->boxDiscount;
|
||||
}
|
||||
|
||||
public function getHasChildren()
|
||||
{
|
||||
return $this->lft != null && $this->rgt != null && $this->rgt - $this->lft > 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,4 +40,25 @@ class PageRepository extends NestedTreeRepository
|
|||
}
|
||||
return $pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Page $page
|
||||
*
|
||||
* @return Page[]|\Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getSiblings(Page $page)
|
||||
{
|
||||
$parent = $page->getParent();
|
||||
if (!$parent)
|
||||
{
|
||||
// #TODO Return all root pages
|
||||
return [];
|
||||
}
|
||||
$siblings = $parent->getChildren();
|
||||
foreach ($siblings as &$sibling)
|
||||
{
|
||||
$sibling->setParent($parent);
|
||||
}
|
||||
return $siblings;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
96
trunk/src/AppBundle/Entity/Redirect.php
Normal file
96
trunk/src/AppBundle/Entity/Redirect.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 02/15/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Redirect
|
||||
*
|
||||
* @ORM\Table(name="redirect")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\RedirectRepository")
|
||||
*/
|
||||
class Redirect
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=false, unique=true)
|
||||
*/
|
||||
private $sourceUrlPath;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Page")
|
||||
* @ORM\JoinColumn(name="page_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sourceUrlPath
|
||||
*
|
||||
* @param string $sourceUrlPath
|
||||
*
|
||||
* @return Redirect
|
||||
*/
|
||||
public function setSourceUrlPath($sourceUrlPath)
|
||||
{
|
||||
$this->sourceUrlPath = $sourceUrlPath;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sourceUrlPath
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceUrlPath()
|
||||
{
|
||||
return $this->sourceUrlPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set page
|
||||
*
|
||||
* @param \AppBundle\Entity\Page $page
|
||||
*
|
||||
* @return Redirect
|
||||
*/
|
||||
public function setPage(\AppBundle\Entity\Page $page = null)
|
||||
{
|
||||
$this->page = $page;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get page
|
||||
*
|
||||
* @return \AppBundle\Entity\Page
|
||||
*/
|
||||
public function getPage()
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
}
|
||||
13
trunk/src/AppBundle/Entity/RedirectRepository.php
Normal file
13
trunk/src/AppBundle/Entity/RedirectRepository.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* RedirectRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class RedirectRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue