I have an abstract class called BaseModel and I have the @ORM\MappedSuperclass annotation on it.
It has basic props that I want included in all my entities (id, dateCreated, dateUpdated, etc).
/**
* @ORM\MappedSuperclass
*/
abstract class BaseModel
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
protected $createdAt;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
protected $updatedAt;
/**
* @var \DateTime
* @ORM\Column(name="deletedAt", type="datetime", nullable=true)
*/
...
On my entity classes, I make them extend baseModel and add the entity fields I want.
/**
* @ORM\Entity(repositoryClass="Thorlos\AppBundle\Repository\Product\ClimateRepository")
* @ORM\Table(name="climates")
*/
class Climate extends BaseModel
{
/**
* @var string
* @ORM\Column(type="string", length=150)
* @Assert\NotBlank()
* @Assert\MaxLength(150)
*/
protected $description;
...
When I run 'php app/console doctrine:generate:entities Thorlos' it adds all of the props from baseModel (id, etc) to all of the entity classes and generates accessors for all of them.
Can someone tell me what I am doing wrong?
Thanks!
Mark
