Skip to content

Instantly share code, notes, and snippets.

@Karnak19
Created November 16, 2018 09:27
Show Gist options
  • Select an option

  • Save Karnak19/7752387be5c8c27e9d4815f07d4bec47 to your computer and use it in GitHub Desktop.

Select an option

Save Karnak19/7752387be5c8c27e9d4815f07d4bec47 to your computer and use it in GitHub Desktop.
Quest 06 Symfony
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\ArticleRepository")
*/
class Article
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="text")
*/
private $content;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Category")
* @ORM\JoinColumn(nullable=false)
*/
private $category;
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment