bug fixes and subscription improvements

This commit is contained in:
Dennis Eichhorn 2023-04-25 01:51:28 +00:00
parent 66f0ea48cc
commit a7bf9066ab
2 changed files with 3 additions and 84 deletions

View File

@ -57,29 +57,13 @@ class Supplier
public Account $account;
/**
* Attributes.
*
* @var \Modules\Attribute\Models\Attribute[]
* @since 1.0.0
*/
private array $attributes = [];
/**
* Files.
* Notes.
*
* @var EditorDoc[]
* @since 1.0.0
*/
private array $notes = [];
/**
* Files.
*
* @var Media[]
* @since 1.0.0
*/
private array $files = [];
private array $contactElements = [];
private array $address = [];
@ -240,20 +224,6 @@ class Supplier
return $this->notes;
}
/**
* Add media.
*
* @param Media $file Media
*
* @return void
*
* @since 1.0.0
*/
public function addFile(Media $file) : void
{
$this->files[] = $file;
}
/**
* Get addresses.
*
@ -355,58 +325,6 @@ class Supplier
$this->contactElements[] = $element;
}
/**
* Get files
*
* @return Media[]
*
* @since 1.0.0
*/
public function getFiles() : array
{
return $this->files;
}
/**
* Get media file by type
*
* @param int $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByType(int $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeId($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* Get all media files by type name
*
* @param string $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByTypeName(string $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeName($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* {@inheritdoc}
*/
@ -430,5 +348,6 @@ class Supplier
return $this->toArray();
}
use \Modules\Media\Models\MediaListTrait;
use \Modules\Attribute\Models\AttributeHolderTrait;
}

View File

@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @template T of SupplierL11n
* @extends DataMapperFactory<T>
*/
final class SupplierL11nMapper extends DataMapperFactory