|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / Mirasvit / Search / Model / |
Filename | /home/dev2.destoffenstraat.com/app/code/Mirasvit/Search/Model/Index.php |
Size | 3.88 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 15-Oct-2024 20:30 |
Last accessed | 22-Aug-2025 02:07 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Mirasvit
*
* This source file is subject to the Mirasvit Software License, which is available at https://mirasvit.com/license/.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to http://www.magentocommerce.com for more information.
*
* @category Mirasvit
* @package mirasvit/module-search-ultimate
* @version 2.3.2
* @copyright Copyright (C) 2024 Mirasvit (https://mirasvit.com/)
*/
namespace Mirasvit\Search\Model;
use Magento\Framework\Model\AbstractModel;
use Mirasvit\Core\Service\SerializeService;
use Mirasvit\Search\Api\Data\IndexInterface;
class Index extends AbstractModel implements IndexInterface
{
protected $serializer;
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Serialize\Serializer\Json $serializer,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->serializer = $serializer;
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
public function getId(): int
{
return (int)parent::getData(self::ID);
}
public function getTitle(): string
{
return (string)parent::getData(self::TITLE);
}
public function setTitle(string $input): IndexInterface
{
return parent::setData(self::TITLE, $input);
}
public function getIdentifier(): ?string
{
return parent::getData(self::IDENTIFIER);
}
public function setIdentifier(string $input): IndexInterface
{
return parent::setData(self::IDENTIFIER, $input);
}
public function getPosition(): int
{
return (int)parent::getData(self::POSITION);
}
public function setPosition(int $value): IndexInterface
{
return parent::setData(self::POSITION, $value);
}
public function getAttributes(): array
{
if (empty(parent::getData(self::ATTRIBUTES_SERIALIZED))) {
return [];
}
try {
$data = (array)$this->serializer->unserialize(parent::getData(self::ATTRIBUTES_SERIALIZED));
} catch (\Exception $e) {
$data = [];
}
return $data;
}
public function setAttributes(array $input): IndexInterface
{
return parent::setData(self::ATTRIBUTES_SERIALIZED, $this->serializer->serialize($input));
}
public function setProperties(array $input): IndexInterface
{
return parent::setData(self::PROPERTIES_SERIALIZED, $this->serializer->serialize($input));
}
public function getStatus(): int
{
return (int)parent::getData(self::STATUS);
}
public function setStatus(int $value): IndexInterface
{
return parent::setData(self::STATUS, $value);
}
public function getIsActive(): bool
{
return (bool)parent::getData(self::IS_ACTIVE);
}
public function setIsActive(bool $value): IndexInterface
{
return parent::setData(self::IS_ACTIVE, $value);
}
public function getProperty(string $key): string
{
$props = $this->getProperties();
if (isset($props[$key]) && is_array($props[$key])) {
$props[$key] = $this->serializer->serialize($props[$key]);
}
return $props[$key] ?? '';
}
public function getProperties(): array
{
if (empty(parent::getData(self::PROPERTIES_SERIALIZED))) {
return [];
}
return (array)SerializeService::decode(parent::getData(self::PROPERTIES_SERIALIZED));
}
protected function _construct(): void
{
$this->_init(ResourceModel\Index::class);
parent::_construct();
}
}
/**
* Mirasvit
*
* This source file is subject to the Mirasvit Software License, which is available at https://mirasvit.com/license/.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to http://www.magentocommerce.com for more information.
*
* @category Mirasvit
* @package mirasvit/module-search-ultimate
* @version 2.3.2
* @copyright Copyright (C) 2024 Mirasvit (https://mirasvit.com/)
*/
namespace Mirasvit\Search\Model;
use Magento\Framework\Model\AbstractModel;
use Mirasvit\Core\Service\SerializeService;
use Mirasvit\Search\Api\Data\IndexInterface;
class Index extends AbstractModel implements IndexInterface
{
protected $serializer;
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Serialize\Serializer\Json $serializer,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->serializer = $serializer;
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
public function getId(): int
{
return (int)parent::getData(self::ID);
}
public function getTitle(): string
{
return (string)parent::getData(self::TITLE);
}
public function setTitle(string $input): IndexInterface
{
return parent::setData(self::TITLE, $input);
}
public function getIdentifier(): ?string
{
return parent::getData(self::IDENTIFIER);
}
public function setIdentifier(string $input): IndexInterface
{
return parent::setData(self::IDENTIFIER, $input);
}
public function getPosition(): int
{
return (int)parent::getData(self::POSITION);
}
public function setPosition(int $value): IndexInterface
{
return parent::setData(self::POSITION, $value);
}
public function getAttributes(): array
{
if (empty(parent::getData(self::ATTRIBUTES_SERIALIZED))) {
return [];
}
try {
$data = (array)$this->serializer->unserialize(parent::getData(self::ATTRIBUTES_SERIALIZED));
} catch (\Exception $e) {
$data = [];
}
return $data;
}
public function setAttributes(array $input): IndexInterface
{
return parent::setData(self::ATTRIBUTES_SERIALIZED, $this->serializer->serialize($input));
}
public function setProperties(array $input): IndexInterface
{
return parent::setData(self::PROPERTIES_SERIALIZED, $this->serializer->serialize($input));
}
public function getStatus(): int
{
return (int)parent::getData(self::STATUS);
}
public function setStatus(int $value): IndexInterface
{
return parent::setData(self::STATUS, $value);
}
public function getIsActive(): bool
{
return (bool)parent::getData(self::IS_ACTIVE);
}
public function setIsActive(bool $value): IndexInterface
{
return parent::setData(self::IS_ACTIVE, $value);
}
public function getProperty(string $key): string
{
$props = $this->getProperties();
if (isset($props[$key]) && is_array($props[$key])) {
$props[$key] = $this->serializer->serialize($props[$key]);
}
return $props[$key] ?? '';
}
public function getProperties(): array
{
if (empty(parent::getData(self::PROPERTIES_SERIALIZED))) {
return [];
}
return (array)SerializeService::decode(parent::getData(self::PROPERTIES_SERIALIZED));
}
protected function _construct(): void
{
$this->_init(ResourceModel\Index::class);
parent::_construct();
}
}