From 4a69105d2788e31cca661386561fe1a9a3e04776 Mon Sep 17 00:00:00 2001 From: Christian Wolfram Date: Thu, 18 Apr 2024 20:00:50 +0200 Subject: [PATCH 1/2] [TASK] Make phone numbers sortable --- Classes/Domain/Model/Phone.php | 15 +++++++++++++++ .../TCA/tx_contacts_domain_model_company.php | 1 + .../TCA/tx_contacts_domain_model_contact.php | 1 + .../TCA/tx_contacts_domain_model_phone.php | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/Classes/Domain/Model/Phone.php b/Classes/Domain/Model/Phone.php index 2fa2017..5bbb953 100755 --- a/Classes/Domain/Model/Phone.php +++ b/Classes/Domain/Model/Phone.php @@ -23,6 +23,11 @@ class Phone extends AbstractEntity */ protected $number = ''; + /** + * @var int + */ + protected $sorting = 0; + /** * @param string $type * @throws \InvalidArgumentException @@ -78,4 +83,14 @@ public function getNumber() { return $this->number; } + + public function getSorting(): int + { + return $this->sorting; + } + + public function setSorting(int $sorting): void + { + $this->sorting = $sorting; + } } diff --git a/Configuration/TCA/tx_contacts_domain_model_company.php b/Configuration/TCA/tx_contacts_domain_model_company.php index f4777ff..2110a0a 100755 --- a/Configuration/TCA/tx_contacts_domain_model_company.php +++ b/Configuration/TCA/tx_contacts_domain_model_company.php @@ -349,6 +349,7 @@ 'type' => 'inline', 'foreign_table' => 'tx_contacts_domain_model_phone', 'foreign_field' => 'company', + 'foreign_sortby' => 'sorting', 'maxitems' => 9999, 'appearance' => [ 'collapseAll' => 1, diff --git a/Configuration/TCA/tx_contacts_domain_model_contact.php b/Configuration/TCA/tx_contacts_domain_model_contact.php index 8c4c81d..e7899ec 100755 --- a/Configuration/TCA/tx_contacts_domain_model_contact.php +++ b/Configuration/TCA/tx_contacts_domain_model_contact.php @@ -287,6 +287,7 @@ 'type' => 'inline', 'foreign_table' => 'tx_contacts_domain_model_phone', 'foreign_field' => 'contact', + 'foreign_sortby' => 'sorting', 'maxitems' => 9999, 'appearance' => [ 'collapseAll' => 1, diff --git a/Configuration/TCA/tx_contacts_domain_model_phone.php b/Configuration/TCA/tx_contacts_domain_model_phone.php index cd69c6c..0fab0ac 100755 --- a/Configuration/TCA/tx_contacts_domain_model_phone.php +++ b/Configuration/TCA/tx_contacts_domain_model_phone.php @@ -133,6 +133,12 @@ ], ], ], + 'sorting' => [ + 'label' => 'sorting', + 'config' => [ + 'type' => 'passthrough', + ], + ], 'type' => [ 'exclude' => 0, 'label' => $_LLL_db . ':tx_contacts_domain_model_phone.type', From f0f4875edfc5d85ce2fd24f7db3463d1df639314 Mon Sep 17 00:00:00 2001 From: Christian Wolfram Date: Thu, 18 Apr 2024 20:07:41 +0200 Subject: [PATCH 2/2] [TASK] Make code compatible with PHP 7.2 --- Classes/Domain/Model/Phone.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Model/Phone.php b/Classes/Domain/Model/Phone.php index 5bbb953..7db4a3f 100755 --- a/Classes/Domain/Model/Phone.php +++ b/Classes/Domain/Model/Phone.php @@ -84,12 +84,18 @@ public function getNumber() return $this->number; } - public function getSorting(): int + /** + * @return int + */ + public function getSorting() { return $this->sorting; } - public function setSorting(int $sorting): void + /** + * @param int $sorting + */ + public function setSorting(int $sorting) { $this->sorting = $sorting; }