We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10313
    • 375 Posts
    Hello!

    I have just updated an older Website from 0.9.6 to 1.0.0. I have some own snippets, one of wich makes use of the modx->getDocumentObject.

    In the former version, I received the document and all the TV values for that document.

    Now, in 1.0.0, all TV values are set to their default values, when I use that method.

    The call is
    $seite = $modx->getDocumentObject("id", $qfResult);

    where [tt]$qfResult[/tt] holds one ID. This worked very fine until yesterday (with 0.9.6). If I [tt]var_dump($seite)[/tt] now, I can see that all TV values are the default values. In the manager, all TV values are correct.

    What can this be?

    Thanks
    Martin
      • 10313
      • 375 Posts
      Sorry, my fault. I had forgotten that I changed the document.parser.class.php. In one line, it uses this->documentIdentifier instead of the given parameter $identifier:

      changed
      954 $sql .= "LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '" . $this->documentIdentifier . "' ";
      

      to
      954 $sql .= "LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '" . $identifier . "' ";
      


      Martin
      • getDocumentObject is an internal method of the DocumentParser class; it is not an API function intended to be called from components and it changes the behavior of the parser if you do call it. This function is also deprecated in Revolution 2.0.0, to be removed shortly thereafter, FYI.
          • 10313
          • 375 Posts
          Thanks, good to know. I coded my snippet a year or more ago. Today, I would do it in a different way, because I have learnt much concerning MODx. For now, it "must" suffice, a recode would not be payed by the customer wink