mirror of
https://github.com/Karaka-Management/oms-ClientManagement.git
synced 2026-01-19 03:08:42 +00:00
cs and phpstan fixes
This commit is contained in:
parent
87dd0dac94
commit
f3ac439bb0
|
|
@ -19,6 +19,7 @@ use Modules\Media\Models\Media;
|
|||
use Modules\Profile\Models\ContactElement;
|
||||
use Modules\Profile\Models\NullContactElement;
|
||||
use Modules\Profile\Models\Profile;
|
||||
use Modules\Admin\Models\Address;
|
||||
|
||||
/**
|
||||
* Account class.
|
||||
|
|
@ -340,11 +341,27 @@ class Client
|
|||
$this->profile = $profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set main address
|
||||
*
|
||||
* @param int|Address $address Address
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setMainAddress($address) : void
|
||||
{
|
||||
$this->mainAddress = $address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get main address
|
||||
*
|
||||
* @return int|Address
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getMainAddress()
|
||||
{
|
||||
return $this->mainAddress;
|
||||
|
|
@ -400,11 +417,30 @@ class Client
|
|||
return $this->contactElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order contact elements
|
||||
*
|
||||
* @param ContactElement $a Element
|
||||
* @param ContactElement $b Element
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function orderContactElements(ContactElement $a, ContactElement $b) : int
|
||||
{
|
||||
return $a->getOrder() <=> $b->getOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the main contact element by type
|
||||
*
|
||||
* @param int $type Contact element type
|
||||
*
|
||||
* @return ContactElement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getMainContactElement(int $type) : ContactElement
|
||||
{
|
||||
\uasort($this->contactElements, [$this, 'orderContactElements']);
|
||||
|
|
@ -418,6 +454,15 @@ class Client
|
|||
return new NullContactElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add contact element
|
||||
*
|
||||
* @param int|ContactElement $element Contact element
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addContactElement($element) : void
|
||||
{
|
||||
$this->contactElements[] = $element;
|
||||
|
|
|
|||
|
|
@ -75,17 +75,17 @@ final class ClientMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string, by?:string, column?:string}>
|
||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
'profile' => [
|
||||
'mapper' => ProfileMapper::class,
|
||||
'external' => 'clientmgmt_client_profile',
|
||||
'mapper' => ProfileMapper::class,
|
||||
'external' => 'clientmgmt_client_profile',
|
||||
],
|
||||
'mainAddress' => [
|
||||
'mapper' => AddressMapper::class,
|
||||
'external' => 'clientmgmt_client_address',
|
||||
'mapper' => AddressMapper::class,
|
||||
'external' => 'clientmgmt_client_address',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -97,8 +97,8 @@ final class ClientMapper extends DataMapperAbstract
|
|||
*/
|
||||
protected static array $hasMany = [
|
||||
'files' => [
|
||||
'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||
'table' => 'clientmgmt_client_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||
'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||
'table' => 'clientmgmt_client_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||
'external' => 'clientmgmt_client_media_src',
|
||||
'self' => 'clientmgmt_client_media_dst',
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user