Source of file EntityEnabled.php

Size: 0,908 Bytes - Last Modified: 2023-11-16T22:56:02+01:00

/home/websites/teicee/packagist/site/phpdoc/conf/../vendor/teicee/dorm-bundle/src/Traits/EntityEnabled.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
<?php
namespace TIC\DormBundle\Traits;

use Doctrine\ORM\Mapping as ORM;

/**
 * Gestion d'un champs d'activation sur une entité Doctrine.
 */
trait EntityEnabled
{
	/**
	 * @ORM\Column(type="boolean", options={"default"=true})
	 */
	private $enabled = true;

	// --------------------------------------------------------------------- Shortcut methods

	/**
	 * Get the enabled state.
	 */
	public function isEnabled(): bool
	{
		return $this->enabled ? true : false;
	}

	// --------------------------------------------------------------------- Accessors (getters)

	/**
	 * Get the enabled state.
	 */
	public function getEnabled(): ?bool
	{
		return $this->enabled;
	}

	// --------------------------------------------------------------------- Mutators (setters)

	/**
	 * Set the enabled state.
	 */
	public function setEnabled(?bool $enabled): self
	{
		$this->enabled = $enabled;
		return $this;
	}

}