Created
October 2, 2018 08:45
-
-
Save Nightbr/71c8eeae311270a3f2ee13734f310c49 to your computer and use it in GitHub Desktop.
Part of https://medium.com/@titouanbenoit/internationalization-with-api-platform-the-other-way-5ce9c446737f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use ApiPlatform\Core\Annotation\ApiResource; | |
use ApiPlatform\Core\Annotation\ApiSubresource; | |
use Doctrine\ORM\Mapping as ORM; | |
use Gedmo\Mapping\Annotation as Gedmo; | |
use Symfony\Component\Validator\Constraints as Assert; | |
use Symfony\Component\Serializer\Annotation\MaxDepth; | |
use Symfony\Component\Serializer\Annotation\Groups; | |
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | |
/** | |
* @ApiResource() | |
* @ORM\Entity() | |
* @ORM\Table(name="company") | |
* @Gedmo\TranslationEntity(class="App\Entity\Translation\CompanyTranslation") | |
* @UniqueEntity("name") | |
*/ | |
class Company | |
{ | |
/** | |
* @var int | |
* | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
* @Groups({"out"}) | |
*/ | |
private $id; | |
/** | |
* @var string | |
* | |
* @Assert\NotBlank() | |
* @ORM\Column(type="string", unique=true) | |
* @Groups({"out", "in", "recruiter_in"}) | |
*/ | |
private $name; | |
/** | |
* @var string | |
* | |
* @Gedmo\Translatable | |
* @ORM\Column(type="text", nullable=true) | |
* @Groups({"out", "in", "recruiter_in"}) | |
*/ | |
private $description; | |
/** | |
* @var string | |
* | |
* @Gedmo\Translatable | |
* @ORM\Column(type="string", nullable=true) | |
* @Groups({"out", "in", "recruiter_in"}) | |
*/ | |
private $catchPhrase; | |
/** | |
* @var string | |
* | |
* @ORM\Column(type="string", nullable=false) | |
* @Gedmo\Slug(fields={"name"}) | |
* @Groups({"out"}) | |
*/ | |
private $slug; | |
/** | |
* @var Locale | |
* | |
* @Gedmo\Locale | |
*/ | |
private $locale; | |
public function __toString() | |
{ | |
return $this->name; | |
} | |
............. SETTERS/GETTERS.................. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment