diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php index 086b566da..0a0c160cd 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php @@ -21,7 +21,7 @@ class PointType extends Type { * * @param array $fieldDeclaration * @param AbstractPlatform $platform - * @return type + * @return string */ public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { @@ -32,7 +32,7 @@ class PointType extends Type { * * @param type $value * @param AbstractPlatform $platform - * @return Point + * @return ?Point */ public function convertToPHPValue($value, AbstractPlatform $platform) { diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index f3973ff0f..22e4848bf 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -383,6 +383,16 @@ class Address ; } + public static function createFromAddressReference(AddressReference $original): Address + { + return (new Address()) + ->setPoint($original->getPoint()) + ->setPostcode($original->getPostcode()) + ->setStreet($original->getStreet()) + ->setStreetNumber($original->getStreetNumber()) + ; + } + public function getStreet(): ?string { return $this->street; diff --git a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php index f040446b3..cf488f411 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php @@ -36,6 +36,14 @@ final class AddressReferenceRepository implements ObjectRepository return $this->repository->findAll(); } + public function countAll(): int + { + $qb = $this->repository->createQueryBuilder('ar'); + $qb->select('count(ar.id)'); + + return $qb->getQuery()->getSingleScalarResult(); + } + /** * @return AddressReference[] */