Comments (12)
Hi,
I don't think your numbers of lines are correct (https://github.com/roukmoute/DoctrinePrefixBundle/blob/master/src/Subscriber/PrefixSubscriber.php#L45-L47)
You're problem is interesting, I'll see if I can get the same thing.
Why do not you propose a correction?
from doctrineprefixbundle.
Hi,
The correct lines numbers are 53/55.... sorry.
My solution is to delete there lines, but I think you wrote there for a reason. This reason is still right ?
from doctrineprefixbundle.
I cant' work now on your problem.
I check later.
Could you give me your concrete example please ?
I fix it quickly
from doctrineprefixbundle.
Mother class
<?php
namespace AppBundle\Entity\Selection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
* @ORM\Table(name="selection_selection")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({
* "dynamic_book" = "SelectionDynamicBook",
* })
*/
class Selection
{
/**
* @var integer
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
Daugther class
<?php
namespace AppBundle\Entity\Selection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use AppBundle\Entity\Ebook\Genre;
/**
* @ORM\Entity
*/
class SelectionDynamicBook extends Selection
{
/**
* @var \Doctrine\Common\Collections\ArrayCollection<Genre>
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Ebook\Genre", inversedBy="selections")
* @ORM\JoinTable(
* name="selection_book_genre",
* joinColumns={@ORM\JoinColumn(name="selection_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="genre_id", referencedColumnName="id")}
* )
*/
protected $genres;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->genres = new ArrayCollection();
}
/**
* Add genre
*
* @param Genre $genre
* @return SelectionDynamicBook
*/
public function addGenre(Genre $genre)
{
if (!$this->genres->contains($genre)) {
$this->genres[] = $genre;
}
return $this;
}
/**
* Remove genre
*
* @param Genre $genre
*/
public function removeGenre(Genre $genre)
{
$this->genres->removeElement($genre);
}
/**
* Get genres
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGenres()
{
return $this->genres;
}
}
After my schema's update I have 2 tables :
- One with good prefix :
prefix_selection_selection
who contains all fields of Mother and Daugther class - One without prefix :
selection_book_genre
who represent the junction between the daughter (SelectionDynamiqueBook) and the object Genre
If I delete the lines 53/55 in your listener the second table as got a good prefixed table name (prefix_selection_book_genre
).
from doctrineprefixbundle.
Ok thanks for your help.
I'm on it as soon as possible !
from doctrineprefixbundle.
Hi,
I've tried to reproduce your problem, but I can't.
My prefix has called " roukmoute"
There is an small example with ManyToMany Unidirectional: https://gist.github.com/roukmoute/93d683735cd19a227c52
And this is a dump-sql : https://asciinema.org/a/83aax3mnh6noxjtxb8nxn8umg
All tables have roukmoute
from doctrineprefixbundle.
Hi,
You've forget to add inheritance SINGLE_TABLE !
The mother have to get
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({
* "key" = "Daugther",
* })
And is Daughter who have to get ManyToManty association with an other object.
It's the generated table for this association who has not good prefix.
I have send you an example in roukmoute / Entity.php
Thank
from doctrineprefixbundle.
Yep I've tried but your example need another tables, so I've tried just to apply about your first message.
OK I will try with "SINGLE_TABLE"
from doctrineprefixbundle.
OK I've the same thing as you :
- https://gist.github.com/roukmoute/87ca763085e4033e6a3d
- https://asciinema.org/a/axb3w1l6vrnxo0t9t7g889nqn
from doctrineprefixbundle.
You can see that your table 'daugthers_mothers' haven't got prefix ?
I don't know what this table is call 'daughters_mothers' because it's not write in your entity.php but You can see the problem in the assciinema
from doctrineprefixbundle.
Thanks !!
After update it works perfectly !
from doctrineprefixbundle.
👍
from doctrineprefixbundle.
Related Issues (4)
- Add support for indexes HOT 7
- tag a stable version HOT 2
- [Bug] add prefix to specified bundles HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctrineprefixbundle.