We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34887
    • 4 Posts
    Hi there i got a question.

    I am developing an extra, using the tutorial ’Developing an Extra in MODX Revolution’ written by Shaun McCormick.

    I am currently at part 1:Building the Query

    First my Settings :

    • Root - /Users/friso/Sites
    • Local modx - /Users/friso/Sites/modx
    • Extra - /Users/friso/Sites/sterc-modx-extra/booking/
    • [li]OS X Mac Lion / Mamp / Revo 2.1.3[/i]

    I get this error PHP Fatal error: Class ’Booking_mysql’ not found in /Users/friso/Sites/modx/core/xpdo/xpdo.class.php on line 615

    The model dir is /Users/friso/Sites/sterc-modx-extra/booking/core/components/booking/model/booking/

    Does someone got a clue?
    I don’t wink

    I know the class Booking is loaded via print_r(get_declared_classes());



      • 28215
      • 4,149 Posts
      Are you calling loadClass without the 3rd and 4th parameter being true?
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 34887
        • 4 Posts
        I do not use loadClass i guess


        $book = $modx->getService(’booking’,’Booking’,$modx->getOption(’booking.core_path’,null,$modx->getOption(’core_path’).’components/booking/’).’model/booking/’,$scriptProperties);
        if (!($book instanceof Booking)) return false;

        /* setup default properties */
        $tpl = $modx->getOption(’tpl’,$scriptProperties,’rowTpl’);
        $sort = $modx->getOption(’sort’,$scriptProperties,’name’);
        $dir = $modx->getOption(’dir’,$scriptProperties,’ASC’);

        //$output = ’’;

        $m = $modx->getManager();
        $created = $m->createObjectContainer(’Booking’);

        return $created ? ’Table created.’ : ’Table not created.’;
        //return $output;

          • 28215
          • 4,149 Posts
          Erm,

          You’ve got a service class called ’Booking’...and you’re trying to create an object container of a class named ’Booking’, which would mean you defined a class in your schema named Booking, which would mean it conflicts with your main service class named ’Booking’...

          You need to choose a new name for either your service class or your object class.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 34887
            • 4 Posts
            Oke that helped laugh Thanks for so far.


            Now I got another error

            [2011-08-10 16:07:13] (ERROR @ /modx/index.php) Could not load class: Reservation from mysql.reservation.
            [2011-08-10 16:07:13] (ERROR @ /modx/index.php) Could not load class: Guests from mysql.guests.
            [2011-08-10 16:07:13] (ERROR @ /modx/index.php) Could not load class: Tour from mysql.tour.

            How are these classes declared? and loaded?

            I didn’t know i could have some much trouble creating some database tables tongue


            I included the booking.mysql.schema.xml
              • 28215
              • 4,149 Posts
              You need to call $modx->addPackage.

              http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution

              See:

              $this->modx->addPackage('doodles',$this->config['modelPath']);
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 34887
                • 4 Posts
                So easy to overlook.

                It works like a charm.

                Thanks allot Shaun.

                Really appreciate it