<?php
/**
* (c) itmedia.by <info@itmedia.by>
*/
namespace Submarine\PropertiesBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Submarine\CoreBundle\Entity\SubmarineEntityInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Asset;
/**
* @ORM\Entity()
* @ORM\Table(name="submarine_properties_group")
*/
class Group implements SubmarineEntityInterface
{
/**
* @var int
*
* @ORM\Id()
* @ORM\Column(name="id", type="integer", nullable=false, unique=true)
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", nullable=false)
* @Asset\NotBlank()
*/
private $title;
/**
* @var Property[]|ArrayCollection
*
* @ORM\OneToMany(targetEntity="Submarine\PropertiesBundle\Entity\Property", mappedBy="group", indexBy="id")
* @ORM\OrderBy({"position" = "ASC", "title" = "ASC"})
*/
private $properties;
/**
* @var int
*
* @ORM\Column(name="position", type="integer", nullable=true)
*/
private $position = 10;
public function __construct()
{
$this->properties = new ArrayCollection();
}
/**
* Имя сущности
* @return string
*/
public static function entityName()
{
return __CLASS__;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return ArrayCollection|Property[]
*/
public function getProperties()
{
return $this->properties;
}
/**
* @return int
*/
public function getPosition()
{
return $this->position;
}
/**
* @param int $position
*/
public function setPosition($position)
{
$this->position = $position;
}
}