* slide position handling

This commit is contained in:
Dávid Danyi
2018-04-17 17:21:44 +02:00
parent 71d6577810
commit 553f413e16
7 changed files with 115 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ use JsonSerializable;
/**
* @ORM\Entity
* @ORM\Table(name="slides")
* @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
*/
class Slide implements JsonSerializable
{
@@ -61,6 +62,13 @@ class Slide implements JsonSerializable
*/
private $updatedAt;
/**
* @ORM\Column(name="position", type="integer")
* @Gedmo\SortablePosition
* @var int
*/
private $position;
/**
* @return int
*/
@@ -187,6 +195,24 @@ class Slide implements JsonSerializable
return $this;
}
/**
* @return int
*/
public function getPosition(): ?int
{
return $this->position;
}
/**
* @param int $position
* @return Slide
*/
public function setPosition(?int $position): Slide
{
$this->position = $position;
return $this;
}
/**
* @return array
*/
@@ -204,6 +230,7 @@ class Slide implements JsonSerializable
'updatedAt' => $this->getUpdatedAt()
? $this->getUpdatedAt()->format("Y-m-d H:i:s")
: null,
'position' => $this->getPosition(),
];
}
}