mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Simplify setCenters method and remove readonly property
The commit simplifies the setCenters method in the ThirdParty class by directly assigning the incoming centers collection to the $centers property. Additionally, the readonly keyword has been removed from the $centers property declaration, allowing its value to be modified.
This commit is contained in:
parent
510023d630
commit
8a2f3d3dd0
@ -149,7 +149,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_3party.party_center")
|
||||
*/
|
||||
private readonly Collection $centers;
|
||||
private Collection $centers;
|
||||
|
||||
/**
|
||||
* Contact Persons: One Institutional ThirdParty has Many Contact Persons.
|
||||
@ -691,15 +691,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
*/
|
||||
public function setCenters(Collection $centers)
|
||||
{
|
||||
foreach ($centers as $center) {
|
||||
$this->addCenter($center);
|
||||
}
|
||||
|
||||
foreach ($this->centers as $center) {
|
||||
if (false === $centers->contains($center)) {
|
||||
$this->removeCenter($center);
|
||||
}
|
||||
}
|
||||
$this->centers = $centers;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user