We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Hi there,

    Recently followed an article to breate custom taqble, build schema and classes etc.
    All worked well.

    When I try and use my object however it never returns?
    $modx->addPackage('storefinder',$base_path.'model/');

    $stores = $modx->getCollection('sfStore');
    print_r($stores);

    Returns empty array. There are about 20 lines in the table I added.
    If I try and create and save() a new object it does nothing. IE no new line in the DB.
    No errors, which is concerning??

    Any ideas...

    J
      • 15083
      • 697 Posts
      [[Solved]]
      When adding the table name in the xml schema, DON'T ADD THE PREFIX!!!

      <object class="csGames" table="mytable" extends="xPDOSimpleObject">
      Actual table name in DB: modx_mytable
        • 28215
        • 4,149 Posts
        You can add the prefix, if you specify it in the 3rd parameter of the addPackage call. However, it's recommended not to use a table prefix, as that prevents the addon from being installed in multiple MODX installs on one DB.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com