Skip to content

Instantly share code, notes, and snippets.

@NandoKstroNet
Created December 4, 2017 17:13
Show Gist options
  • Save NandoKstroNet/730315b64aa9ca48b9db5693884510ce to your computer and use it in GitHub Desktop.
Save NandoKstroNet/730315b64aa9ca48b9db5693884510ce to your computer and use it in GitHub Desktop.
Entidade Doctrine no Symfony 4, completa pro exemplo. Blog da codeexpertslearning.com.br
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
*/
class Product
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="float")
*/
private $price;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(name="updated_at", type="datetime")
*/
private $updatedAt;
public function getId()
{
return $this->id;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
return $this;
}
public function getPrice()
{
return $this->price;
}
public function setPrice($price)
{
$this->price = $price;
return $this;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
return $this;
}
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment