src/Biz/Taxonomy/Copy/TagOwnerCopy.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Biz\Taxonomy\Copy;

use Biz\AbstractCopy;
use Biz\Taxonomy\Dao\TagDao;
use Codeages\Biz\Framework\Context\Biz;

class TagOwnerCopy extends AbstractCopy
{
    public function preCopy($source, $options)
    {
        return;
    }

    public function doCopy($source, $options)
    {
        $newCourseSet = $options['newCourseSet'];

        if (empty($newCourseSet['tags'])) {
            return false;
        }

        $newTagOwners = array();
        foreach ($newCourseSet['tags'] as $tag) {
            $tagOwner = array(
                'ownerType' => 'course-set',
                'ownerId' => $newCourseSet['id'],
                'tagId' => $tag,
                'userId' => $newCourseSet['creator'],
            );

            $newTagOwners[] = $tagOwner;
        }

        if (empty($newTagOwners)) {
            return false;
        }

        $this->getTagOwnerDao()->batchCreate($newTagOwners);

        return true;
    }

    public function __construct(Biz $biz, $copyChain)
    {
        parent::__construct($biz, $copyChain);
    }

    protected function getFields()
    {
        return array();
    }

    /**
     * @return TagDao
     */
    protected function getTagOwnerDao()
    {
        return $this->biz->dao('Taxonomy:TagOwnerDao');

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。