Gerando getters and setters de uma entity do Doctrine

De Basef
Revisão de 20h30min de 2 de maio de 2016 por Admin (discussão | contribs) (Criou página com 'Supondo que temos a entity Product, já criada, em src/AppBundle/Entity/Product.php, com o conteúdo: <source lang="php"> <?php namespace AppBundle\Entity; use Doctrine\ORM...')

(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para: navegação, pesquisa

Supondo que temos a entity Product, já criada, em src/AppBundle/Entity/Product.php, com o conteúdo:

<?php
 
namespace AppBundle\Entity;
 
use Doctrine\ORM\Mapping as ORM;
 
/**
 * @ORM\Entity
 * @ORM\Table(name="product")
 */
class Product
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
 
    /**
     * @ORM\Column(type="string", length=100)
     */
    private $name;
 
    /**
     * @ORM\Column(type="decimal", scale=2)
     */
    private $price;
 
    /**
     * @ORM\Column(type="text")
     */
    private $description;
}

Para gerar os getters e setters dos atributos:

php bin/console doctrine:generate:entities AppBundle/Entity/Product