Skip to content
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

fix param converter to handle correctly isOptional parameter #150

Merged
merged 3 commits into from
May 7, 2012

Conversation

jaugustin
Copy link
Member

Hi,

This allow to have a paramConverter on an optional parameter.

I didn't run tests, wait for travisbot ;)

Edit: No travis bot damned :'( Build Status

@@ -29,8 +29,13 @@ public function apply(Request $request, ConfigurationInterface $configuration)
// find by Pk
if (in_array('id', $exclude) || false === $object = $this->findPk($classQuery, $request)) {
// find by criteria
if (false === $object = $this->findOneBy($classQuery, $request, $exclude)) {
throw new \LogicException('Unable to guess how to get a Propel object from the request information.');
if (false === ($object = $this->findOneBy($classQuery, $request, $exclude))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can avoid parenthesis near $object.

@willdurand
Copy link

What do you expect then? Just a null object? That means your route doesn't point a resource, right?

@jaugustin
Copy link
Member Author

A route like /page/{id} or /page/{slug}
if there is an Id or a slug the converter load the $category but if the id or slug is not provided it will just be a null object that you handle in your controller or view

Yes the route didn't point to the optional resource

willdurand added a commit that referenced this pull request May 7, 2012
fix param converter to handle correctly isOptional parameter
@willdurand willdurand merged commit c02e7ce into propelorm:1.1 May 7, 2012
@willdurand
Copy link

Thanks!

@jaugustin jaugustin deleted the fix-param-converter-optional branch October 21, 2017 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants