1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace App\Entity\EntityTrait;
use App\Entity\Geoloc;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
trait GeolocEntityTrait
{
/**
* @var Geoloc
*
* @ORM\OneToOne(targetEntity="Geoloc", cascade={"persist"}, orphanRemoval=true)
* @Groups({"read", "write"})
*/
private $geoloc;
public function getGeoloc(): ?Geoloc
{
return $this->geoloc;
}
public function setGeoloc(Geoloc $geoloc)
{
$this->geoloc = $geoloc;
return $this;
}
public function getFullAddresse()
{
if (null != $this->geoloc) {
return $this->geoloc->getAdresse() . ' ' . $this->geoloc->getCpostal() . ' ' . $this->geoloc->getVille();
}
return '';
}
}