diff --git a/Models/Supplier.php b/Models/Supplier.php index 26b00c8..419ad73 100644 --- a/Models/Supplier.php +++ b/Models/Supplier.php @@ -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; /** * Supplier class. @@ -284,11 +285,27 @@ class Supplier $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; @@ -344,11 +361,30 @@ class Supplier 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']); @@ -362,6 +398,15 @@ class Supplier 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; diff --git a/Models/SupplierMapper.php b/Models/SupplierMapper.php index ba8dd71..2977162 100644 --- a/Models/SupplierMapper.php +++ b/Models/SupplierMapper.php @@ -76,7 +76,7 @@ final class SupplierMapper extends DataMapperAbstract /** * Has one relation. * - * @var array + * @var array * @since 1.0.0 */ protected static array $ownsOne = [