Jump to:

7937 Posts in 1537 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Front End DataObjectManager - Page Not Found

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: 350 Views
  • CHD
    Avatar
    Community Member
    218 Posts

    Front End DataObjectManager - Page Not Found Link to this post

    can anybody help with this?

    I've go a front end dataobjectmanager (or complextable - either is fine) and it lists my dataobjects fine, but when i click them or try to add a new one it just ends with "page not found"

    here's my code:

    <?php
    class Rates extends DataObject {
       public static $db = array(
          
          "PricePerNight" => "Currency",
          "dateStart" => "Date",
          "dateEnd" => "Date"
       );

       public static $has_one = array(
          "Apartment" => "Apartment"
       );
       
       public static $has_many = array(
       );
       

       
       public function getCMSFields_forPopup() {
          return new FieldSet(
             new TextField('PricePerNight'),
             new DatePickerField ('dateStart','Date of arrival'),
             new DatePickerField ('dateEnd','Date of departure')
          );
       }

    }

    *********************************************

       function RatesForm(){
       $Apartment = $this->getApartment();   
       $Manager = new ComplexTableField(
          $this,
          'Rates',
          'Rates',
          array('dateStart' => 'dateStart'),
          'getCMSFields_forPopup',
          'ApartmentID = ' . $Apartment->ID
          );
       $Manager->setParentClass('Rates');
       $Manager->setPermissions(array("show","edit", "add"));
       
       $fields = new FieldSet(
    new HiddenField('ID', ''),
    $Manager
    );

       
       return new Form($this, 'RatesForm', $fields, new FieldSet());
    }

    I'm guessing the issue is because i'm generating the form on an external page type to where the "Rates" are initially managed. so is it to do with the controllers?
    I think the problem may lie here:

    $Manager = new ComplexTableField(
          $this,

    Does the $this need to be something else?

    I have the following relationships.
    "Apartments" are dataobjects - they $has_many "Rates"
    "Rates" are dataobjects - they $has_one "Apartment"

    And im tryng to have a form that loads on my front end "edit" page with a URL like this: mysite.com/account/your-listings/rates/apartment-name

    It all shows up fine in the front end, and ONLY the rates that apply to that Apartment appear, it's just I cant click/edit/delete them.

    thanks in advance for your help!

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