bryan bryan - 3 months ago 9
PHP Question

Accessing specific part of object

I have an object I am trying to access and this is the

var_dump()


object(GDS\Entity)#16 (5)
{
["str_kind":"GDS\Entity":private]=>
string(13) "User Sessions" ["str_key_id":"GDS\Entity":private]=>
string(16) "5649391675244544" ["str_key_name":"GDS\Entity":private]=>
NULL ["mix_ancestry":"GDS\Entity":private]=>
NULL ["arr_data":"GDS\Entity":private]=>
array(1) {
["session_id"]=> string(3) "123"
}
}


I know if I wanted to get the
session_id
and this object was stored in
$object
I would just do
$object->session_id


But I am trying to get the
str_key_id (5649391675244544)
but I can't figure out how to access it.

Could anyone help me figure it out?

Tom Tom
Answer

It's as simple as

$object->getKeyId();

(Think you've already picked this up on GitHub ;)

Tom