For symfony 1.3, ...

Add ability to use classes for helpers

Add ability to use classes for helpers instead of functions in global namespace.

223 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    gengen shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • JackovsonJackovson commented  ·   ·  Flag as inappropriate

        I was always wondering "why functions for helpers ??".

        Of course I can create my own classes in /lib... but helpers are just some short template piece of code.

        And what if I want extends an existing helper ? No I can not ! I can just replace the whole helper in my project....

        Actual helpers (and load by use_helper('Text')) make no sense to me. Why ?
        With basic classes, auto loading should be possible, inheritence, etc...

        Please, Keep It Simple... but not Supid :p

      • tommybgoodetommybgoode commented  ·   ·  Flag as inappropriate

        Helpers are proliferating, sooner or later we won't be so crazy about mashing them all into one namespace on purpose.

      • prodigitalsonprodigitalson commented  ·   ·  Flag as inappropriate

        True Tommy. But i disagree. It would be nice if for example the template itself contained a var that contained the helpers. I imagine this as a "manager" class instance with array access and/or proxy calls to the helper classes. There's nothing preventing one from doing this now, it would just be nice to have it done for you by default, with the option of turning it off in project or app settings.

      • tommybgoodetommybgoode commented  ·   ·  Flag as inappropriate

        This is already supported, just write a plugin with classes in its lib folder. You can call the public static methods in those classes from anywhere and they will be autoloaded.

      Feedback and Knowledge Base