WIP
This commit is contained in:
@@ -4,6 +4,10 @@ namespace App\BusProNet\Model;
|
||||
|
||||
class CrmAttribute
|
||||
{
|
||||
public const ATTR_ID_ADMIN = 1071;
|
||||
public const ATTR_ID_MANAGER = 1072;
|
||||
public const ATTR_ID_TEAMER = 1070;
|
||||
|
||||
private ?int $id = null;
|
||||
private ?string $label = null;
|
||||
private bool $selected = false;
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace App\BusProNet\Model;
|
||||
class CrmAttributesResponse extends BaseResponse
|
||||
{
|
||||
private ?array $attributeGroups = null;
|
||||
private bool $admin = false;
|
||||
private bool $manager = false;
|
||||
private bool $teamer = false;
|
||||
|
||||
public function getAttributeGroups(): ?array
|
||||
@@ -29,4 +31,28 @@ class CrmAttributesResponse extends BaseResponse
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
return $this->admin;
|
||||
}
|
||||
|
||||
public function setAdmin(bool $admin): static
|
||||
{
|
||||
$this->admin = $admin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isManager(): bool
|
||||
{
|
||||
return $this->manager;
|
||||
}
|
||||
|
||||
public function setManager(bool $manager): static
|
||||
{
|
||||
$this->manager = $manager;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ use App\BusProNet\Model\BaseResponse;
|
||||
|
||||
class ResponseParser
|
||||
{
|
||||
public const ATTR_ID_TEAMER = 1070;
|
||||
|
||||
/**
|
||||
* @throws ResponseParserException
|
||||
*/
|
||||
@@ -108,7 +106,7 @@ class ResponseParser
|
||||
public function createCrmAttributesResponse(\SimpleXMLElement $xml): CrmAttributesResponse
|
||||
{
|
||||
$groups = [];
|
||||
$isTeam = false;
|
||||
$isAdmin = $isManager = $isTeamer = false;
|
||||
|
||||
foreach ($xml->xpath('selektionsmerkmale/selektionsgruppe') as $item) {
|
||||
$group = new CrmAttributeGroup();
|
||||
@@ -124,8 +122,14 @@ class ResponseParser
|
||||
;
|
||||
$attributes[] = $attribute;
|
||||
|
||||
if (static::ATTR_ID_TEAMER === $attribute->getId() && true === $attribute->isSelected()) {
|
||||
$isTeam = true;
|
||||
if (CrmAttribute::ATTR_ID_ADMIN === $attribute->getId() && true === $attribute->isSelected()) {
|
||||
$isAdmin = true;
|
||||
}
|
||||
if (CrmAttribute::ATTR_ID_MANAGER === $attribute->getId() && true === $attribute->isSelected()) {
|
||||
$isManager = true;
|
||||
}
|
||||
if (CrmAttribute::ATTR_ID_TEAMER === $attribute->getId() && true === $attribute->isSelected()) {
|
||||
$isTeamer = true;
|
||||
}
|
||||
}
|
||||
$group->setAttributes($attributes);
|
||||
@@ -135,7 +139,9 @@ class ResponseParser
|
||||
$response = new CrmAttributesResponse();
|
||||
$response
|
||||
->setAttributeGroups($groups)
|
||||
->setTeamer($isTeam)
|
||||
->setAdmin($isAdmin)
|
||||
->setManager($isManager)
|
||||
->setTeamer($isTeamer)
|
||||
;
|
||||
|
||||
return $response;
|
||||
|
||||
Reference in New Issue
Block a user