#53 ✓invalid
Gustavo Di Pietro

Allow dispatch to handle class methods

Reported by Gustavo Di Pietro | April 4th, 2011 @ 11:30 AM

It would be a great improvement to allow dispatch to accept class methods other than functions, like:

class Admin
    public static function new_post()

dispatch('/admin/new/post'/, 'Admin.new_post');

Comments and changes to this ticket

  • xangelo (at gmail)

    xangelo (at gmail) April 4th, 2011 @ 10:44 PM

    I would think this poses a limitation that is too strict. Anything added through this system would require that you need to have that feature as a static function. Why not just create the function Admin_new_post() which allows you to prepare the Admin() object as necessary before calling Admin->post()?

    To me, this is something that I would regard more as a convenience method as opposed to something that adds any real functionality to Limonade-php

  • xangelo (at gmail)

    xangelo (at gmail) April 5th, 2011 @ 05:00 PM

    I stand corrected:

    # Static class method call, MyClass::hello();
    dispatch('/hello', array('MyClass', 'hello'));
    # Object method call, $obj->hello();
    dispatch('/hello', array($obj, 'hello'));
    # Static class method call (As of PHP 5.2.3), MyClass::hello();
    dispatch('/hello', 'MyClass::hello');
  • Fabrice Luraine

    Fabrice Luraine May 27th, 2011 @ 07:01 AM

    • State changed from “new” to “invalid”

    dispatch methods handle a pseudo-type callback. It can be a function, an object method, a static method or a closure. See php documentation to learn more about callbacks.

  • JuanCena

    JuanCena September 28th, 2020 @ 12:44 PM

    I don't have an idea about this coding, the only codes I know are HTML and BBCodes. I used these codes when commenting in other blog sites or forum sites. I want to learn Python Programming language because most of the popular websites today like YouTube, Amazon, Spotify, Google, Instagram, Netflix, Uber, Dropbox, Pinterest, and many more are made using Python. I know that this Among Us game was created using Python.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Limonade is a PHP micro-framework.

People watching this ticket