<?php
/**
* (c) itmedia.by <info@itmedia.by>
*/
namespace Submarine\PropertiesBundle\Entity;
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")
*/
class Property implements SubmarineEntityInterface
{
const TYPE_TEXT = 'text';
const TYPE_CHOICE = 'choice';
const TYPE_NUMBER = 'number';
const TYPE_TEXTAREA = 'textarea';
/**
* @var int
*
* @ORM\Id()
* @ORM\Column(name="id", type="integer", nullable=false, unique=true)
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var Group
* @ORM\ManyToOne(targetEntity="Submarine\PropertiesBundle\Entity\Group", inversedBy="properties")
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
*/
private $group;
/**
* @var string
*
* @ORM\Column(name="title", type="string", nullable=false)
* @Asset\NotBlank()
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="value_type", type="string", nullable=false)
*/
private $valueType = self::TYPE_TEXT;
/**
* @var string
*
* @ORM\Column(name="value_postfix", type="string", nullable=true)
*/
private $valuePostfix = '';
/**
* @var array
*
* @ORM\Column(name="values_choice", type="array", nullable=true)
*/
private $valuesChoice = [];
/**
* @var string
*
* @ORM\Column(name="value_default", type="string", nullable=true)
*/
private $valueDefault;
/**
* @var int
*
* @ORM\Column(name="position", type="integer", nullable=true)
*/
private $position = 0;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Имя сущности
* @return string
*/
public static function entityName()
{
return __CLASS__;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @return Group
*/
public function getGroup()
{
return $this->group;
}
/**
* @param Group $group
*/
public function setGroup(Group $group)
{
$this->group = $group;
}
/**
* @return string
*/
public function getValueType()
{
return $this->valueType;
}
/**
* @param string $valueType
*/
public function setValueType($valueType)
{
$this->valueType = $valueType;
}
/**
* @return string
*/
public function getValuePostfix()
{
return $this->valuePostfix;
}
/**
* @param string $valuePostfix
*/
public function setValuePostfix($valuePostfix)
{
$this->valuePostfix = $valuePostfix;
}
/**
* @return array
*/
public function getValuesChoice()
{
return $this->valuesChoice;
}
/**
* @param array $valuesChoice
*/
public function setValuesChoice($valuesChoice)
{
$this->valuesChoice = $valuesChoice;
}
/**
* @return string
*/
public function getValueDefault()
{
return $this->valueDefault;
}
/**
* @param string $valueDefault
*/
public function setValueDefault($valueDefault)
{
$this->valueDefault = $valueDefault;
}
/**
* @return int
*/
public function getPosition()
{
return $this->position;
}
/**
* @param int $position
*/
public function setPosition($position)
{
$this->position = $position;
}
}