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

View File

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

View File

@ -46,7 +46,7 @@ class GSDCostCenter implements \JsonSerializable
* @var \DateTimeImmutable
* @since 1.0.0
*/
protected \DateTimeImmutable $createdAt;
public \DateTimeImmutable $createdAt;
/**
* Description.
@ -84,32 +84,6 @@ class GSDCostCenter implements \JsonSerializable
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
*

View File

@ -46,7 +46,7 @@ class GSDCostObject implements \JsonSerializable
* @var \DateTimeImmutable
* @since 1.0.0
*/
protected \DateTimeImmutable $createdAt;
public \DateTimeImmutable $createdAt;
/**
* Description.
@ -84,32 +84,6 @@ class GSDCostObject implements \JsonSerializable
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
*

View File

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

View File

@ -29,7 +29,7 @@ echo $this->getData('nav')->render();
<?php $count = 0; foreach ($interfaces as $key => $value) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/exchange/export/profile?{?}&id=' . $value->getId()); ?>
<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 if ($count === 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;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/exchange/import/profile?{?}&id=' . $value->getId()); ?>
<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 if ($count === 0) : ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>