Source of file IsVisibleEntity.php

Size: 0,848 Bytes - Last Modified: 2020-10-24T02:46:31+00:00

/home/travis/build/NextDom/nextdom-core/src/Model/Entity/Parents/IsVisibleEntity.php

12345678910111213141516171819202122232425262728293031323334353637383940414243
<?php

namespace NextDom\Model\Entity\Parents;

trait IsVisibleEntity
{
    abstract public function updateChangeState($oldValue, $newValue);

    /**
     * @var boolean
     *
     * @ORM\Column(name="isVisible", type="boolean", nullable=true)
     */
    protected $isVisible = 1;

    /**
     *
     * @param mixed $defaultValue
     * @return mixed
     */
    public function getIsVisible($defaultValue = 0)
    {
        if ($this->isVisible == '' || !is_numeric($this->isVisible)) {
            return $defaultValue;
        }
        return $this->isVisible;
    }

    public function isVisible()
    {
        return intval($this->isVisible) == 1;
    }

    /**
     * @param $isVisible
     * @return $this
     */
    public function setIsVisible($isVisible)
    {
        $this->isVisible = $isVisible;
        return $this;
    }
}