vendor/tchoulom/view-counter-bundle/Entity/ViewCounter.php line 152

Open in your IDE?
  1. <?php
  2. /**
  3.  * This file is part of the TchoulomViewCounterBundle package.
  4.  *
  5.  * @package    TchoulomViewCounterBundle
  6.  * @author     Original Author <tchoulomernest@yahoo.fr>
  7.  *
  8.  * (c) Ernest TCHOULOM
  9.  *
  10.  * For the full copyright and license information, please view the LICENSE
  11.  * file that was distributed with this source code.
  12.  */
  13. namespace Tchoulom\ViewCounterBundle\Entity;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Doctrine\ORM\Mapping\MappedSuperclass;
  16. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  17. use Tchoulom\ViewCounterBundle\Model\ViewCountable;
  18. /**
  19.  * ViewCounter
  20.  *
  21.  * @ORM\MappedSuperclass
  22.  * @ORM\HasLifecycleCallbacks
  23.  */
  24. abstract class ViewCounter implements ViewCounterInterface
  25. {
  26.     /**
  27.      * @ORM\Id
  28.      * @ORM\Column(type="integer")
  29.      * @ORM\GeneratedValue(strategy="AUTO")
  30.      */
  31.     protected $id;
  32.     /**
  33.      * @var text $ip
  34.      *
  35.      * @ORM\Column(name="ip", type="text", nullable=false)
  36.      */
  37.     protected $ip;
  38.     /**
  39.      * @var \DateTime
  40.      *
  41.      * @ORM\Column(name="view_date", type="datetime", nullable=false)
  42.      */
  43.     protected $viewDate;
  44.     /**
  45.      * The property name.
  46.      *
  47.      * @var string
  48.      */
  49.     protected $property;
  50.     /**
  51.      * Gets the ID
  52.      *
  53.      * @return integer
  54.      */
  55.     public function getId()
  56.     {
  57.         return $this->id;
  58.     }
  59.     /**
  60.      * Gets the IP
  61.      *
  62.      * @return text
  63.      */
  64.     public function getIp()
  65.     {
  66.         return $this->ip;
  67.     }
  68.     /**
  69.      * Sets viewDate
  70.      *
  71.      * @param $ip
  72.      *
  73.      * @return self
  74.      */
  75.     public function setIp($ip)
  76.     {
  77.         $this->ip $ip;
  78.         return $this;
  79.     }
  80.     /**
  81.      * Gets viewDate
  82.      *
  83.      * @return \DateTime
  84.      */
  85.     public function getViewDate()
  86.     {
  87.         return $this->viewDate;
  88.     }
  89.     /**
  90.      * Sets viewDate
  91.      *
  92.      * @param \DateTime $viewDate
  93.      *
  94.      * @return self
  95.      */
  96.     public function setViewDate($viewDate)
  97.     {
  98.         $this->viewDate $viewDate;
  99.         return $this;
  100.     }
  101.     /**
  102.      * Sets the property name.
  103.      *
  104.      * @param string $property
  105.      *
  106.      * @return self
  107.      */
  108.     public function setProperty(string $property): self
  109.     {
  110.         $this->property $property;
  111.         return $this;
  112.     }
  113.     /**
  114.      * Gets the property name.
  115.      *
  116.      * @return string
  117.      */
  118.     public function getProperty(): string
  119.     {
  120.         return $this->property;
  121.     }
  122.     /**
  123.      * Sets the page.
  124.      *
  125.      * @param ViewCountable $page
  126.      * @param string $property
  127.      *
  128.      * @return self
  129.      */
  130.     public function setPage(ViewCountable $page): self
  131.     {
  132.         $property $this->getProperty();
  133.         $setPage 'set' ucfirst($property);
  134.         $this->$setPage($page);
  135.         return $this;
  136.     }
  137.     /**
  138.      * Gets the page.
  139.      *
  140.      * @return ViewCountable|null
  141.      */
  142.     public function getPage(): ?ViewCountable
  143.     {
  144.         $property $this->getProperty();
  145.         $getPage 'get' ucfirst($property);
  146.         $page $this->$getPage();
  147.         return $page;
  148.     }
  149. }