Repository navigation
Allow non-array values to be properly written when parsing schemas - #162
Merged
Merged
Conversation
opengeek
force-pushed
the
Mark-H/parse-schema-constants
branch
from
September 24, 2020 18:42
c5a1c75 to
b8337bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imagine a model class like this:
When parsing the schema with a command like this:
... the xPDOGenerator parses constants and writes them into the platform specific class.
However due to a bug in
varExport, the value is lost, leading to the mysql class looking like this:which is invalid PHP and causes a hard fatal error.
With this patch, non-array values are preserved in constants, leading to functional code:
Personally I think it would be better if the constants weren't copied into platform classes at all. They're inherited, so why write them again?
I'm also using some constants that refer to other constants (e.g.
public const ENCRYPTION = EncryptionHelper::ENCRYPTION_SOME_TYPE), which due to this platform code is ending up with the value of that second constant, rather than the constant itself. Those values wont change, so that's fine for now, but it seems like a great source for potential bugs.I've looked at defining a custom platform template that skips it, but that doesn't seem possible to pass in at the moment.