File size: 1,263 Bytes
cf14c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <?php
declare(strict_types=1);
namespace Billing\Domain\ValueObjects;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
/**
* This is a class representing the IsFeatured value object. It is an Embeddable
* class in Doctrine, meaning it is a complex field type that can be embedded
* in entities.
*/
#[ORM\Embeddable]
class IsFeatured implements JsonSerializable
{
// Indicates that the value should be stored as a boolean in the database
// under the column name "is_featured". It is readonly so it cannot be
// changed after being set
#[ORM\Column(type: Types::BOOLEAN, name: "is_featured")]
public readonly bool $value;
/**
* This is the constructor method that is automatically called upon class
* instantiation. It accepts a boolean value which will be stored as the
* $value property.
*
* @param bool $value
*/
public function __construct(bool $value = false)
{
$this->value = $value;
}
/**
* This is part of the JsonSerializable interface, allows the object to be
* serialized into a boolean.
*
* @return bool
*/
public function jsonSerialize(): bool
{
return $this->value;
}
}
|