This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Dao/EntityConverters/TokenEntityConverter.php
Marcin Kurczewski 5cfb225400 Fixed lazy loaders injection
AbstractSearchService::getByFilter() wasn't injecting lazy loaders,
because it didn't call AbstractDao::afterLoad(). This resulted in tags
not showing up in post list, because there was nothing to retrieve them.
Changed lazy loaders injection so that it's always executed as soon as
possible (i.e. right in EntityConverter).
2014-10-18 18:48:24 +02:00

25 lines
651 B
PHP

<?php
namespace Szurubooru\Dao\EntityConverters;
class TokenEntityConverter extends AbstractEntityConverter implements IEntityConverter
{
public function toArray(\Szurubooru\Entities\Entity $entity)
{
return
[
'id' => $entity->getId(),
'name' => $entity->getName(),
'purpose' => $entity->getPurpose(),
'additionalData' => $entity->getAdditionalData(),
];
}
public function toBasicEntity(array $array)
{
$entity = new \Szurubooru\Entities\Token(intval($array['id']));
$entity->setName($array['name']);
$entity->setPurpose($array['purpose']);
$entity->setAdditionalData($array['additionalData']);
return $entity;
}
}