New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDC-1218: Generator disappear with mappedSuperclass and in others common inheritance's cases #1825
Comments
Comment created by ndm: The problem is in file doctrine/lib/Doctrine/ORM/Mapping, a solution, with just one change could be protected function loadMetadata($name)
{
if ( ! $this->initialized) {
...
// Move down the hierarchy of parent classes, starting from the topmost class
...
// Invoke driver
try {
$this->driver->loadMetadataForClass($className, $class);
} catch (ReflectionException $e) {
throw MappingException::reflectionFailure($className, $e);
}
//Change
if ($parent) {
//To
if ($parent && ! $parent->isInheritanceTypeNone()) {
//EndChange
if ($parent->isIdGeneratorSequence()) {
...
} |
Comment created by ndm: I have seen the resolution in doctrine later version, so i hesitate to close this issue. But i'm sure that the solution in place will not resolve all situation. By example, if the superclass isn't mapped but an entity with joined, this doesn't work properly, and you lost the id and the generator of the childclass. Another exemple, you want a mapped with generator, and subclass which don't indicate id, you can't the generator isn't include, and the id is required in the subclass. The code actually work just for same table proposition, and not good, because with same table you must indicate an not used id in the child class ( why an id is an obligation!!!, Sql permit to have table without id). If somebody read this, i propose a solution for inherited class with another schema, Each propositions are with a class inheriting from superclass : ####Schema for joinedclass.
or better and closest from the actual solution ( with obligation to have different id name)
####Schema for same table
The better for me :
####Schema for mapped
Even with there ideas, the possibility to have more than one generator method could be usefull. (i know that autoincrement can be use just one time). A solution, could be to add generator to field an not to entity in a first time, and treat generator at the end of the process not in the same place that the fields. So if you read this thank and aufwiedersehen. |
Comment created by holtkamp: This seems to relate to an issue I created at: http://www.doctrine-project.org/jira/browse/[DDC-1218](http://www.doctrine-project.org/jira/browse/DDC-1218) |
Comment created by @beberlei: Fixed |
Issue was closed with resolution "Fixed" |
Comment created by ndm: Thanks :) |
Jira issue originally created by user ndm:
With mapped superclass the id lost autoincrement. I've test with yaml and annotation this is the same.
An example with yaml entities :
The id in the table Image lost autoincrement.
The text was updated successfully, but these errors were encountered: