remove some getter/setter

This commit is contained in:
Dennis Eichhorn 2020-11-24 17:31:20 +01:00
parent 1ea4191697
commit bcbb0eacb3
7 changed files with 33 additions and 96 deletions

View File

@ -58,7 +58,7 @@ final class ApiController extends Controller
$message = 'Import succeeded.'; $message = 'Import succeeded.';
} }
$response->set($request->getUri()->__toString(), [ $response->set($request->uri->__toString(), [
'status' => $status, 'status' => $status,
'title' => 'Exchange', 'title' => 'Exchange',
'message' => $message, 'message' => $message,
@ -130,7 +130,7 @@ final class ApiController extends Controller
{ {
if (!empty($val = $this->validateInterfaceInstall($request))) { if (!empty($val = $this->validateInterfaceInstall($request))) {
$response->set('interface_install', new FormValidation($val)); $response->set('interface_install', new FormValidation($val));
$response->getHeader()->setStatusCode(RequestStatusCode::R_400); $response->header->status = RequestStatusCode::R_400;
return; return;
} }

View File

@ -139,7 +139,7 @@ final class Importer extends ImporterAbstract
$this->remote->connect(); $this->remote->connect();
$this->account = $request->getHeader()->getAccount(); $this->account = $request->header->account;
if ($this->remote->getStatus() !== DatabaseStatus::OK) { if ($this->remote->getStatus() !== DatabaseStatus::OK) {
return false; return false;
@ -200,8 +200,8 @@ final class Importer extends ImporterAbstract
foreach ($costCenters as $cc) { foreach ($costCenters as $cc) {
$obj = new CostCenter(); $obj = new CostCenter();
$obj->setCode($cc->getCostCenter()); $obj->code = $cc->getCostCenter();
$obj->setName(\trim($cc->getDescription(), " ,\t")); $obj->l11n->name = \trim($cc->description, " ,\t");
CostCenterMapper::create($obj); CostCenterMapper::create($obj);
} }
@ -231,8 +231,8 @@ final class Importer extends ImporterAbstract
foreach ($costObjects as $co) { foreach ($costObjects as $co) {
$obj = new CostObject(); $obj = new CostObject();
$obj->setCode($co->getCostObject()); $obj->code = $co->getCostObject();
$obj->setName(\trim($co->getDescription(), " ,\t")); $obj->l11n->name = \trim($co->description, " ,\t");
CostObjectMapper::create($obj); CostObjectMapper::create($obj);
} }
@ -262,22 +262,22 @@ final class Importer extends ImporterAbstract
foreach ($customers as $customer) { foreach ($customers as $customer) {
$account = new Account(); $account = new Account();
$account->setName1(\trim($customer->addr->name1, " ,\t")); $account->name1 = \trim($customer->addr->name1, " ,\t");
$a = \trim($customer->addr->name2, " ,\t"); $a = \trim($customer->addr->name2, " ,\t");
$b = \trim($customer->addr->name3, " ,\t"); $b = \trim($customer->addr->name3, " ,\t");
$account->setName2(\trim($a . ' ' . $b)); $account->name2 = \trim($a . ' ' . $b);
$profile = new Profile($account); $profile = new Profile($account);
$obj = new Client(); $obj = new Client();
$obj->setNumber(\trim($customer->number, "., \t")); $obj->number = \trim($customer->number, "., \t");
$obj->setProfile($profile); $obj->profile = $profile;
$addr = new Address(); $addr = new Address();
$addr->setAddress(\trim($customer->addr->street, ", \t")); $addr->address = \trim($customer->addr->street, ", \t");
$addr->setPostal(\trim($customer->addr->zip, ",. \t")); $addr->postal = \trim($customer->addr->zip, ",. \t");
$addr->setCity(\trim($customer->addr->city, ",. \t")); $addr->city = \trim($customer->addr->city, ",. \t");
$addr->setCountry(ISO3166TwoEnum::_DEU); $addr->setCountry(ISO3166TwoEnum::_DEU);
$obj->setMainAddress($addr); $obj->setMainAddress($addr);
@ -341,22 +341,22 @@ final class Importer extends ImporterAbstract
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
$account = new Account(); $account = new Account();
$account->setName1(\trim($supplier->addr->name1, " ,\t")); $account->name1 = \trim($supplier->addr->name1, " ,\t");
$a = \trim($supplier->addr->name2, " ,\t"); $a = \trim($supplier->addr->name2, " ,\t");
$b = \trim($supplier->addr->name3, " ,\t"); $b = \trim($supplier->addr->name3, " ,\t");
$account->setName2(\trim($a . ' ' . $b)); $account->name2 = \trim($a . ' ' . $b);
$profile = new Profile($account); $profile = new Profile($account);
$obj = new Supplier(); $obj = new Supplier();
$obj->setNumber(\trim($supplier->number, "., \t")); $obj->number = \trim($supplier->number, "., \t");
$obj->setProfile($profile); $obj->profile = $profile;
$addr = new Address(); $addr = new Address();
$addr->setAddress(\trim($supplier->addr->street, ", \t")); $addr->address = \trim($supplier->addr->street, ", \t");
$addr->setPostal(\trim($supplier->addr->zip, ",. \t")); $addr->postal = \trim($supplier->addr->zip, ",. \t");
$addr->setCity(\trim($supplier->addr->city, ",. \t")); $addr->city = \trim($supplier->addr->city, ",. \t");
$addr->setCountry(ISO3166TwoEnum::_DEU); $addr->setCountry(ISO3166TwoEnum::_DEU);
$obj->setMainAddress($addr); $obj->setMainAddress($addr);
@ -440,6 +440,7 @@ final class Importer extends ImporterAbstract
$images = []; $images = [];
$imagePath = Controller::FILE_PATH . '/Modules/ItemManagement/Articles/Images'; $imagePath = Controller::FILE_PATH . '/Modules/ItemManagement/Articles/Images';
/** @var Media[] $media */
$media = []; $media = [];
if (!empty($files)) { if (!empty($files)) {
if (!\is_dir($imagePath)) { if (!\is_dir($imagePath)) {
@ -463,13 +464,13 @@ final class Importer extends ImporterAbstract
$number = (int) \explode('.', $image)[0]; $number = (int) \explode('.', $image)[0];
$media[$number] = new Media(); $media[$number] = new Media();
$media[$number]->setName((string) $number); $media[$number]->name = (string) $number;
$media[$number]->setType('backend_image'); $media[$number]->type = 'backend_image';
$media[$number]->setPath('/Modules/Media/Files/Modules/ItemManagement/Articles/Images/' . $image); $media[$number]->setPath('/Modules/Media/Files/Modules/ItemManagement/Articles/Images/' . $image);
$media[$number]->setVirtualPath('/Modules/ItemManagement/Articles/Images'); $media[$number]->setVirtualPath('/Modules/ItemManagement/Articles/Images');
$media[$number]->setExtension(\explode('.', $image)[1]); $media[$number]->extension = \explode('.', $image)[1];
$media[$number]->setSize((int) \filesize($imagePath . '/' . $image)); $media[$number]->size = (int) \filesize($imagePath . '/' . $image);
$media[$number]->setCreatedBy(new NullAccount($this->account)); $media[$number]->createdBy = new NullAccount($this->account);
MediaMapper::create($media[$number]); MediaMapper::create($media[$number]);
} }
@ -483,7 +484,7 @@ final class Importer extends ImporterAbstract
$number = (int) \trim($article->number, ",. \t"); $number = (int) \trim($article->number, ",. \t");
$obj = new Item(); $obj = new Item();
$obj->setNumber((string) $number); $obj->number = (string) $number;
// German Language // German Language
$obj->addL11n(new ItemL11n( $obj->addL11n(new ItemL11n(

View File

@ -46,7 +46,7 @@ class GSDCostCenter implements \JsonSerializable
* @var \DateTimeImmutable * @var \DateTimeImmutable
* @since 1.0.0 * @since 1.0.0
*/ */
protected \DateTimeImmutable $createdAt; public \DateTimeImmutable $createdAt;
/** /**
* Description. * Description.
@ -84,32 +84,6 @@ class GSDCostCenter implements \JsonSerializable
return $this->createdAt ?? new \DateTimeImmutable(); return $this->createdAt ?? new \DateTimeImmutable();
} }
/**
* Get created by
*
* @return int|\phpOMS\Account\Account
*
* @since 1.0.0
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set created by
*
* @param mixed $id Created by
*
* @return void
*
* @since 1.0.0
*/
public function setCreatedBy($id) : void
{
$this->createdBy = $id;
}
/** /**
* Set description * Set description
* *

View File

@ -46,7 +46,7 @@ class GSDCostObject implements \JsonSerializable
* @var \DateTimeImmutable * @var \DateTimeImmutable
* @since 1.0.0 * @since 1.0.0
*/ */
protected \DateTimeImmutable $createdAt; public \DateTimeImmutable $createdAt;
/** /**
* Description. * Description.
@ -84,32 +84,6 @@ class GSDCostObject implements \JsonSerializable
return $this->createdAt ?? new \DateTimeImmutable(); return $this->createdAt ?? new \DateTimeImmutable();
} }
/**
* Get created by
*
* @return int|\phpOMS\Account\Account
*
* @since 1.0.0
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set created by
*
* @param mixed $id Created by
*
* @return void
*
* @since 1.0.0
*/
public function setCreatedBy($id) : void
{
$this->createdBy = $id;
}
/** /**
* Set description * Set description
* *

View File

@ -64,7 +64,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
* @var \DateTimeImmutable * @var \DateTimeImmutable
* @since 1.0.0 * @since 1.0.0
*/ */
private \DateTimeImmutable $createdAt; public \DateTimeImmutable $createdAt;
/** /**
* Constructor. * Constructor.
@ -164,18 +164,6 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
$this->fields = $fields; $this->fields = $fields;
} }
/**
* Get created at.
*
* @return \DateTimeImmutable
*
* @since 1.0.0
*/
public function getCreatedAt() : \DateTimeImmutable
{
return $this->createdAt;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -29,7 +29,7 @@ echo $this->getData('nav')->render();
<?php $count = 0; foreach ($interfaces as $key => $value) : ++$count; <?php $count = 0; foreach ($interfaces as $key => $value) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/exchange/export/profile?{?}&id=' . $value->getId()); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/exchange/export/profile?{?}&id=' . $value->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a> <td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?> <tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>

View File

@ -29,7 +29,7 @@ echo $this->getData('nav')->render();
<?php $count = 0; foreach ($interfaces as $key => $value) : ++$count; <?php $count = 0; foreach ($interfaces as $key => $value) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/exchange/import/profile?{?}&id=' . $value->getId()); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/exchange/import/profile?{?}&id=' . $value->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a> <td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?> <tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>