Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

works fine for days and suddenly there's an error -.-


Reply


5 Posts   650 Views

Avatar
benni91

Community Member, 72 Posts

29 August 2011 at 5:38am

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 :(

Avatar
MarcusDalgren

Community Member, 288 Posts

29 August 2011 at 5:48am

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.

Avatar
benni91

Community Member, 72 Posts

29 August 2011 at 6:21am

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

Avatar
MarcusDalgren

Community Member, 288 Posts

29 August 2011 at 6:51am

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.

Avatar
benni91

Community Member, 72 Posts

29 August 2011 at 7:19am

Edited: 29/08/2011 7:22am

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

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