2024-12-20 23:46:30 +01:00
|
|
|
<?php
|
|
|
|
|
2024-12-29 00:47:30 +01:00
|
|
|
/**
|
|
|
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view
|
|
|
|
* the LICENSE file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* https://www.d3data.de
|
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
|
|
|
*/
|
|
|
|
|
2025-01-05 15:20:56 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-12-20 23:46:30 +01:00
|
|
|
namespace D3\KlicktippPhpClient\Entities;
|
|
|
|
|
2025-01-01 22:27:01 +01:00
|
|
|
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
|
|
|
use D3\KlicktippPhpClient\Resources\Tag as TagEndpoint;
|
2024-12-20 23:46:30 +01:00
|
|
|
|
2025-01-07 14:06:01 +01:00
|
|
|
class Tag extends Entity
|
2024-12-20 23:46:30 +01:00
|
|
|
{
|
2025-01-01 22:27:01 +01:00
|
|
|
private ?TagEndpoint $endpoint;
|
|
|
|
|
|
|
|
public function __construct(array $elements = [], ?TagEndpoint $endpoint = null)
|
|
|
|
{
|
|
|
|
$this->endpoint = $endpoint;
|
|
|
|
parent::__construct($elements);
|
|
|
|
}
|
|
|
|
|
2025-01-07 14:06:01 +01:00
|
|
|
public function getId(): ?string
|
2024-12-20 23:46:30 +01:00
|
|
|
{
|
2025-01-07 14:06:01 +01:00
|
|
|
return $this->getStringOrNullValue($this->get(TagEndpoint::ID));
|
2024-12-20 23:46:30 +01:00
|
|
|
}
|
|
|
|
|
2025-01-07 14:06:01 +01:00
|
|
|
public function getName(): ?string
|
2024-12-20 23:46:30 +01:00
|
|
|
{
|
2025-01-07 14:06:01 +01:00
|
|
|
return $this->getStringOrNullValue($this->get(TagEndpoint::NAME));
|
2024-12-20 23:46:30 +01:00
|
|
|
}
|
|
|
|
|
2025-01-01 22:27:01 +01:00
|
|
|
public function setName(string $name): void
|
|
|
|
{
|
2025-01-03 12:03:10 +01:00
|
|
|
$this->set(TagEndpoint::NAME, $name);
|
2025-01-01 22:27:01 +01:00
|
|
|
|
|
|
|
// use persist method to send to Klicktipp
|
|
|
|
}
|
|
|
|
|
2025-01-07 14:06:01 +01:00
|
|
|
public function getText(): ?string
|
2024-12-20 23:46:30 +01:00
|
|
|
{
|
2025-01-07 14:06:01 +01:00
|
|
|
return $this->getStringOrNullValue($this->get(TagEndpoint::TEXT));
|
2024-12-20 23:46:30 +01:00
|
|
|
}
|
2025-01-01 22:27:01 +01:00
|
|
|
|
|
|
|
public function setText(string $text): void
|
|
|
|
{
|
2025-01-03 12:03:10 +01:00
|
|
|
$this->set(TagEndpoint::TEXT, $text);
|
2025-01-01 22:27:01 +01:00
|
|
|
|
|
|
|
// use persist method to send to Klicktipp
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2025-01-02 23:52:24 +01:00
|
|
|
* @return null|bool
|
2025-01-01 22:27:01 +01:00
|
|
|
* @throws BaseException
|
|
|
|
*/
|
2025-01-02 23:52:24 +01:00
|
|
|
public function persist(): ?bool
|
2025-01-01 22:27:01 +01:00
|
|
|
{
|
|
|
|
return $this->endpoint?->update(
|
|
|
|
$this->getId(),
|
|
|
|
$this->getName(),
|
|
|
|
$this->getText()
|
|
|
|
);
|
|
|
|
}
|
2024-12-29 00:47:30 +01:00
|
|
|
}
|