@@ -181,9 +181,20 @@ abstract class User extends UserModelFOS | |||
/** | |||
* @return Collection|Address[] | |||
*/ | |||
public function getAddresses(): Collection | |||
{ | |||
return $this->addresses; | |||
public function getAddresses($status = null): Collection | |||
{ | |||
if($status){ | |||
$addressToReturn = new ArrayCollection(); | |||
foreach ($this->addresses as $address){ | |||
if($address->getStatus() == $status) { | |||
$addressToReturn[] = $address; | |||
} | |||
} | |||
return $addressToReturn; | |||
}else{ | |||
return $this->addresses; | |||
} | |||
} | |||
public function addAddress(Address $address): self |
@@ -71,7 +71,7 @@ | |||
<div class="col-12"> | |||
{{ form_row(form.status) }} | |||
<p class="callout callout-info"> | |||
Sauf si vous avez ce que ce vous faites ce champ doit toujours être "Activer" | |||
Sauf si vous savez ce que ce vous faites ce champ doit toujours être "Activer" | |||
</p> | |||
</div> | |||
@@ -19,7 +19,9 @@ | |||
<div class="col-5"> | |||
<div class="row" id="user-addresses"> | |||
{% for address in entity.addresses %} | |||
{% if address.status >=0 %} | |||
{% include '@LcShop/backend/user/block_useraddress.html.twig' %} | |||
{% endif %} | |||
{% endfor %} | |||
</div> | |||
<button type="button" data-url="{{ path('easyadmin', {"action": 'editAddressUser', 'entity': 'User', 'id': entity.id, 'addressId': 'new'}) }}" |