mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix return type in user getters for mainScope and userJob
This commit is contained in:
parent
8a6f29ef79
commit
d2feb0f0b4
@ -262,7 +262,7 @@ class User implements UserInterface, \Stringable
|
|||||||
return $this->mainLocation;
|
return $this->mainLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMainScope(?DateTimeImmutable $at = null): ?UserScopeHistory
|
public function getMainScope(?DateTimeImmutable $at = null): ?Scope
|
||||||
{
|
{
|
||||||
$at ??= new DateTimeImmutable('today');
|
$at ??= new DateTimeImmutable('today');
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
@ -281,7 +281,7 @@ class User implements UserInterface, \Stringable
|
|||||||
$scopes = $this->scopeHistories->matching($criteria);
|
$scopes = $this->scopeHistories->matching($criteria);
|
||||||
|
|
||||||
if ($scopes->count() > 0) {
|
if ($scopes->count() > 0) {
|
||||||
return $scopes->first();
|
return $scopes->first()->getScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -305,7 +305,7 @@ class User implements UserInterface, \Stringable
|
|||||||
return $this->salt;
|
return $this->salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserJob(?DateTimeImmutable $at = null): ?UserJobHistory
|
public function getUserJob(?DateTimeImmutable $at = null): ?UserJob
|
||||||
{
|
{
|
||||||
$at ??= new DateTimeImmutable('today');
|
$at ??= new DateTimeImmutable('today');
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
@ -317,13 +317,13 @@ class User implements UserInterface, \Stringable
|
|||||||
$expr->isNull('endDate'),
|
$expr->isNull('endDate'),
|
||||||
$expr->gt('endDate', $at)
|
$expr->gt('endDate', $at)
|
||||||
),
|
),
|
||||||
$expr->lte('startDate')
|
$expr->lte('startDate', $at)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$jobs = $this->jobHistories->matching($criteria);
|
$jobs = $this->jobHistories->matching($criteria);
|
||||||
if ($jobs->count() > 0) {
|
if ($jobs->count() > 0) {
|
||||||
return $jobs->first();
|
return $jobs->first()->getJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -11,32 +11,16 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block table_entities_tbody %}
|
{% block table_entities_tbody %}
|
||||||
{{ dump(entities) }}
|
|
||||||
{#
|
|
||||||
#}
|
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{{ entity.startDate|format_datetime('medium') }}</td>
|
||||||
<td>
|
<td>
|
||||||
{# {{ dump(entity.id) }} #}
|
{{ (entity.endDate is null)
|
||||||
{{ entity.startDate|format_datetime('medium') }}
|
? "crud.admin_user_scope_history.index.today"|trans
|
||||||
</td>
|
: entity.endDate|format_datetime('medium') }}
|
||||||
<td>{{ entity.endDate|format_datetime('medium') }}</td>
|
|
||||||
<td>
|
|
||||||
{% for scope in entity.scope %}
|
|
||||||
{#
|
|
||||||
#}
|
|
||||||
{{ dump(scope) }}
|
|
||||||
{{ scope.label|localize_translatable_string }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% for user in entity.user %}
|
|
||||||
{#
|
|
||||||
#}
|
|
||||||
{{ dump(user.id) }}
|
|
||||||
{{ user.usernameCanonical }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{ entity.user.usernameCanonical }}</td>
|
||||||
|
<td>{{ entity.scope.name|localize_translatable_string }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -56,7 +56,9 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="dt">métier:</span>
|
<span class="dt">métier:</span>
|
||||||
{% if entity.userJob %}{{ entity.userJob.label|localize_translatable_string }}{% endif %}
|
{% if entity.userJob %}
|
||||||
|
{{ entity.userJob.label|localize_translatable_string }}
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="dt">cercle/centre:</span>
|
<span class="dt">cercle/centre:</span>
|
||||||
|
@ -11,32 +11,16 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block table_entities_tbody %}
|
{% block table_entities_tbody %}
|
||||||
{{ dump(entities) }}
|
|
||||||
{#
|
|
||||||
#}
|
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{{ entity.startDate|format_datetime('medium') }}</td>
|
||||||
<td>
|
<td>
|
||||||
{# {{ dump(entity.id) }} #}
|
{{ (entity.endDate is null)
|
||||||
{{ entity.startDate|format_datetime('medium') }}
|
? "crud.admin_user_job_history.index.today"|trans
|
||||||
</td>
|
: entity.endDate|format_datetime('medium') }}
|
||||||
<td>{{ entity.endDate|format_datetime('medium') }}</td>
|
|
||||||
<td>
|
|
||||||
{% for job in entity.job %}
|
|
||||||
{#
|
|
||||||
#}
|
|
||||||
{{ dump(job) }}
|
|
||||||
{{ job.label|localize_translatable_string }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% for user in entity.user %}
|
|
||||||
{#
|
|
||||||
#}
|
|
||||||
{{ dump(user.id) }}
|
|
||||||
{{ user.usernameCanonical }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{ entity.user.usernameCanonical }}</td>
|
||||||
|
<td>{{ entity.job.label|localize_translatable_string }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -393,7 +393,8 @@ crud:
|
|||||||
index:
|
index:
|
||||||
title: Historique des métiers
|
title: Historique des métiers
|
||||||
start: Du
|
start: Du
|
||||||
end: Au
|
end: Jusque
|
||||||
|
today: aujourd'hui
|
||||||
user: Utilisateur
|
user: Utilisateur
|
||||||
job: Métier
|
job: Métier
|
||||||
Show job history: Voir l'historique
|
Show job history: Voir l'historique
|
||||||
@ -402,7 +403,8 @@ crud:
|
|||||||
index:
|
index:
|
||||||
title: Historique des cercles
|
title: Historique des cercles
|
||||||
start: Du
|
start: Du
|
||||||
end: Au
|
end: Jusque
|
||||||
|
today: aujourd'hui
|
||||||
user: Utilisateur
|
user: Utilisateur
|
||||||
scope: Cercle
|
scope: Cercle
|
||||||
Show scope history: Voir l'historique
|
Show scope history: Voir l'historique
|
||||||
|
Loading…
x
Reference in New Issue
Block a user