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 Well-Known Member

    In my uninstall code, I think this is a bit redundant (for a table):
    $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:
    XenForo_Application::get('db')->query("DROP TABLE `blah`");
  2. Jeremy

    Jeremy Well-Known 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:
    		$settingsModel = new EWRporta_Model_Settings;
    		$settings = $settingsModel->getSettings();
    This can not be chained into:
    		$settings = new EWRporta_Model_Setting->getSettings();
  5. Jeremy

    Jeremy Well-Known 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