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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

debugging why a page wont "save & publish"


Go to End
Reply


9 Posts   1086 Views

Avatar
lozhowlett

Community Member, 146 Posts

1 November 2011 at 12:15am

Hi everyone

I have built a page "property details", however it now wont save and publish and of my "properties", i just get the little ajax loading symbol over the button, but it doesnt save... how do I debug where it might be getting stuck? I already have

Director::set_environment_type("dev");

turned on. This is my code....

<?php
class PropertyDetail extends Page {

   public static $db = array(
'PropertyName' => 'Text',
'RentPerMonth' => 'Currency',
'NumberOfBeds' => 'Int',
'Location' => 'Text',
'Postcode' => 'Text',
'StreetName' => 'Text',
'Lat' => 'Text',
'Long' => 'Text'
);

   public static $has_one = array(
'SearchResultPicture' => 'Image'
   );

public static $has_many = array(
'ImageResources' => 'ImageResource'
   );

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new ImageField('SearchResultPicture'));
$fields->addFieldToTab("Root.Content.Main", new TextField('PropertyName'));
$fields->addFieldToTab("Root.Content.Main", new CurrencyField('RentPerMonth'));
$fields->addFieldToTab("Root.Content.Main", new NumericField('NumberOfBeds'));
$fields->addFieldToTab("Root.Content.Main", new TextField('Location'));
$fields->addFieldToTab("Root.Content.Main", new TextField('Postcode'));
$fields->addFieldToTab("Root.Content.Main", new TextField('StreetName'));
$fields->addFieldToTab("Root.Content.Main", new TextField('Lat'));
$fields->addFieldToTab("Root.Content.Main", new TextField('Long'));

$managerimages = new ImageDataObjectManager(
$this, // Controller
'Images', // Source name
'ImageResource', // Source class
'Attachment', // File name on DataObject
array(
'Title' => 'Title'
), // Headings
'getCMSFields_forPopup' // Detail fields
// Filter clause
// Sort clause
// Join clause
);
$fields->addFieldToTab("Root.Content.Image Gallery",$managerimages);

return $fields;
}

}
class PropertyDetail_Controller extends Page_Controller {
   public static $allowed_actions = array (
   );

   public function init() {
parent::init();
   }
}

Thanks!

Avatar
vwd

Community Member, 160 Posts

1 November 2011 at 1:50am

Hi,

Do you use an IDE for development? (Eg. I use Netbeans with XDebug enabled, and I'm able to set breakpoints in code and and step through.)

If you're able to set a breakpoints and debug, set a breakpoint on AssetAdmin::save(...) [line 686 of cms/code/AssetAdmin.php] or its parent LeftAndMain::save(...) [line 624 of cms/code/LeftAndMain.php]. Then single-step through and see what's going on.

VWD.

Avatar
lozhowlett

Community Member, 146 Posts

1 November 2011 at 1:52am

I do use netbeans, i am new to using it tho... and I dont run the site locally, its run on our live server, so I dont think this will work? If i can get it running locally then this might be doable?

Avatar
swaiba

Forum Moderator, 1799 Posts

1 November 2011 at 2:03am

yes if you run locally you can debug easily and quickly with net beans

Avatar
lozhowlett

Community Member, 146 Posts

1 November 2011 at 2:05am

what would i need to run locally.... xamp, mysql.... anything else?

Avatar
swaiba

Forum Moderator, 1799 Posts

1 November 2011 at 2:08am

depends on your system - i use wampserver (that includes evenything needed)

Avatar
lozhowlett

Community Member, 146 Posts

1 November 2011 at 2:08am

I am running windows 7 Ultimate edition... thanks

Avatar
lozhowlett

Community Member, 146 Posts

1 November 2011 at 3:02am

ok i set the site up locally and it saves perfectly! How odd?!?

Go to Top