add point type + Address: add Point field : fix dependency injection of the Point type

This commit is contained in:
nobohan 2021-04-20 10:55:45 +02:00
parent 7d1a1c4004
commit 9a4f50472a
5 changed files with 24 additions and 7 deletions

View File

@ -188,8 +188,12 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
$container->prependExtensionConfig('doctrine', array(
'dbal' => [
'types' => [
'dateinterval' => \Chill\MainBundle\Doctrine\Type\NativeDateIntervalType::class,
'json' => \Chill\MainBundle\Doctrine\Type\PointType::class
'dateinterval' => [
'class' => \Chill\MainBundle\Doctrine\Type\NativeDateIntervalType::class
],
'point' => [
'class' => \Chill\MainBundle\Doctrine\Type\PointType::class
]
]
]
));

View File

@ -1,6 +1,6 @@
<?php
namespace Chill\MainBundle\Entity;
namespace Chill\MainBundle\Doctrine\Model;
use \JsonSerializable;

View File

@ -1,6 +1,6 @@
<?php
namespace Chill\MainBundle\Entity;
namespace Chill\MainBundle\Doctrine\Model;
use \Exception;

View File

@ -2,10 +2,10 @@
namespace Chill\MainBundle\Doctrine\Type;
use Chill\MainBundle\Entity\Point;
use Chill\MainBundle\Doctrine\Model\Point;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Chill\MainBundle\Entity\PointException;
use Chill\MainBundle\Doctrine\Model\PointException;
/**

View File

@ -4,6 +4,7 @@ namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Doctrine\Model\Point;
/**
* Address
@ -125,7 +126,7 @@ class Address
*
* @var Point|null
*
* @ORM\Column(type="Point", nullable=true)
* @ORM\Column(type="point", nullable=true)
*/
private $point;
@ -474,5 +475,17 @@ class Address
return $this;
}
public function getPoint(): ?Point
{
return $this->point;
}
public function setPoint(?Point $point): self
{
$this->point = $point;
return $this;
}
}