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

Exception throw on missing resource is now configurable. #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PedroTroller
Copy link
Member

@PedroTroller PedroTroller commented Oct 26, 2016

No description provided.

@PedroTroller PedroTroller force-pushed the feature/configurable-not-found-exception branch from a8caf31 to cf910b9 Compare Oct 26, 2016
service: app.building.repository
method: findByCountryAndCityAndActivity
arguments: [$countryId, $citySlug, "School"]
on-missing: 401

Choose a reason for hiding this comment

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

At least, I would have add a "throw" key:

_resources:
    buildings:
        service: app.building.repository
        method: findByCountryAndCityAndActivity
        arguments: [$countryId, $citySlug, "School"]
        on-missing:
            throw: 401

That would allow us to add more functionalities when a resource is missing. For instance:

_resources:
    buildings:
        service: app.building.repository
        method: findByCountryAndCityAndActivity
        arguments: [$countryId, $citySlug, "School"]
        on-missing:
            redirect: 
                route: 'app.homepage'
                parameters: 
                    - 'some_params'

Copy link

@Einenlum Einenlum Nov 3, 2016

Choose a reason for hiding this comment

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

Oh, clever! 👍

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants