use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name: 'category')]
class Category
{
#[ORM\Id]
#[ORM\Column(type: 'integer', name: 'category_id')]
protected $categoryId;
#[ORM\Column(type: 'string', length: 255)]
protected $name;
/*
* Getters / Setters (auto-generated)
*/
//Content after this block will be deleted when
//the bundle generates the getters-setters methods.
//Getters-setters methods will be generated here.
}
use Doctrine\ORM\Mapping as ORM;
use Ecommit\DoctrineEntitiesGeneratorBundle\Attribute\GenerateEntityTemplate;
#[ORM\Entity]
#[ORM\Table(name: 'category')]
#[GenerateEntityTemplate("your_template.php.twig")]
class Category
{
#[ORM\Id]
#[ORM\Column(type: 'integer', name: 'category_id')]
protected $categoryId;
//...
}
use Doctrine\ORM\Mapping as ORM;
use Ecommit\DoctrineEntitiesGeneratorBundle\Attribute\GenerateEntityTemplate;
#[ORM\Entity]
#[ORM\Table(name: 'category')]
#[GenerateEntityTemplate('your_template.php.twig')]
class Category
{
#[ORM\Id]
#[ORM\Column(type: 'integer', name: 'category_id')]
protected $categoryId;
//...
/*
* Getters / Setters (auto-generated)
*/
/*
* End Getters / Setters (auto-generated)
*/
}
use Doctrine\ORM\Mapping as ORM;
use Ecommit\DoctrineEntitiesGeneratorBundle\Entity\EntityInitializerInterface;
#[ORM\Entity]
#[ORM\Table(name: 'category')]
class Category implements EntityInitializerInterface
{
#[ORM\Id]
#[ORM\Column(type: 'integer', name: 'category_id')]
protected $categoryId;
#[ORM\OneToMany(targetEntity: 'Ecommit\DoctrineEntitiesGeneratorBundle\Tests\App\Entity\Book', mappedBy: 'category')]
protected $books;
#[ORM\Column(type: 'datetime')]
protected $createdAt;
public function initializeEntity(): void
{
$this->createdAt = new \DateTime('now');
}
//...
}
use Doctrine\ORM\Mapping as ORM;
use Ecommit\DoctrineEntitiesGeneratorBundle\Attribute\IgnoreGenerateEntity;
#[ORM\Entity]
#[ORM\Table(name: 'category')]
#[IgnoreGenerateEntity]
class Category
{
#[ORM\Id]
#[ORM\Column(type: 'integer', name: 'category_id')]
protected $categoryId;
//...
}