mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add new fields on Address and Household
This commit is contained in:
parent
f61af9d02a
commit
0a894b0db1
@ -5,6 +5,7 @@ namespace Chill\MainBundle\Entity;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
use Chill\MainBundle\Doctrine\Model\Point;
|
use Chill\MainBundle\Doctrine\Model\Point;
|
||||||
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address
|
* Address
|
||||||
@ -130,6 +131,16 @@ class Address
|
|||||||
*/
|
*/
|
||||||
private $point;
|
private $point;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ThirdParty reference for person's addresses that are linked to a third party
|
||||||
|
*
|
||||||
|
* @var ThirdParty|null
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
|
*/
|
||||||
|
private $linkedToThirdParty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of metadata, added by customizable fields
|
* A list of metadata, added by customizable fields
|
||||||
*
|
*
|
||||||
@ -142,7 +153,6 @@ class Address
|
|||||||
$this->validFrom = new \DateTime();
|
$this->validFrom = new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
@ -487,5 +497,17 @@ class Address
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLinkedToThirdParty()
|
||||||
|
{
|
||||||
|
return $this->linkedToThirdParty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLinkedToThirdParty($linkedToThirdParty): self
|
||||||
|
{
|
||||||
|
$this->linkedToThirdParty = $linkedToThirdParty;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ namespace Chill\PersonBundle\Entity\Household;
|
|||||||
|
|
||||||
use Chill\PersonBundle\Repository\Household\HouseholdRepository;
|
use Chill\PersonBundle\Repository\Household\HouseholdRepository;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Chill\MainBundle\Entity\Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity(repositoryClass=HouseholdRepository::class)
|
* @ORM\Entity(repositoryClass=HouseholdRepository::class)
|
||||||
@ -21,4 +23,48 @@ class Household
|
|||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Addresses
|
||||||
|
* @var Collection
|
||||||
|
*
|
||||||
|
* @ORM\ManyToMany(
|
||||||
|
* targetEntity="Chill\MainBundle\Entity\Address",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"})
|
||||||
|
* @ORM\JoinTable(name="chill_person_household_to_addresses")
|
||||||
|
* @ORM\OrderBy({"validFrom" = "DESC"})
|
||||||
|
*/
|
||||||
|
private $addresses;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Address $address
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function addAddress(Address $address)
|
||||||
|
{
|
||||||
|
$this->addresses[] = $address;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Address $address
|
||||||
|
*/
|
||||||
|
public function removeAddress(Address $address)
|
||||||
|
{
|
||||||
|
$this->addresses->removeElement($address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, the addresses are ordered by date, descending (the most
|
||||||
|
* recent first)
|
||||||
|
*
|
||||||
|
* @return \Chill\MainBundle\Entity\Address[]
|
||||||
|
*/
|
||||||
|
public function getAddresses()
|
||||||
|
{
|
||||||
|
return $this->addresses;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user