|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use App\Entity\OrderShop;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
-
-
- abstract class Visitor
- {
-
-
- protected $cookie;
-
-
-
- protected $lastAccess;
-
-
-
- protected $ip;
-
-
-
- protected $totalVisit;
-
-
-
- protected $orders;
-
- public function __construct()
- {
- $this->orders = new ArrayCollection();
- }
-
- public function __toString()
- {
- return $this->getLastAccess()->format('d-m-y h:i') .'( visites :'.$this->totalVisit.')';
- }
- public function getSummary(){
- return 'Visiteur non inscrit ( visites :'.$this->totalVisit.')';
- }
-
- public function getCookie(): ?string
- {
- return $this->cookie;
- }
-
- public function setCookie(?string $cookie): self
- {
- $this->cookie = $cookie;
-
- return $this;
- }
-
- public function getLastAccess(): ?\DateTimeInterface
- {
- return $this->lastAccess;
- }
-
- public function setLastAccess(\DateTimeInterface $lastAccess): self
- {
- $this->lastAccess = $lastAccess;
-
- return $this;
- }
-
- public function getIp(): ?string
- {
- return $this->ip;
- }
-
- public function setIp(?string $ip): self
- {
- $this->ip = $ip;
-
- return $this;
- }
-
- public function getTotalVisit(): ?int
- {
- return $this->totalVisit;
- }
-
- public function setTotalVisit(int $totalVisit): self
- {
- $this->totalVisit = $totalVisit;
-
- return $this;
- }
-
-
-
- public function getOrders(): Collection
- {
- return $this->orders;
- }
-
- public function addOrder(OrderShop $order): self
- {
- if (!$this->orders->contains($order)) {
- $this->orders[] = $order;
- $order->setVisitor($this);
- }
-
- return $this;
- }
-
- public function removeOrder(OrderShop $order): self
- {
- if ($this->orders->contains($order)) {
- $this->orders->removeElement($order);
-
- if ($order->getVisitor() === $this) {
- $order->setVisitor(null);
- }
- }
-
- return $this;
- }
- }
|