Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 6 |
Tag | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
56 | |
0.00% |
0 / 6 |
getId | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
setName | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
getName | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
jsonSerialize | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
__toString | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
<?php | |
/* | |
* This file is part of the Symfony package. | |
* | |
* (c) Fabien Potencier <fabien@symfony.com> | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ | |
namespace Smalldb\StateMachine\Test\SymfonyDemo\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 <yonelceruto@gmail.com> | |
*/ | |
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) | |
return $this->name; | |
} | |
public function __toString(): string | |
{ | |
return $this->name; | |
} | |
} |