I am trying to add a many-to-one association to an existing entity in a vendor bundle.
This is my essence in a vendor bundle: -
class Post
{
private $id;
private $title;
private $accroche;
private $article;
private $categories;
private $comments;
private $created;
private $updated;
private $publied;
}
And this is the orm mapping file for the Post object in the provider package: -
Mv\BlogBundle\Entity\AdminBlog\Post:
type: entity
table: null
repositoryClass: Mv\BlogBundle\Entity\AdminBlog\PostRepository
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 150
accroche:
type: text
article:
type: text
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
publied:
type: datetime
manyToMany:
categories:
targetEntity: Mv\BlogBundle\Entity\AdminBlog\Category
inversedBy: posts
joinTable:
name: post_category
joinColumns:
post_id:
referencedColumnName: id
onDelete: CASCADE
inverseJoinColumns:
category_id:
referencedColumnName: id
onDelete: RESTRICT
oneToMany:
comments:
targetEntity: Mv\BlogBundle\Entity\AdminBlog\Comment
mappedBy: post
I created a child package of my vendor package. I explored mappedSuperclass and tried other inheritance methods. But none of them worked, just adding an association to the Publish object.
I just want to have something like the following (tried adding it to the orm mapping file, but didn't work): -
manyToOne:
user:
targetEntity: TP\Bundle\MainBundle\Entity\User
joinColumns:
user_id:
referencedColumnName: id
source
share