1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Untested, but does this work?

Discussion in 'XenForo Development Discussions' started by Jeremy, Nov 5, 2010.

  1. Jeremy

    Jeremy XenForo Moderator Staff Member

    In my uninstall code, I think this is a bit redundant (for a table):
    PHP:
    $db XenForo_Application::get('db');

    $db->query("DROP TABLE `blah`");
    I haven't tested this, but I wrote it this way (I haven't done an uninstall test), but will this work instead:
    PHP:
    XenForo_Application::get('db')->query("DROP TABLE `blah`");
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Scratch that -- it does. :) That's quite a smart set up we have going on here!
     
  3. Shadab

    Shadab Well-Known Member

  4. Jaxel

    Jaxel Well-Known Member

    Method chaining doesn't work for everything...

    For instance:
    Code:
    		$settingsModel = new EWRporta_Model_Settings;
    		$settings = $settingsModel->getSettings();
    This can not be chained into:
    Code:
    		$settings = new EWRporta_Model_Setting->getSettings();
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    That's cause EWRporta_Model_Setting isn't a function. get('db') is, so, it can chain.
     
  6. ragtek

    ragtek Guest

Share This Page