Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » works fine for days and suddenly there's an error -.-

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: 524 Views
  • benni91
    Avatar
    Community Member
    72 Posts

    works fine for days and suddenly there's an error -.- Link to this post

    Hi @ all

    i don't know why but suddenly (no changes where made) one of my page types / dataobjects crashed and now i always get an server error -.-

    it works fine 30 minutes ago and suddenly it crashed :/

    This is the code from the object

    <?php
    class OpinionObject extends DataObject {

       public static $db = array(
          'Project' => 'Text',      //Project Name
          'Headline' => 'Text',
          'Opinion' => 'HTMLText',
          'PLink' => 'Text'         //Project Link
       );

       public static $has_one = array(
          'OpinionPage' => 'OpinionPage',
          'Client' => 'ClientObject'
       );

       public static $has_many = array(
          'Clients' => 'ClientObject'
       );

       public function getCMSFields_forPopup() {
          $map = array();
          if($set = DataObject::get("ClientObject")) {
             $map = $set->toDropdownMap('ID','Name');
          }
          return new FieldSet(
          new TextField('Headline', 'Überschrift der Kundenmeinung'),
              new TextField('Project', 'Name des Projekts'),
             new SimpleTSimpleTinyMCEField('Opinion', 'Kundenmeinung'),
             new TextField('PLink', 'Link zum Projekt'),
             new DropdownField('ClientID', 'Client', $map)
          );
        }
       
    }
    ?>

    and from the page

    <?php
    class OpinionPage extends Page {

       public static $db = array(
          'TitleO' => 'Text'
       );

       public static $has_many = array(
          'Opinions' => 'OpinionObject',
       );
       
       function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->removeFieldFromTab('Root.Content.Main', 'Content');
          $fields->addFieldToTab('Root.Content.Opinions', new TextField('TitleO', 'Überschrift'));
          $fields->addFieldToTab('Root.Content.Opinions', new DataObjectManager($this, 'Opinions', 'OpinionObject', array('Headline' => 'Überschrift', 'Project' => 'Projekt', 'Plink' => 'Link zum Projekt'), 'getCMSFields_forPopup'));
          return $fields;
       }

    }
    class OpinionPage_Controller extends Page_Controller {

    }

    can someone tell me why it doesn't work

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: works fine for days and suddenly there's an error -.- Link to this post

    Is that a server error as in it's giving you an error code 500?
    In that case it's probably nothing wrong with your php code but something else on the server is acting up.

    If you're getting the SilverStripe message "There has been an error" then please put Director::set_environment_type("dev"); in your _config.php and report back what it says.

  • benni91
    Avatar
    Community Member
    72 Posts

    Re: works fine for days and suddenly there's an error -.- Link to this post

    i put it into the _config.php an now? i don't know hat to do

    theres just a blank popup if i try to access or create a page with this page type

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: works fine for days and suddenly there's an error -.- Link to this post

    I'm sorry, the way you wrote your first post it sounded as if you weren't getting in to your site at all, not just having problems creating a certain page type in the admin. Anyways the error is most likely SimpleTSimpleTinyMCEField. As far as I know there's no class with that name and the name should just be SimpleTinyMCEField. The line is in the FieldSet you're returning from OpinionObject.

    If you're having these kinds of problems in the admin then use firebug or another debugger so you can see the AJAX requests. Then you can read about the error there.

  • benni91
    Avatar
    Community Member
    72 Posts

    Re: works fine for days and suddenly there's an error -.- Link to this post

    damn it it was just a typing mistake this stupid little mistakes drove me crazy
    Thx

    Perhapse you can help me here http://www.silverstripe.org/dataobjectmanager-module-forum/show/13369 and here http://www.silverstripe.org/template-questions/show/17899 too

    524 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.