Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'PdfFile'

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1496 Views
  • escaped
    Avatar
    Community Member
    6 Posts

    Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'PdfFile' Link to this post

    Hello,

    I want to use the FileDataObjectManager with a Special Filetype, cause i need some additional functions for the uploaded pdf file.

    my DataObject (ResourceFile.php):

    class ResourceFile extends DataObject {
       static $db = array (
          'Name' => 'Text',
          'Description' => 'Text',
       );
       
       static $has_one = array (
          'pdf' => 'PdfFile',
          'DocumentsPage' => 'DocumentsPage'
       );
       
       public function getCMSFields_forPopup() {
          $pdfFile = new FileIFrameField('pdf');
          $pdfFile->setAllowedExtensions(array('pdf'));
          
          return new FieldSet(
             new TextField('Name'),
             new TextareaField('Description'),
             $pdfFile,
          );
       }
    }

    DocumentsPage.php:

    class DocumentsPage extends Page {

       static $has_many = array(
          'Documents' => 'ResourceFile'
       );
       
       public function getCMSFields() {
          $f = parent::getCMSFields();
          $manager = new FileDataObjectManager(
             $this, // Controller
             'Documentss', // Source name
             'ResourceFile', // Source class
             'pdf', // File name on DataObject
             array(
                'Name' => 'Name',
                'Description' => 'Description',
             ), // Headings
             'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
             // Filter clause
             // Sort clause
             // Join clause
          );
    $manager->setBrowseButtonText("Upload (pdf only)");
    $manager->setAllowedFileTypes(array('pdf'));
                      
          $f->addFieldToTab("Root.Content.Documents",$manager);

          return $f;
       }
    }

    class DocumentsPage_Controller extends Page_Controller {
    }

    Even if i use the following PdfFile.php, i get this error, wenn i try to import a PDF (from Upload folder) in Backend:

    class PdfFile extends File {
       function BackLinkTracking() {
          return false;
       }
    }

    I have no idea what is wrong. Hopefully someone can help me.

    Thanks

    escaped

  • escaped
    Avatar
    Community Member
    6 Posts

    Re: Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'PdfFile' Link to this post

    Using ss 2.3.3 and latest version of DataObjectsManager. (r324).

  • UncleCheese
    Avatar
    4085 Posts

    Re: Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'PdfFile' Link to this post

    You have a typo here:

    'Documentss', // Source name

  • UncleCheese
    Avatar
    4085 Posts

    Re: Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'PdfFile' Link to this post

    This is weird. The bug was resolved a while back here:

    http://www.silverstripe.org/dataobjectmanager-module-forum/show/269282?start=24

    But I think some revisions to the way imports are handled undid that change. Please change line 534 of FileDataObjectManager.php to:

                if($this->fileClassName != "File" && $file->ClassName != $this->fileClassName) {
                   $file = $file->newClassInstance($this->fileClassName);
                   $file->write();
                }

    And let me know if that solves your problem. If it does, I'll check in the change. Thanks.

  • escaped
    Avatar
    Community Member
    6 Posts
  • UncleCheese
    Avatar
    4085 Posts
    1496 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.