Skip to content

Commit

Permalink
For now simply brought the pages management back to life in a nasty way
Browse files Browse the repository at this point in the history
  • Loading branch information
ShurikAg committed Feb 20, 2016
1 parent 664d9f4 commit 25df01c
Show file tree
Hide file tree
Showing 11 changed files with 574 additions and 207 deletions.
142 changes: 75 additions & 67 deletions Entity/Area.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,95 +1,103 @@
<?php

namespace Arnm\PagesBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Blameable\Traits\BlameableEntity;

/**
* Arnm\PagesBundle\Entity\Area
*
* @ORM\Table(name="area")
* @ORM\Entity(repositoryClass="Arnm\PagesBundle\Entity\AreaRepository")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
* @Gedmo\Loggable
*
* @UniqueEntity("code")
*/
class Area
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
use SoftDeleteableEntity;
use TimestampableEntity;
use BlameableEntity;

/**
* @var string $code
*
* @ORM\Column(name="code", type="string", length=50)
*
* @Assert\NotNull()
* @Assert\NotBlank()
*
*/
private $code;
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var integer $templateId
*
* @ORM\Column(name="template_id", type="integer", nullable=true)
*/
private $templateId;
/**
* @var string $code
*
* @ORM\Column(name="code", type="string", length=50)
* @Gedmo\Versioned
*
* @Assert\NotNull()
* @Assert\NotBlank()
*/
private $code;

/**
* @ORM\ManyToOne(targetEntity="Template", inversedBy="areas")
* @ORM\JoinColumn(name="template_id", referencedColumnName="id", nullable=false)
*/
private $template;
/**
* @var integer $templateId
*
* @ORM\Column(name="template_id", type="integer", nullable=true)
*/
private $templateId;

/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @ORM\ManyToOne(targetEntity="Template", inversedBy="areas")
* @ORM\JoinColumn(name="template_id", referencedColumnName="id", nullable=false)
* @Gedmo\Versioned
*/
private $template;

/**
* Sets the ID
*
* @param int $id
*/
public function setId($id)
{
$this->id = (int) $id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}

/**
* Sets the ID
*
* @param int $id
*/
public function setId($id)
{
$this->id = (int) $id;
}

/**
* Set template
*
* @param Arnm\PagesBundle\Entity\Template $template
*/
public function setTemplate(Template $template)
{
$this->template = $template;
}
/**
* Set template
*
* @param Arnm\PagesBundle\Entity\Template $template
*/
public function setTemplate(Template $template)
{
$this->template = $template;
}

/**
* Get template
*
* @return Arnm\PagesBundle\Entity\Template
*/
public function getTemplate()
{
return $this->template;
}
/**
* Get template
*
* @return Arnm\PagesBundle\Entity\Template
*/
public function getTemplate()
{
return $this->template;
}

/**
* Set templateId
Expand Down
14 changes: 12 additions & 2 deletions Entity/Layout.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<?php

namespace Arnm\PagesBundle\Entity;

use Arnm\CoreBundle\Entity\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Arnm\PagesBundle\Entity\Page;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Blameable\Traits\BlameableEntity;
/**
* Arnm\PagesBundle\Entity\Layout
*
* @ORM\Table(name="layout")
* @ORM\Entity(repositoryClass="Arnm\PagesBundle\Entity\LayoutRepository")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
* @Gedmo\Loggable
*/
class Layout extends Entity
{
use SoftDeleteableEntity;
use TimestampableEntity;
use BlameableEntity;

/**
* @var integer $id
*
Expand All @@ -28,10 +36,12 @@ class Layout extends Entity
* @var string $layout
*
* @ORM\Column(name="layout", type="string", length=255)
* @Gedmo\Versioned
*
* @Assert\NotBlank()
*/
private $layout;

/**
* @ORM\OneToMany(targetEntity="Page", mappedBy="layout")
*/
Expand Down
57 changes: 25 additions & 32 deletions Entity/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Gedmo\Tree\Node;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Blameable\Traits\BlameableEntity;
use Doctrine\ORM\Mapping as ORM;
use Arnm\CoreBundle\Entity\Entity;
use Arnm\WidgetBundle\Entity\Widget;
Expand All @@ -15,9 +18,15 @@
* @Gedmo\Tree(type="nested")
* @ORM\Table(name="page")
* @ORM\Entity(repositoryClass="Arnm\PagesBundle\Entity\PageRepository")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
* @Gedmo\Loggable
*/
class Page extends Entity implements Node
{
use SoftDeleteableEntity;
use TimestampableEntity;
use BlameableEntity;

const STATUS_DTAFT = 'draft';
const STATUS_PUBLISHED = 'published';
/**
Expand All @@ -28,16 +37,19 @@ class Page extends Entity implements Node
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var integer $parentId
*
* @ORM\Column(name="parent_id", type="integer", nullable=true)
*/
private $parentId;

/**
* @var string $title
*
* @ORM\Column(name="title", type="string", length=255)
* @Gedmo\Versioned
*
* @Assert\NotBlank()
* @Assert\Length(
Expand All @@ -51,6 +63,7 @@ class Page extends Entity implements Node
*
* @Gedmo\Slug(fields={"title"})
* @ORM\Column(name="slug", type="string", length=255, unique=true)
* @Gedmo\Versioned
*
* @Assert\Type(type="string", message="The value {{ value }} is not a valid {{ type }}.")
* @Assert\Length(
Expand All @@ -63,12 +76,15 @@ class Page extends Entity implements Node
* @var string $pathSlug
*
* @ORM\Column(name="path_slug", type="string", length=255, nullable=true)
* @Gedmo\Versioned
*/
private $pathSlug;
/**
* @var string $description
*
* @ORM\Column(name="description", type="string", length=160, nullable=true)
* @Gedmo\Versioned
*
* @Assert\Length(
* min=3,
* max=160,
Expand All @@ -80,6 +96,7 @@ class Page extends Entity implements Node
* @var string $keywords
*
* @ORM\Column(name="keywords", type="string", length=160, nullable=true)
* @Gedmo\Versioned
*
* @Assert\Length(
* min=3,
Expand All @@ -91,27 +108,32 @@ class Page extends Entity implements Node
/**
* @Gedmo\TreeLeft
* @ORM\Column(name="lft", type="integer")
* @Gedmo\Versioned
*/
private $lft;
/**
* @Gedmo\TreeLevel
* @ORM\Column(name="lvl", type="integer")
* @Gedmo\Versioned
*/
private $lvl;
/**
* @Gedmo\TreeRight
* @ORM\Column(name="rgt", type="integer")
* @Gedmo\Versioned
*/
private $rgt;
/**
* @Gedmo\TreeRoot
* @ORM\Column(name="root", type="integer", nullable=true)
* @Gedmo\Versioned
*/
private $root;
/**
* @Gedmo\TreeParent
* @ORM\ManyToOne(targetEntity="Page", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
* @Gedmo\Versioned
*/
private $parent;
/**
Expand All @@ -122,16 +144,19 @@ class Page extends Entity implements Node
/**
* @ORM\ManyToOne(targetEntity="Layout", inversedBy="pages", fetch="EAGER")
* @ORM\JoinColumn(name="layout_id", referencedColumnName="id", nullable=true)
* @Gedmo\Versioned
*/
private $layout;
/**
* @ORM\ManyToOne(targetEntity="Template", inversedBy="pages", fetch="EAGER")
* @ORM\JoinColumn(name="template_id", referencedColumnName="id", nullable=true)
* @Gedmo\Versioned
*/
private $template;

/**
* @ORM\Column(name="status", type="string")
* @Gedmo\Versioned
*/
private $status;

Expand All @@ -141,22 +166,6 @@ class Page extends Entity implements Node
*/
private $widgets;

/**
* @var \DateTime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime", nullable=true)
*/
private $created;

/**
* @var \DateTime $updated
*
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime", nullable=true)
*/
private $updated;

/**
* Constructor
*/
Expand Down Expand Up @@ -495,20 +504,4 @@ public function getWidgets()
{
return $this->widgets;
}

/**
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}

/**
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
}
Loading

0 comments on commit 25df01c

Please sign in to comment.