mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Merge 9a8cdcdd73 into 9b6799e2b8
This commit is contained in:
commit
311fb554a1
3 changed files with 18 additions and 1 deletions
|
|
@ -114,7 +114,7 @@ sylius_grid:
|
|||
form_options:
|
||||
extra_options:
|
||||
class: '%sylius.model.customer.class%'
|
||||
choice_label: fullname
|
||||
choice_label: nameOrEmail
|
||||
date:
|
||||
type: date
|
||||
label: sylius.ui.date
|
||||
|
|
|
|||
|
|
@ -89,6 +89,21 @@ class Customer implements CustomerInterface, \Stringable
|
|||
return trim(sprintf('%s %s', $this->firstName, $this->lastName));
|
||||
}
|
||||
|
||||
public function getNameOrEmail(): string
|
||||
{
|
||||
$fullName = $this->getFullName();
|
||||
|
||||
if ('' !== $fullName && null !== $this->email) {
|
||||
return sprintf('%s (%s)', $fullName, $this->email);
|
||||
}
|
||||
|
||||
if ('' !== $fullName) {
|
||||
return $fullName;
|
||||
}
|
||||
|
||||
return (string) $this->email;
|
||||
}
|
||||
|
||||
public function getFirstName(): ?string
|
||||
{
|
||||
return $this->firstName;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ interface CustomerInterface extends TimestampableInterface, ResourceInterface
|
|||
|
||||
public function getFullName(): string;
|
||||
|
||||
public function getNameOrEmail(): string;
|
||||
|
||||
public function getFirstName(): ?string;
|
||||
|
||||
public function setFirstName(?string $firstName): void;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue