We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33968
    • 863 Posts
    Hi Charles, I think your class is ok - Shaun must have extended his Doodle class to add the extra save functionality.

    In your snippet, I’m not sure if these two lines are necessary:
    $base_path = !empty($base_path) ? $base_path : $modx->getOption('core_path').'components/awdbios/';
    $modx->addPackage('awdbios',$base_path.'model/');
    


    Otherwise all I can suggest is to perhaps set these files aside and walk yourself through the Doodles tutorial again. Sometimes it’s easier to start again than to try and find an error in code you’ve been chopping and changing.
      • 3749
      • 24,544 Posts
      If the DB tables exist already and the relationships are not too complex, this might be another option:

      http://bobsguides.com/custom-db-tables.html

      You may have to edit the schema between the steps.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 34084 ☆ A M B ☆
        • 756 Posts
        Quote from: lucas at Jul 07, 2011, 01:40 AM

        Hi Charles, I think your class is ok - Shaun must have extended his Doodle class to add the extra save functionality.


        Otherwise all I can suggest is to perhaps set these files aside and walk yourself through the Doodles tutorial again. Sometimes it’s easier to start again than to try and find an error in code you’ve been chopping and changing.


        Yep, did that several times and always end up with the could not get table error.
        [2011-07-07 09:21:37] (ERROR @ /modxrevo/index.php) Could not get table name for class: Awdbio


        I’ve started from scratch completely... new ModX Revo install and all new files... crossing my fingers
          Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
          Visit CharlesMx.com for latest news and status updates.
          • 34084 ☆ A M B ☆
          • 756 Posts
          Quote from: BobRay at Jul 07, 2011, 02:38 AM

          If the DB tables exist already and the relationships are not too complex, this might be another option:

          http://bobsguides.com/custom-db-tables.html

          You may have to edit the schema between the steps.

          thanks, that might have to be the end solution though I was intending on a more complex table structure to get as normalized as possible... but deadline is looming so might just have to try that method
            Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
            Visit CharlesMx.com for latest news and status updates.
            • 33968
            • 863 Posts
            One more thing you could try as since Revo 2.1 you may need to explicitly set AUTO_CREATE_TABLES to ’true’.

            Take a look OpenGeek’s suggestions here:
            http://modxcms.com/forums/index.php?topic=64368.0

            If that does it then that Doodles tutorial will need to be updated,
              • 34084 ☆ A M B ☆
              • 756 Posts
              Quote from: lucas at Jul 07, 2011, 10:25 AM

              One more thing you could try as since Revo 2.1 you may need to explicitly set AUTO_CREATE_TABLES to ’true’.

              Take a look OpenGeek’s suggestions here:
              http://modxcms.com/forums/index.php?topic=64368.0

              Thanks, that might save me some time as I just jumped from 2.0.8 to the latest version 2.1.2

              I’ll let you all know how well this round goes. I’m still baffled that I get that error when my local machine creates the xPDO class files but I I use the actual Doodles source zip file and the classes that are already packaged it makes the database tables just fine with no issues.

              Cheers
                Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
                Visit CharlesMx.com for latest news and status updates.
                • 3749
                • 24,544 Posts
                Quote from: charless at Jul 07, 2011, 09:24 AM

                Quote from: BobRay at Jul 07, 2011, 02:38 AM

                If the DB tables exist already and the relationships are not too complex, this might be another option:

                http://bobsguides.com/custom-db-tables.html

                You may have to edit the schema between the steps.

                thanks, that might have to be the end solution though I was intending on a more complex table structure to get as normalized as possible... but deadline is looming so might just have to try that method

                You can edit the schema file to add the relationships between the tables before doing the final step.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 34084 ☆ A M B ☆
                  • 756 Posts
                  Still think I have a name mismatch since I can’t get anything I do locally to run, although the Doodles example will work if I download the source files - but I can’t recreate the xPDO class files or I get the same errors as when I build everything from scratch.

                  I’m running on a Linux box with php5.3 and Revo 2.1.2 tried with Lighty and Apache no luck... I’ll keep plugging away until I figure this out....

                    Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
                    Visit CharlesMx.com for latest news and status updates.
                    • 18373 ☆ A M B ☆
                    • 3,141 Posts
                    How are you creating the class files?


                    For reference, here’s how I create the tables from an external file in my _build directory..
                    <?php
                    
                    
                    require_once dirname(dirname(__FILE__)) . '/config.core.php';
                    require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
                    $modx= new modX();
                    $modx->initialize('mgr');
                    
                    $modelPath = $modx->getOption('providerx.core_path',null,$modx->getOption('core_path').'components/PKG NAME/').'model/';
                    
                    $modx->addPackage('lowercasepackagename',$modelPath);
                    
                    $manager = $modx->getManager();
                    $modx->setLogLevel(modX::LOG_LEVEL_ERROR);
                    $manager->createObjectContainer('objectName');
                    $manager->createObjectContainer('otherObjectName');
                    $modx->setLogLevel(modX::LOG_LEVEL_INFO);
                    
                    echo 'done';
                    ?>
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                      • 34084 ☆ A M B ☆
                      • 756 Posts
                      Creating the classes with the folowing (as provided in modExtra) and also used the same processes as defined in the Doodles examples.

                      <?php
                      
                      //-- Short Hand
                      $awdbios = $modx->getService('awdbios','Awdbio',$modx->getOption('awdbios.core_path',null,$modx->getOption('core_path').'components/awdbios/').'model/awdbios/',$scriptProperties);
                      if (!($awdbios instanceof Awdbio))
                          return '<br />NO instance of Awdbios.<br />';
                      
                      
                      
                      $output = '';
                      
                      $m = $modx->getManager();
                      $created = $m->createObjectContainer('Awdbio');
                      return $created ? 'Table created.' : 'Table not created.';
                      
                      
                      
                      return $output;
                        Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
                        Visit CharlesMx.com for latest news and status updates.