Jump to:

23456 Posts in 18905 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Job Portal from book not working in SS 3.0.3

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

Page: 1
Go to End
Author Topic: 508 Views
  • mivilleb
    Avatar
    Community Member
    3 Posts

    Job Portal from book not working in SS 3.0.3 Link to this post

    I am using SS 3.0.3 on Ubuntu with Apache2 and Php 5.3

    I only copied the Job php files from the Wiley site:

    http://au.wiley.com/WileyCDA/WileyTitle/productCd-0470681837,descCd-DOWNLOAD.html

    Job.php
    JobCategory.php
    JobCategoryHolder.php

    to:

    mysite/code

    and the ss files to:

    JobCategory.ss
    JobCategoryHolder.ss
    JobCategory_showjob.ss

    themes/simple/templates/Layout

    Then ran the dev/build

    index.php/dev/build

    and it worked without any errors, created the tables etc.

    I created a main Job page and assign it a "Job Category Overview" type and that worked.

    I created 2 pages under the Job page and tried assigning them with the "Job Category" type but it just returns a blank page after I click on Save and Publish. From that point on, non of the Admin menu works and all returning blank page. If I refresh the admin page everything returns to normal but the sub pages have not been assigned the new type.

    No errors in the Apache2 logs.

    Any idea what is going on?

  • mivilleb
    Avatar
    Community Member
    3 Posts

    Re: Job Portal from book not working in SS 3.0.3 Link to this post

    I re-installed SS3, just in case it was screwed up, took the Job files from the book, modified them to fit my needs and the error I get is the following:

    Error at line 1043 of SS3/framework/model/DataObject.php

    after I do a dev/build (no errors) and try to assign a new type to a page.

    Attached are the 3 php files I am using (had to rename to .txt for the upload to work).

    Any idea?

    Attached Files
  • mivilleb
    Avatar
    Community Member
    3 Posts

    Re: Job Portal from book not working in SS 3.0.3 Link to this post

    Doing the 3.0 tutorial here:

    http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management

    I get the same error as above:

    Error at line 1043 of SS3/framework/model/DataObject.php

    when I try to assign a Project type to a page.

    Is there a bug in SS3 or am I doing it wrong?

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: Job Portal from book not working in SS 3.0.3 Link to this post

    There is a lot of legacy code in that if you're working in 3. Try updating the reuests and replacing the ComplexTable field with a GridField to start. Also put the site into devmode to get better error reporting. I suspect in the backend the ComplexTable field ma be a problem but ActiveTenders function should be updated to a SS3 compatible query. Now I'm not sure if you can query for nulls and functions with a raw SQL where() in SS3 but you could request the whoel DataList and filter it like

    public function ActiveTenders() {
       $ActiveTenders = new ArrayList();
       foreach($this->Tenders() as $tender) {
          if(is_null($tender->ExpiryDate) || strtotime($tender->ExpiryDate) > time()) {
             $ActiveTenders->push($tender);
          }
       }
       return $ActiveTenders;
    }

    I find some simple operations more complex with the new ORM, but the flexabilty and chainability is worth it.
    http://doc.silverstripe.org/framework/en/topics/datamodel

    As for the GridField

    $tenderManagerConfig = GridFieldConfig_RelationEditor::create();
    $tenderManagerConfig->addComponents(
       new GridFieldDetailForm('Tender')
    );
    $tenderManager = new GridField(
       "Tenders", "Tenders",
       $this->Tenders(),
       $tenderManagerConfig
    );
    $fields->addFieldToTab('Root.Main', $tenderManager);

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