fix: retourne un tableau pour les Options d'un Attribut
This commit is contained in:
parent
cf761709dd
commit
2013b4e1cc
1 changed files with 2 additions and 1 deletions
|
|
@ -27,7 +27,8 @@ final readonly class Attribute {
|
||||||
$terms = $attribute->get_terms() ?? [];
|
$terms = $attribute->get_terms() ?? [];
|
||||||
/** @var list<AttributeOption> */
|
/** @var list<AttributeOption> */
|
||||||
$options = Arr::map($terms, AttributeOption::new(...))
|
$options = Arr::map($terms, AttributeOption::new(...))
|
||||||
|> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id));
|
|> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id))
|
||||||
|
|> array_values(...);
|
||||||
|
|
||||||
return new self(name: $name, slug: $slug, options: $options);
|
return new self(name: $name, slug: $slug, options: $options);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue