mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 04:23:49 +00:00
sf4 deprecated: migrate Doctrine ORM mapping to annotation
This commit is contained in:
@@ -2,30 +2,45 @@
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
* Address
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="chill_main_address")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class Address
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
*/
|
||||
private $streetAddress1 = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
*/
|
||||
private $streetAddress2 = '';
|
||||
|
||||
/**
|
||||
* @var \Chill\MainBundle\Entity\PostalCode
|
||||
* @var PostalCode
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
|
||||
*/
|
||||
private $postcode;
|
||||
|
||||
@@ -34,6 +49,8 @@ class Address
|
||||
* of address. By default, the current date.
|
||||
*
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(type="date")
|
||||
*/
|
||||
private $validFrom;
|
||||
|
||||
@@ -41,15 +58,19 @@ class Address
|
||||
* True if the address is a "no address", aka homeless person, ...
|
||||
*
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $isNoAddress = false;
|
||||
|
||||
|
||||
/**
|
||||
* Address constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->validFrom = new \DateTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
@@ -111,11 +132,11 @@ class Address
|
||||
/**
|
||||
* Set postcode
|
||||
*
|
||||
* @param \Chill\MainBundle\Entity\PostalCode $postcode
|
||||
* @param PostalCode $postcode
|
||||
*
|
||||
* @return Address
|
||||
*/
|
||||
public function setPostcode(\Chill\MainBundle\Entity\PostalCode $postcode = null)
|
||||
public function setPostcode(PostalCode $postcode = null)
|
||||
{
|
||||
$this->postcode = $postcode;
|
||||
|
||||
@@ -125,7 +146,7 @@ class Address
|
||||
/**
|
||||
* Get postcode
|
||||
*
|
||||
* @return \Chill\MainBundle\Entity\PostalCode
|
||||
* @return PostalCode
|
||||
*/
|
||||
public function getPostcode()
|
||||
{
|
||||
@@ -133,7 +154,6 @@ class Address
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getValidFrom()
|
||||
@@ -142,9 +162,8 @@ class Address
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \DateTime $validFrom
|
||||
* @return \Chill\MainBundle\Entity\Address
|
||||
* @return Address
|
||||
*/
|
||||
public function setValidFrom(\DateTime $validFrom)
|
||||
{
|
||||
@@ -153,7 +172,7 @@ class Address
|
||||
}
|
||||
|
||||
/**
|
||||
* get "isNoAddress"
|
||||
* Get IsNoAddress
|
||||
*
|
||||
* Indicate true if the address is a fake address (homeless, ...)
|
||||
*
|
||||
@@ -164,13 +183,16 @@ class Address
|
||||
return $this->isNoAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNoAddress(): bool
|
||||
{
|
||||
return $this->getIsNoAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* set Is No Address
|
||||
* Set IsNoAddress
|
||||
*
|
||||
* Indicate true if the address is a fake address (homeless, ...)
|
||||
*
|
||||
@@ -223,8 +245,11 @@ class Address
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Address $original
|
||||
* @return Address
|
||||
*/
|
||||
public static function createFromAddress(Address $original) : Address
|
||||
{
|
||||
return (new Address())
|
||||
|
Reference in New Issue
Block a user