-
Notifications
You must be signed in to change notification settings - Fork 36
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
use XML instead of annotations for Doctrine mapping to allow overriding it #20
Conversation
The bundle is already relying on |
Only as a dev requirement. |
13b181d
to
50e07a1
Compare
@rvanlaak: Fine to merge? |
Will check the PR branch later today |
50e07a1
to
04f6b27
Compare
Update 1: everything is working fine after switching to the XML annotations. Will try to override the XML mapping now. |
Doctrine tries to drop the UNIQUE index: DROP INDEX UNIQ_B95BA9425E237E06 ON craue_config_setting; |
Next to that, Doctrine won't allow us to override the entity without creating a super-class: We should make the config class a parameter, in the way how Sylius allows to override models: |
...or introduce a mapped superclass? I've added a commit for that. I now actually like the idea of being able to provide several mappings (ORM, ODM) and using dedicated files (XML or YAML) for that seems most convenient. A class config parameter could be added, but I guess this PR would still be needed in such case. Anyway, this is all new for me, so don't hesitate to prove me wrong. 😏
Are you sure it's due to this PR? I cannot reproduce that. |
Without that I don't see a way to let your Bundle use the Entity located in my application. Maybe add some docs about extending the
Definitely! 👍 |
31dfe46
to
5a39944
Compare
I made the class configurable and added a test, but there's one thing I don't have a solution for yet: The mapping file ( |
Will pull the changes and take a look into that within the hour 👍 |
Hmm, did find the "things to note" in this chapter: http://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#attribute-override |
Are you pointing to something special? Looks like all this stuff (overriding parts of a model, extending a model, supporting multiple drivers) is not as easy as I thought. |
Yeah, the following:
|
And you want to change the type of the |
@beberlei is there any chance overriding attribute types will become possible in the near future? |
This will probably only work if Then I can determine the way how |
I tried that locally but still couldn't get the mapping file loaded for the test.
What do you mean? |
If there's no way to make this work, I'm forced to drop that idea completely. |
96b6ca1
to
b5f8872
Compare
@rvanlaak, I started another approach and could finally make it work. 😄 Please take a look. |
Oh wow really, that would be awesome! So then we finally can make the config a I'm now looking into a nice way to make these configurations translatable / internationalizable :-) |
b5f8872
to
0184725
Compare
0184725
to
4efac97
Compare
I just made one more change to render the built-in form fields as
Luckily out of the scope of this PR. 😏 |
@rvanlaak, are any further changes needed or do you want me to just push the merge button? 😏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is ready for merge. Did place some minor comments, mainly related to removing year numbers ;-)
|
||
/** | ||
* @author Christian Raue <christian.raue@gmail.com> | ||
* @copyright 2011-2017 Christian Raue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd advise you to remove the years, to prevent you to have a task on January 1st.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep the year for now. It's not a big deal to perform a search and replace once a year. 😆
->thenInvalid('The driver "%s" is not supported. Please choose one of ' . json_encode($supportedDrivers)) | ||
->end() | ||
->end() | ||
// when at least two values are defined (Symfony < 3.1 throws an exception with only one value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, added a TODO task instead.
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
Author: Christian Raue <christian.raue@gmail.com> | ||
Copyright: 2011-2017 Christian Raue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about the year here ;)
@@ -16,17 +16,17 @@ | |||
} | |||
], | |||
"require": { | |||
"php": "^5.3.2|~7.0", | |||
"symfony/framework-bundle": "~2.3|~3.0" | |||
"php": "^5.3.9|~7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this PR release 2.0 of this bundle? If so, what about bumping it to >=5.5.9
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess 2.0 can be released soon, yes. But I'd like to keep Symfony 2.7 compatibility.
4efac97
to
3f447e1
Compare
Resolves #19. I've chosen XML over YAML to avoid a new dependency to
symfony/yaml
.@rvanlaak: Could you try this to make sure the mapping can actually be overridden as expected?