usergrid/usergrid — pull request #132 by timwillsie (2014-04-30 14:51:58+00:00)
Title: FIX: notices and errors in get_connections()

Hey there.

Now that I found the time to test the method "get_connections" (see https://github.com/usergrid/usergrid/pull/130) I found some other bugs in it:

The method get_connections() tries to determine the count of connected entities in a faulty way.
This raises an "undefined property" notice.
Once this is line of code is fixed one gets the following error:

"PHP Fatal error: Cannot use object of type Entity as array in ..."

This is caused by the following code:
"$this[$connection][$result['entities'][$i]['username']] = $result['entities'][$i];"

Introduced a temporary variable "$tmp_entity" in the for loop for more readability.

Greets, Tim.

I am contributing code under the terms of the Apache Software License.