Skip to content

Instantly share code, notes, and snippets.

@alexfinnarn
Created September 19, 2018 17:34
Show Gist options
  • Save alexfinnarn/83797749e1bf99cb32ea6b557ec84c34 to your computer and use it in GitHub Desktop.
Save alexfinnarn/83797749e1bf99cb32ea6b557ec84c34 to your computer and use it in GitHub Desktop.
sample generated model
<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* A person (alive, dead, undead, or fictional).
*
* @see http://schema.org/Person Documentation on Schema.org
*
* @ORM\Entity
* @ApiResource(iri="http://schema.org/Person")
*/
class Person extends Thing
{
/**
* @var int|null
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var PostalAddress|null physical address of the item
*
* @ORM\ManyToOne(targetEntity="App\Entity\PostalAddress")
* @ApiProperty(iri="http://schema.org/address")
*/
private $address;
public function setAddress(?PostalAddress $address): void
{
$this->address = $address;
}
public function getAddress(): ?PostalAddress
{
return $this->address;
}
// ...more definitions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment