We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    <field key="charset" dbtype="varchar"0 phptype="string" null="true" />
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 22019
      • 390 Posts
      Hmm. Freaky deaky. I’ve just re-run it several times and it always generates a 0 for that one table at that location.

      NYAHA!

      Mr McCormick - once again I bow to your superior eye for detail. It transpires that three of the tables I had copied from elsewhere had a varchar(0) typo in the create statement which I didn’t spot. For some reason MySQL allowed it through.
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
      • Will you provide an easier way/method to generate the package with php only in the future "a la Doctrine" ?
        • Quote from: lossendae at Jan 19, 2011, 05:58 PM

          Will you provide an easier way/method to generate the package with php only in the future "a la Doctrine" ?
          Defining the structure in XML (or maybe JSON or YAML) sounds a lot easier (and more efficient) to me than having to write the code and execute functions at run-time to define the classes/maps. The higher-level representation of the model will be important as we move into features like schema migrations.
          • It doesn’t bother me but some people who are not accustomated with this method.

            If a user does not need to set any relationship (at the begginning) it can bothersome to him to understand that he have to create an xml files and then parse it and all the "things" behind xPDO.
            I think that levelling down (?) the access to the API with a simpler method that can be extended for those who need the full capabilities can be good to convince people to jump into the xpdo wagon.

            But i understand that it is not a priority since they have ultimately access to native PDO without the need to generate the map classes.
              • 14372
              • 49 Posts

              splittingred

              Note that the xml schema outputted doesn't define the aggregates/composites (i think it does the indexes, but you'll have to check).

              You'll have to define the relationships in the XML yourself. It doesn't take that long, though.

              By any chance has this changed? Feeling a bit lazy, but who wouldn't mind a little automation? smiley
                • 18409
                • 54 Posts
                HI,
                I get the following errors when running the script that links here (http://rtfm.modx.com/display/revolution20/Reverse+Engineer+xPDO+Classes+from+Existing+Database+Table) , any ideas?!

                PHP Notice: Array to string conversion in D:\websites\avon-mc\core\xpdo\xpdo.class.php on line 439
                PHP Stack trace:
                PHP 1. {main}() D:\websites\avon-mc\generate_schema.php:0
                PHP 2. xPDO->getManager() D:\websites\avon-mc\generate_schema.php:163
                PHP 3. xPDO->loadClass() D:\websites\avon-mc\core\xpdo\xpdo.class.php:1207
                PHP 4. array_diff_assoc() D:\websites\avon-mc\core\xpdo\xpdo.class.php:439

                It doesn't generate any class files or the XML schema.

                This is on Revo 2.0.4-pl2 rev7212

                Any ideas?! smiley
                  • 18409
                  • 54 Posts
                  It doesn't like hyphens in database names, which is weird because MODX works fine with them.

                  Renaming it to avon_mc and it works fine, go figure...!
                    • 3749
                    • 24,544 Posts
                    Quote from: lossendae at Jan 19, 2011, 07:00 PM


                    If a user does not need to set any relationship (at the begginning) it can bothersome to him to understand that he have to create an xml files and then parse it and all the "things" behind xPDO.

                    Maybe I'm misunderstanding you, but there's a snippet here that will create the schema and class files for you: http://bobsguides.com/custom-db-tables.html


                    ------------------------------------------------------------------------------------------
                    PLEASE, PLEASE specify the version of MODX you are using.
                    MODX info for everyone: http://bobsguides.com/modx.html
                      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
                    • I can vouch for that snippet, it works great!
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org