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

    I have introduced my newest project "Call Me Back" a couple of weeks (http://modxcms.com/forums/index.php/board,179.0.html) and I’m currently finishing up. Something is wrong however. I used the example "Doodles" and improved on it (or failed, who knows). I modified it’s readability for my slightly, and to serve a multiple usage purpose. No need to open all files, simply use a config that supplies it with all the data is needs. Alright, now that I’ve got that out of the way (and I’ll post it), here is the result from the transporter.

    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Created new transport package with signature: callmeback-1.1-beta1
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Registered package namespace as: callmeback
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Packaged namespace "callmeback" into package.
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Packaging snippets...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Packaging chunks...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Adding file resolvers to category...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Packaging menu and actions...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Adding in PHP resolvers...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Adding package attributes and setup options...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Packing up transport package zip...
    [2010-09-21 15:00:05] (INFO @ /_compile/callmeback-1.1-beta-transport/_build/build.transport.php) Package build! Execution time: 0.95


    Alright, no errors, it all works fine! I can install the package, snippets, chunks and the manager panel - all work fine, but it does not install the database table to view in phpMyAdmin, and it does report an sort like error.

    Console running...
    
    Workspace environment initiated, now installing package...
    Attempting to install package with signature: callmeback-1.1-beta1
    Package found...now preparing to install.
    Grabbing package workspace...
    Successfully installed package callmeback-1.1-beta1
    Could not load class: callmeback from mysql.callmeback.


    So, what am I doing wrong? Underneath is my build.transport.php
    <?php
    
        /**
        * @author ReSpawN
        * @copyright 2010
        */
    
        set_time_limit(0);
        echo '<pre>';
    
        $log = array('timer' => array('start' => 0, 'end' => 0));
        if (!isset($pck) || empty($pck)) {
            $pck = @require_once(dirname(dirname(__FILE__)).'/transport.package.php');
    
            if (!$pck || !isset($pck) || empty($pck)) {
                $modx->log(modX::LOG_LEVEL_ERROR, 'MODx Transporter :: Failed including the transport details ('.__FILE__.' : '.__LINE__.')');
                exit();
            }
        }
    
        list($mc, $sec) = explode(' ', microtime());
        $log['timer']['start'] = ($mc + $sec);
    
        $root = dirname(dirname(__FILE__)).'/';
        $sources = array(
            'root' => $root,
            'build' => $root.'_build/',
            'data' => $root.'_build/data/',
            'resolvers' => $root.'_build/resolvers/',
            'core' => $root.'core/components/'.$pck['alias'].'/',
            'source_core' => $root.'core/components/'.$pck['alias'].'/',
            'model' => $root.'core/components/'.$pck['alias'].'/model/',
            'class' => $root.'core/components/'.$pck['alias'].'/model/'.$pck['alias'].'/'.$pck['alias'].'.class.php',
            'lexicon' => $root.'core/components/'.$pck['alias'].'/lexicon/',
            'docs' => $root.'core/components/'.$pck['alias'].'/docs/',
            'schema' => $root.'core/components/'.$pck['alias'].'/model/schema/',
            'source_assets' => $root.'assets/components/'.$pck['alias'].'/'
        );
    
        unset($root, $mc, $sec);
    
        require_once($sources['build'].'build.config.php');
        require_once(MODX_CORE_PATH.'model/modx/modx.class.php');
    
        $modx = new modX();
        $modx->initialize('mgr');
    
        $modx->setLogLevel(modX::LOG_LEVEL_INFO);
        $modx->setLogTarget('ECHO');
    
        $modx->loadClass('transport.modPackageBuilder', '', false, true);
        $builder = new modPackageBuilder($modx);
        $builder->createPackage($pck['alias'], $pck['version'], $pck['release']);
        $builder->registerNamespace($pck['alias'], false, true, '{core_path}components/'.$pck['alias'].'/');
    
        $category = $modx->newObject('modCategory');
        $category->set('id', 1);
        $category->set('category', $pck['name']);
    
        $modx->log(modX::LOG_LEVEL_INFO, 'Packaging snippets...');
        $snippets = include($sources['data'].'transport.snippets.php');
    
        if (empty($snippets)) {
            $modx->log(modX::LOG_LEVEL_INFO, 'Could not package snippets');
        }
    
        $modx->log(modX::LOG_LEVEL_INFO, 'Packaging chunks...');
        $chunks = include($sources['data'].'transport.chunks.php');
    
        if (empty($chunks)) {
            $modx->log(modX::LOG_LEVEL_INFO, 'Could not package chunks');
        }
    
        $category->addMany($snippets);
        $category->addMany($chunks);
    
        $attributes = array(
            xPDOTransport::UNIQUE_KEY => 'category',
            xPDOTransport::PRESERVE_KEYS => false,
            xPDOTransport::UPDATE_OBJECT => true,
            xPDOTransport::RELATED_OBJECTS => true,
            xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
                'Children' => array(
                    xPDOTransport::PRESERVE_KEYS => false,
                    xPDOTransport::UPDATE_OBJECT => true,
                    xPDOTransport::UNIQUE_KEY => 'category',
                    xPDOTransport::RELATED_OBJECTS => true,
                    xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
                        'Snippets' => array(
                            xPDOTransport::PRESERVE_KEYS => false,
                            xPDOTransport::UPDATE_OBJECT => true,
                            xPDOTransport::UNIQUE_KEY => 'name',
                        ),
                        'Chunks' => array(
                            xPDOTransport::PRESERVE_KEYS => false,
                            xPDOTransport::UPDATE_OBJECT => true,
                            xPDOTransport::UNIQUE_KEY => 'name',
                        )
                    )
                ),
                'Snippets' => array(
                    xPDOTransport::PRESERVE_KEYS => false,
                    xPDOTransport::UPDATE_OBJECT => true,
                    xPDOTransport::UNIQUE_KEY => 'name',
                ),
                'Chunks' => array(
                    xPDOTransport::PRESERVE_KEYS => false,
                    xPDOTransport::UPDATE_OBJECT => true,
                    xPDOTransport::UNIQUE_KEY => 'name',
                )
            )
        );
    
        $vehicle = $builder->createVehicle($category, $attributes);
    
        $modx->log(modX::LOG_LEVEL_INFO, 'Adding file resolvers to category...');
        $vehicle->resolve('file', array(
            'source' => $sources['source_assets'],
            'target' => "return MODX_ASSETS_PATH . 'components/';",
        ));
        $vehicle->resolve('file', array(
            'source' => $sources['source_core'],
            'target' => "return MODX_CORE_PATH . 'components/';",
        ));
        $builder->putVehicle($vehicle);
    
        $modx->log(modX::LOG_LEVEL_INFO, 'Packaging menu and actions...');
        $menu = include($sources['data'].'transport.menu.php');
    
        if (empty($menu)) {
            $modx->log(modX::LOG_LEVEL_ERROR, 'Could not find any menus or actions');
        }
    
        $vehicle = $builder->createVehicle($menu, array (
            xPDOTransport::PRESERVE_KEYS => true,
            xPDOTransport::UPDATE_OBJECT => true,
            xPDOTransport::UNIQUE_KEY => 'text',
            xPDOTransport::RELATED_OBJECTS => true,
            xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
                'Action' => array (
                    xPDOTransport::PRESERVE_KEYS => false,
                    xPDOTransport::UPDATE_OBJECT => true,
                    xPDOTransport::UNIQUE_KEY => array ('namespace','controller'),
                )
            )
        ));
    
        $modx->log(modX::LOG_LEVEL_INFO, 'Adding in PHP resolvers...');
        $vehicle->resolve('php',array(
            'source' => $sources['resolvers'] . 'resolve.tables.php',
        ));
        $builder->putVehicle($vehicle);
        unset($vehicle,$menu);
    
        $modx->log(modX::LOG_LEVEL_INFO,'Adding package attributes and setup options...');
        $builder->setPackageAttributes(array(
            'license' => file_get_contents($sources['docs'].'license.txt'),
            'readme' => file_get_contents($sources['docs'].'readme.txt'),
            'changelog' => file_get_contents($sources['docs'].'changelog.txt'),
            'setup-options' => array(
                'source' => $sources['build'].'setup.options.php',
            )
        ));
    
        $modx->log(modX::LOG_LEVEL_INFO,'Packing up transport package zip...');
        $builder->pack();
    
        list($mc, $sec) = explode(' ', microtime());
        $log['timer']['end'] = ($mc + $sec);
    
        $log['timer']['total'] = round(($log['timer']['end'] - $log['timer']['start']), 3);
    
        $modx->log(modX::LOG_LEVEL_INFO, 'Package build! Execution time: '.$log['timer']['total']);
    
        exit ();


    Which, before it does anything, included this:

    <?php
    
        /**
        * @author ReSpawN
        * @copyright 2010
        */
    
        $pck = array(
            'name' => 'Call Me Back',
            'alias' => 'callmeback', // Folder, component, menu, action, namespace alias
            'version' => '1.1',
            'release' => 'beta1',
            'dir' => array(
                'basedir' => 'public_html', // httpdocs, public_html or www (absolute dir)
                'modx' => '' // Location within the basedir (usually empty, or modx, leave empty if none)
            ),
            'elements' => array(
                'snippet' => array(
                    'name' => 'callMeBack',
                    'desc' => 'A Call Me Back Snippet'
                ),
                'chunk' => array(
                    'name' => '',
                    'desc' => ''
                )
            ),
            'properties' => array(
                array(
                    'name' => 'closed',
                    'desc' => 'Some kind of desc',
                    'type' => 'combo-boolean',
                    'options' => '',
                    'value' => false
                ),
                array(
                    'name' => 'enzo',
                    'desc' => 'the format of stuff..',
                    'type' => 'textfield',
                    'options' => '',
                    'value' => 'Hiho!'
                )
            )
        );
    
        return $pck;


    And the directory structure incl. de transport builder.



    And a small video of how to show how I fail. tongue
    http://www.youtube.com/watch?v=wSR-47GyCLk&hd=1

    Hopefuly you guys can help me out, because I already lost about 6 hours to this problem.
      @MarkGHErnst

      Developer at Adwise Internetmarketing, the Netherlands.
      • 24865
      • 289 Posts
      And for those who want to download the transport package itself, you are most welcome to do so.

      NOTE! I have NOT released this package on the account that it’s still unstable and not fully operational. Use with caution and thus I do not take responsibility when your site malfunctions.
      callmeback-1.1-beta1.transport.zip
        @MarkGHErnst

        Developer at Adwise Internetmarketing, the Netherlands.
        • 24865
        • 289 Posts
        I’m still stuck, anybody gonna help lil’ old me out? tongue This is something I need to get right before I start releasing my components the community...
          @MarkGHErnst

          Developer at Adwise Internetmarketing, the Netherlands.
          • 24865
          • 289 Posts
          Seriously? Still no one? Already got 125 views over here...
            @MarkGHErnst

            Developer at Adwise Internetmarketing, the Netherlands.
            • 26903
            • 1,336 Posts
            Whats in resolve.tables.php?
              Use MODx, or the cat gets it!
              • 24865
              • 289 Posts
              <?php
              
              	/**
              	* @author ReSpawN
              	* @copyright 2010
              	*/
              
              	if ($object->xpdo) {
              	    switch ($options[xPDOTransport::PACKAGE_ACTION]) {
              	        case xPDOTransport::ACTION_INSTALL:
              	            $modx =& $object->xpdo;
              	            $modelPath = $modx->getOption('twitx.core_path', null, $modx->getOption('core_path').'components/twitx/').'model/';
              	            $modx->addPackage('twitx', $modelPath);
              
              	            $manager = $modx->getManager();
              
              	            $manager->createObjectContainer('twitx');
              	            break;
              	        case xPDOTransport::ACTION_UPGRADE:
              	            break;
              	    }
              	}
              
              	return true;
                @MarkGHErnst

                Developer at Adwise Internetmarketing, the Netherlands.
                • 26903
                • 1,336 Posts
                OK, not sure what ’twitx’ is here but looking at the original error
                Could not load class: callmeback from mysql.callmeback.
                and lookin at your /core/model directory under the mysql directory you don’t have a file named callmeback, they are called ’cmb......’ I think its a name clash somewhere, the package installer may take the ’callmeback’ as a prefix, the core guys may know more here.
                  Use MODx, or the cat gets it!