Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Bug in SQLQuery::lastRow()?

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

Page: 1
Go to End
Author Topic: 348 Views
  • juergr
    Avatar
    Community Member
    17 Posts

    Bug in SQLQuery::lastRow()? Link to this post

    Im working on a project and try to get the last element of a DataList:

    $object->Childeren()->last();

    If the list is empty, I get the following error:


    [User Error] Uncaught InvalidArgumentException: SQLQuery::setLimit() only takes positive values

    I have attached an image with the full output.

    Is it possible that this is a bug or do I realy have to check if the list is empty before i call last()?

    Attached Files
  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Bug in SQLQuery::lastRow()? Link to this post

    Might be good to write up a test case and submit a fix.

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