- <?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;
- }
- }
|