We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    No matter what I’ve tried, the two resources aren’t being installed. I get two error messages (see below). The two resource installation files are there and the install claims it was successful.

    Here’s the build code for the resources:

    /* Now we'll add the resources (documents) */
    $i++;
    $modx->log(MODX_LOG_LEVEL_INFO,"Creating resource: Contact Page<br />");
    
    $r = $modx->newObject('modResource');
    
    //$r->set('name','spfResponsePage');
    //$r->set('class_key','modDocument');
    
    $r->set('id',$i);
    
    $r->set('type','modResource');
    //$r->set('type','document');
    
    $r->set('contentType','text/html');
    $r->set('pagetitle','Contact');
    $r->set('longtitle','Contact Us');
    $r->set('description','Spam-proof Contact Form');
    $r->set('alias','contact');
    $r->set('published',1);
    $r->set('parent',0);
    $r->set('isfolder',0);
    $r->setContent('[[!SPForm]]');
    $r->set('richtext',0);
    $r->set('menuindex',99);
    $r->set('searchable',0);
    $r->set('cacheable',1);
    $r->set('menutitle','Contact Us');
    $r->set('donthit',0);
    $r->set('hidemenu',0);
       $attributes= array(
            XPDO_TRANSPORT_UNIQUE_KEY => 'name',
            XPDO_TRANSPORT_UPDATE_OBJECT => true,
            XPDO_TRANSPORT_PRESERVE_KEYS => false
    
        );
    $vehicle = $builder->createVehicle($r, $attributes);
    $builder->putVehicle($vehicle);



    Error 42S22 executing statement: 
    Array
    (
        [0] => 42S22
        [1] => 1054
        [2] => Unknown column 'modResource.name' in 'where clause'
    )

      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
      • 28215
      • 4,149 Posts
         $attributes= array(
              XPDO_TRANSPORT_UNIQUE_KEY => 'name',
              XPDO_TRANSPORT_UPDATE_OBJECT => true,
              XPDO_TRANSPORT_PRESERVE_KEYS => false
          );
      


      should be:

      $attributes= array(
              XPDO_TRANSPORT_UNIQUE_KEY => 'pagetitle',
              XPDO_TRANSPORT_UPDATE_OBJECT => true,
              XPDO_TRANSPORT_PRESERVE_KEYS => false
      );
      


      The unique key attribute tells modx what is the identifier to search for when installing to make sure it’s not installing a duplicate.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 3749
        • 24,544 Posts
        Perfecto!. I also had to add $r->set(’context_key’,’web’); before they’d show up in the tree.

        When I finally looked in the DB, I had about 12 copies of each resource there. wink


        Is "Update Package" supposed to be working in Package Management? I’m not clear on what it’s supposed to do, but It just locks up showing a blank console for me.
          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
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: BobRay at Nov 15, 2008, 01:32 PM

          Is "Update Package" supposed to be working in Package Management? I’m not clear on what it’s supposed to do, but It just locks up showing a blank console for me.
          Not yet; this will be a more involved process in which a new version/release of the package is available from the original provider (or possibly on the local filesystem) and is automatically downloaded, added as a new local package, and installation kicked off. This will essentially disable the old package and make the new version active.

          Speaking of, we’ll need to add logic to make sure re-/un-install cannot be performed on older versions of a package when a newer one is installed.