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
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
|
|
|
class Tag extends ArrayCollection
|
|
|
|
{
|
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);
|
|
|
|
}
|
|
|
|
|
2024-12-20 23:46:30 +01:00
|
|
|
public function getId(): string
|
|
|
|
{
|
|
|
|
return $this->get('tagid');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(): string
|
|
|
|
{
|
|
|
|
return $this->get('name');
|
|
|
|
}
|
|
|
|
|
2025-01-01 22:27:01 +01:00
|
|
|
public function setName(string $name): void
|
|
|
|
{
|
|
|
|
$this->set('name', $name);
|
|
|
|
|
|
|
|
// use persist method to send to Klicktipp
|
|
|
|
}
|
|
|
|
|
2024-12-20 23:46:30 +01:00
|
|
|
public function getText(): string
|
|
|
|
{
|
|
|
|
return $this->get('text');
|
|
|
|
}
|
2025-01-01 22:27:01 +01:00
|
|
|
|
|
|
|
public function setText(string $text): void
|
|
|
|
{
|
|
|
|
$this->set('text', $text);
|
|
|
|
|
|
|
|
// 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
|
|
|
}
|