Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access nested Properties? #58

Open
nafwa03 opened this issue Jul 26, 2020 · 1 comment
Open

How to access nested Properties? #58

nafwa03 opened this issue Jul 26, 2020 · 1 comment

Comments

@nafwa03
Copy link

nafwa03 commented Jul 26, 2020

I can get to the entities no problem but what I am unable to figure out is to access properties from a created entity set. The Odata provider is sharefile. For example, my selects for this are not working:

$yada->select('Id,Name,CreatorNameShort,Info,Info/IsAHomeFolder,Children/Id,Children/Name,Children/CreationDate,Children/FileSizeBytes,Children/CreatorNameShort,Children/FileCount');

This has a root folder structure followed by the child folders. This would be root where users see folders, etc..

Access to a folder directly is same minus a has specified for the specific item.

What I am trying to achieve, if it is possible with this, is to create an entity collection like..

$my_collection I create.
then
$my_collection2->from($my_collection)
etc

I am unable to retrieve the properties as if I was using direct php property_exists...

Is this supported?

@nafwa03
Copy link
Author

nafwa03 commented Jul 26, 2020

I was able to solve it partly by removing the 'Items' from the baseurl. Great documentation ;(. Now it is working correctly if I use it in the from as
$my_entity->from('Items')->expand('Children)'

I am still trying to figure out how to access the properties to do my own parsing. From what I have do I need to create a new STDClass for each entity and then access them that way or how can I get access if its even possible at current code state?

object(SaintSystems\OData\Entity)#374 (16) {
["primaryKey":protected]=>
string(2) "id"
["perPage":protected]=>
int(25)
["properties":protected]=>
array(2) {
["Children"]=>
array(2) {
[0]=>
array(6) {
["FileCount"]=>
int(0)
["CreationDate"]=>
string(23) "2020-01-29T15:53:57.14Z"
["FileSizeBytes"]=>
int(0)
["CreatorNameShort"]=>
string(11) "ME"
["odata.metadata"]=>
string(88) "https://domain.sf-api.com/sf/v3/$metadata#Items/ShareFile.Api.Models.Folder@Element"
["Id"]=>
string(36) "fbf80yuyuyd8"
}
[1]=>
array(6) {
["FileCount"]=>
int(0)
["CreationDate"]=>
string(24) "2020-01-28T18:55:02.787Z"
["FileSizeBytes"]=>
int(0)
["CreatorNameShort"]=>
string(11) "YOU"
["odata.metadata"]=>
string(88) "https://domain.sf-api.com/sf/v3/$metadata#Items/ShareFile.Api.Models.Folder@Element"
["Id"]=>
string(36) "fbwewef80yuyuyd8"
}``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant