src/Biz/Taxonomy/TagOwnerManager.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Taxonomy;
use Biz\Taxonomy\Service\TagService;
use Topxia\Service\Common\ServiceKernel;
class TagOwnerManager
{
private $ownerType;
private $ownerId;
private $tagIds;
private $userId;
public function __construct($ownerType, $ownerId, $tagIds = array(), $userId = null)
{
$this->ownerType = $ownerType;
$this->ownerId = $ownerId;
$this->tagIds = $tagIds;
$this->userId = $userId;
}
public function create()
{
foreach ($this->tagIds as $tagId) {
$this->getTagService()->addTagOwnerRelation(array(
'ownerType' => $this->ownerType,
'ownerId' => $this->ownerId,
'tagId' => $tagId,
'userId' => $this->userId,
'createdTime' => time(),
));
}
}
public function update()
{
$this->delete();
$this->create();
}
public function delete()
{
$this->getTagService()->deleteTagOwnerRelationsByOwner(array('ownerType' => $this->ownerType, 'ownerId' => $this->ownerId));
}
/**
* @return TagService
*/
protected function getTagService()
{
return ServiceKernel::instance()->getBiz()->service('Taxonomy:TagService');
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。