Undefined index id redbeanphp 5.0.12 beta

25 views
Skip to first unread message

amidamaru rookie

unread,
Oct 30, 2017, 6:02:35 AM10/30/17
to redbeanphp

Hi Guys,
I'm interested in redbean recently and try to learn how to apply it into my project.

I have 3 questions:

  1. I have a snippet below, I used findCollection() method, then use the loop next() to go through every item.
    As I can see, the item is a bean. How can i retrieve the value from item?
    At the moment, i use export() method. I just thought I can access it via pointer operator like a object or am i missing any special things
$oCollection = R::findCollection('Document', 'Type = ? LIMIT ? OFFSET ?', [$strDocType, $limit, $i]);
                while ($item = $oCollection->next()) {
                    $arrItem = $item->export();
                    $strUID = $arrItem['UserID'];
}

Then i will use $strUID to update for the list of records on another table.

  1. When i use the count() method, why is my table converted into the lower-case first letter with the underscore in the front of the table name? It cannot recognize my table and then return 0.

Can you please show me the right way to do it? Because my tables are the upper-case first letter as above.

  1. When i use findCollection() method or any find() method, i always get the warning undefined index 'id'. Then i read the source code and i thought Redbean use default primary key is id.

I think it must have a method or sth to set the right ID. Because my fields (columns) are also the uppercase first letter.


Can anyone please help me clear those?


Thank you,

Thao.

Reply all
Reply to author
Forward
0 new messages