Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Support for setting the redirect content as a content document #163

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

Conversation

dantleech
Copy link
Member

Allow configuring the redirect target to be set as the content document instead of the route.

See: symfony-cmf/routing-auto#43
Depends: symfony-cmf/routing-auto#56

Discussion: Redirecting to the content is certainly better -- otherwise there is just an ever growing chain of auto routes which must be resolved (e.g. rename something 50 times, then there is a maximum of 50 routes which must be resolved).

So I would say that in 2.0 the content document should be the redirect target by default. But do we want to make this the ONLY choice? To what extent does it make sense to redirect to another route?

TODO: Need to add configuration for this.


$adapter->createRedirectRoute($this->route->reveal(), $newRoute->reveal());
}

Copy link
Member Author

Choose a reason for hiding this comment

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

dd

@lsmith77 lsmith77 added review and removed wip/poc labels Sep 15, 2015
$referringAutoRoute->setRedirectTarget($newRoute);
switch ($this->redirectTarget) {
case self::REDIRECT_CONTENT:
$target = $newRoute->getContent();
Copy link
Member

Choose a reason for hiding this comment

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

imho, we should make redirect to content the default, but fall back to the route if there is no content (which is a valid situation). i don't think we need the configuration options with constants, if there is a content of a route and it implements RouteReferrersReadInterface, we should take that over the route. but only in that case. the content could be not route aware, or there can be routes with no content object.

Copy link
Member Author

Choose a reason for hiding this comment

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

The main thing that concerns me is the change of behavior - the option is there to preserve the existing behavior, if we now set the redirect target as the content, and the user is handling the redirect as if it were always a Route object, then it's a BC break ?

@wouterj
Copy link
Member

wouterj commented Oct 29, 2015

The PR on the component is nowmerged, @dantleech can you please finish this PR?

@wouterj wouterj added this to the 1.1 milestone Oct 29, 2015
@wouterj wouterj modified the milestone: 1.1 Mar 30, 2016
@dbu
Copy link
Member

dbu commented Aug 10, 2017

@dantleech is this still relevant or should we drop it?

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

Successfully merging this pull request may close these issues.

4 participants