GeolocEntityTrait.php 794 Bytes
Newer Older
Julien Jorry committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php

namespace App\Entity\EntityTrait;

use App\Entity\Geoloc;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;

trait GeolocEntityTrait
{
    /**
     * @var Geoloc
     *
     * @ORM\OneToOne(targetEntity="Geoloc", cascade={"persist"}, orphanRemoval=true)
     */
    private $geoloc;

19
    public function getGeoloc(): ?Geoloc
Julien Jorry committed
20 21 22 23 24 25 26 27 28
    {
        return $this->geoloc;
    }

    public function setGeoloc(Geoloc $geoloc)
    {
        $this->geoloc = $geoloc;
        return $this;
    }
29 30 31 32 33 34 35 36

    public function getFullAddresse()
    {
        if ($this->geoloc != null) {
            return $this->geoloc->getAdresse().' '.$this->geoloc->getCpostal().' '.$this->geoloc->getVille();
        }
        return '';
    }
37
}