mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
improve check in setters and add types in repositories
This commit is contained in:
@@ -507,12 +507,7 @@ class User implements UserInterface, \Stringable
|
||||
|
||||
public function setMainScope(?Scope $mainScope): User
|
||||
{
|
||||
$currentScopeUnchanged = array_filter(
|
||||
$this->scopeHistories->toArray(),
|
||||
fn($row) => $row->getEndDate() === null && $row->getScope() === $mainScope
|
||||
);
|
||||
|
||||
if (count($currentScopeUnchanged) > 0) {
|
||||
if ($mainScope === $this->getMainScope()) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -572,12 +567,7 @@ class User implements UserInterface, \Stringable
|
||||
|
||||
public function setUserJob(?UserJob $userJob): User
|
||||
{
|
||||
$currentJobUnchanged = array_filter(
|
||||
$this->jobHistories->toArray(),
|
||||
fn($row) => $row->getEndDate() === null && $row->getJob() === $userJob
|
||||
);
|
||||
|
||||
if (count($currentJobUnchanged) > 0) {
|
||||
if ($userJob === $this->getUserJob()) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user