We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44195
    • 293 Posts
    I can create and remove with no problems but I can't update on this particular table.
    I can update on my other table without this trouble, yet they're configured the same way.

    I pinpointed where the error is coming from by overriding the initialize() function, it chokes on the first two lines:
    $primaryKey = $this->getProperty($this->primaryKeyField,false);
    if (empty($primaryKey)) return $this->modx->lexicon($this->objectType.'_err_ns');
    


    My entire processor is this:
    class GalleryUpdateProcessor extends modObjectUpdateProcessor {
        public $classKey = 'galleries';
        public $languageTopics = array('project:default');
        public $objectType = 'project';
    }
    return 'GalleryUpdateProcessor';
    


    My table is this:
        <object class="galleries" table="project_galleries" extends="xPDOSimpleObject">
            <field key="galleryname" dbtype="varchar" precision="250" phptype="string" null="true" default="" />
            <field key="description" dbtype="text" phptype="string" />
            <field key="artworktotal" dbtype="int" precision="10" phptype="integer" null="true" default="0" />
            <field key="url" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
            <field key="enabled" dbtype="int" precision="1" phptype="integer" null="true" default="0" />
            <field key="phase" dbtype="int" precision="1" phptype="integer" attributes="unsigned" null="false" default="0" />
            <field key="type" dbtype="int" precision="1" phptype="integer" attributes="unsigned" null="false" default="0" />
            <field key="cover_filename" dbtype="varchar" precision="250" phptype="string" null="true" default="" />
            <field key="vote_on" dbtype="int" precision="1" phptype="integer" attributes="unsigned" null="true" default="" />
            <field key="votes" dbtype="int" precision="10" phptype="integer" null="true" default="0" />
            <field key="createdon" dbtype="datetime" phptype="datetime" null="true" />
            <field key="createdby" dbtype="int" precision="10" phptype="integer" attributes="unsigned" null="true" default="0" />
            <composite alias="Artwork" class="artworks" local="id" foreign="gallery_id" cardinality="many" owner="local" />
            <aggregate alias="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign" />
        </object>
    


    Why would my primary key be showing up as empty?

    This question has been answered by markh. See the first response.

      I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
      Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
    • discuss.answer
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Can you see an "id" field in the AJAX request?
        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.
        • 44195
        • 293 Posts
        Quote from: markh at May 20, 2014, 10:22 AM
        Can you see an "id" field in the AJAX request?

        *facepalm*

        Thank you Mark! I had indeed forgotten to include a hidden id field. Much appreciated!
          I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
          Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com