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

Contao 3 methods: URL handling #4698

Closed
aschempp opened this issue Aug 22, 2012 · 8 comments

Comments

Projects
None yet
2 participants
@aschempp
Copy link
Contributor

commented Aug 22, 2012

Currently, some routines for URL handling are in System (redirect, reload), while some are in Controller (redirectToFrontendPage).

In my opinion, the System class should be responsible for handling/parsing system configuration, while the Controller is responsible for request handling. Therefore, these methods should be moved to Controller (the method names are fine with me):

  • System::addToUrl()
  • System::reload()
  • System::redirect()
@leofeyer

This comment has been minimized.

Copy link
Member

commented Aug 29, 2012

Those methods are in the System class, because they are used by classes which do not inherit from Controller (but only from System).

@aschempp

This comment has been minimized.

Copy link
Contributor Author

commented Aug 30, 2012

These methods are static, it does not matter what you inherit (except for backwards compatibility). However, if a class does redirection, it should be a controller?

@leofeyer

This comment has been minimized.

Copy link
Member

commented Aug 30, 2012

Backwards compatibility, however, is important enough not to change it. How often are you using $this->redirect() or $this->reload() in your extensions? Do you really want to be forced to change every single occurrence to Controller::redirect()?

@aschempp

This comment has been minimized.

Copy link
Contributor Author

commented Aug 30, 2012

We would need to keep a backwards-compatible method in System:

class System
{
    protected function reload()
    {
        Controller::reload();
    }
}

leofeyer added a commit that referenced this issue Mar 22, 2013

@leofeyer

This comment has been minimized.

Copy link
Member

commented Mar 22, 2013

Changed in 8816a26.

@leofeyer leofeyer closed this Mar 22, 2013

@aschempp

This comment has been minimized.

Copy link
Contributor Author

commented Mar 25, 2013

Sorry for disturbing again. But as far as I remember, there is now a addToUrl in Controller and one in Backend? Is the Backend-one also static? Maybe the frontend-one should be in Frontend?

@leofeyer

This comment has been minimized.

Copy link
Member

commented Mar 25, 2013

AFAIK, there is one general method in the Controller (previously in the System class) and a custom routine in the Frontend class, which considers mod_rewrite.

@aschempp

This comment has been minimized.

Copy link
Contributor Author

commented Mar 25, 2013

You're absolutely correct! We're done here :D

leofeyer added a commit that referenced this issue Oct 31, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.