123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?php
- namespace RadiusBundle\Entity;
- use Base\AdminBundle\Traits\TenancyIdTrait;
- use Base\AdminBundle\Traits\TenancyIdTraitInterface;
- use Doctrine\ORM\Mapping as ORM;
- use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
- use Symfony\Component\Validator\Constraints as Assert;
- use JMS\Serializer\Annotation as JMS;
- /**
- * @ORM\Table
- * @ORM\Entity
- */
- class Profile implements TenancyIdTraitInterface
- {
- use ExtraDataTrait;
- use TenancyIdTrait;
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=255)
- * @Assert\NotNull
- */
- private $name;
- /**
- * @var int
- *
- * @ORM\Column(type="bigint", nullable=true)
- */
- private $upload;
- /**
- * @var int
- *
- * @ORM\Column(type="bigint", nullable=true)
- */
- private $download;
- /**
- * @return string
- */
- public function __toString()
- {
- return (string)$this->name;
- }
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @param int $id
- *
- * @return Profile
- */
- public function setId($id)
- {
- $this->id = $id;
-
- return $this;
- }
- /**
- * @param string $name
- *
- * @return Profile
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * @param integer $upload
- *
- * @return Profile
- */
- public function setUpload($upload)
- {
- $this->upload = $upload;
- return $this;
- }
- /**
- * @return int
- */
- public function getUpload()
- {
- return $this->upload;
- }
- /**
- * @param integer $download
- *
- * @return Profile
- */
- public function setDownload($download)
- {
- $this->download = $download;
- return $this;
- }
- /**
- * @return int
- */
- public function getDownload()
- {
- return $this->download;
- }
- /**
- * @return string
- */
- public function getDownloadAsK()
- {
- return round($this->getDownload() / 1000, 2) . "k";
- }
- /**
- * @return string
- */
- public function getUploadAsK()
- {
- return round($this->getUpload() / 1000, 2) . "k";
- }
- /**
- * @return string
- */
- public function getRadiusName()
- {
- return preg_replace("|[^A-Za-z0-9]|", "-", $this->name);
- }
- }
|