for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
* @ORM\Table(name="symfony_demo_tag")
* Defines the properties of the Tag entity to represent the post tags.
* See https://symfony.com/doc/current/book/doctrine.html#creating-an-entity-class
* @author Yonel Ceruto <[email protected]>
class Tag implements \JsonSerializable
{
* @var int
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
private $id;
* @var string
* @ORM\Column(type="string", unique=true)
private $name;
public function getId(): int
return $this->id;
}
public function setName(string $name): void
$this->name = $name;
public function getName(): string
return $this->name;
* {@inheritdoc}
public function jsonSerialize(): string
// This entity implements JsonSerializable (http://php.net/manual/en/class.jsonserializable.php)
// so this method is used to customize its JSON representation when json_encode()
// is called, for example in tags|json_encode (app/Resources/views/form/fields.html.twig)
public function __toString(): string