<?php

namespace AppBundle\Utils\Traits;

use Doctrine\ORM\Mapping as ORM;

trait TagsJsonTrait
{

    /**
     * @var array
     *
     * @ORM\Column(name="public_tag", type="json_document", nullable=true)
     */
    private $publicTag;

    /***********************
     * Non-mapped field
     ***********************/
    private $tagsComma;

    /***********************
     * Custom Functions
     ***********************/


    public function initTags()
    {
        $tags = $this->publicTag;
        if ($tags != null) {
            $this->tagsComma = implode(',', $tags);
        }
    }

    /***********************
     * Getters & Setters
     ***********************/

    /**
     * Set publicTag.
     */
    public function setPublicTag($publicTag = null)
    {
        $this->publicTag = $publicTag;

        return $this;
    }

    /**
     * Get publicTag.
     */
    public function getPublicTag()
    {
        return $this->publicTag;
    }

    public function setTagsComma($tagsComma)
    {
        $this->tagsComma = $tagsComma;

        return $this;
    }

    public function getTagsComma()
    {
        return $this->tagsComma;
    }

}