Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » LimitWordCount / FirstParagraph, Etc. (How to convert SQL result to Object?)

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1227 Views
  • Garrett
    Avatar
    Community Member
    245 Posts

    LimitWordCount / FirstParagraph, Etc. (How to convert SQL result to Object?) Link to this post

    LimitWordCount / FirstParagraph, Etc. (How to convert SQL result to Object?)

    Hi,

    I am getting the results of a custom search query (on Blog Entries only). I am getting the $Content field from SiteTree and am unable to use either LimitWordCount or FirstParagraph on it. The error is: "Trying to get property of non-object". How can I "convert" this to an object so that I can use these methods?

    My results are being returned as follows:

    $results->push(new ArrayData(array(
    "Title" => $Title,
    "Content" => $Content->FirstParagraph, ??????????
    "URLSegment" => $URLSegment,
    "Date" => date('F d, Y', strtotime($Date)),
    "Author" => $Author,
    "Tags" => $Tags
    )));

    A little help? have run into this issue numerous times and have never solved it.

    Thanks,
    Garrett

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