This repository was archived by the owner on Jan 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
better support for item creation #28
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8fe92e5
handling of collections
adou600 d6739ae
fix method use
adou600 f40442a
empty line fix
adou600 7946c51
base RuntimeException instead of Symfony2 Exception
adou600 6f1eda4
cleanup and fixes after reverse relation mapping refactoring
adou600 c45d68a
sotre entities instead of objects
adou600 737d779
handling of ItemExistsException during entity persisting
adou600 c60a630
throw exception if missing meta mapping are found (nodename and paren…
adou600 f7016a2
more generic RestService::_handleCreate
adou600 78a0b13
effective handling of creation without a parent
adou600 4d46a83
remove unused namespace
adou600 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
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.
this will be quite ahrd to debug. i wonder how we should do that in general?
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.
but lets not block the merge by this question, before we just had a 500 in that case, now at least we handle it. maybe open a new issue?
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.
Well, I think the cleanest solution here would be to catch this condition during validation. Of course, this is an entire new can of worms, but at least with a validation rule, you could give the user meaningful feedback
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.
Could we also introduce a logging system like monolog and use it for all those kind of exceptions handling? But I don't know if one usually do it inside libraries like createphp or if it is part of the good practice...
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.
the sad thing is that fig did not want a general logger interface, so if we do something we tie to some implementation like Monolog (or at least the symfony logger interfaces)
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.
actually we are quite close to getting a log interface into fig.
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.
sure, logging would be good to have, but in a case like this, we will have to inform the end-user anyways, since they need to know that their input could not be saved. So we need a way to let the error bubble back to the user. If the store method is triggered programmatically, I think an exception would be the way to go, since then the calling code can decide what to do. If store is triggered via the REST handler, it could also catch the exception and send its message to the browser. This of course needs support from Create.js. I talked about this issue with @bergie at some point, but I'm not sure if there is a way to pass error messages back to Create.js yet.
But like i said, IMO this should ideally already be caught by validation (i.e. a unique constraint on the relevant field), and the exception should just be the fallback.
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 created #41