[PHP] How to retrieve all data objects of class?

Hi, i’m using Backendless for php, and i would like to retrieve all data objects of all rows with ‘name’ and ‘address’ values.
My code:

<?php require "../backendless/autoload.php"; use backendless\Backendless; use backendless\model\BackendlessUser; use backendless\model\BackendlessDataQuery; use backendless\services\persistence; Backendless::initApp('id', 'xx', 'v1'); $result_collection = Backendless::$Data->of( 'report')->find( $uery_or_relation_depth = null ); echo "name: "+$result_collection->name?;echo "address: "+$result_collection->address?; ?>

thanks
regards
T

Hi Tuxxo,

Please, carefully read our documentation.
There are useful examples of advanced object retrieval.
You should note the number of objects retrieved is limited by pageSize query parameter.
The default its value is 10 and the maximum possible to set is 100. This restriction is made to prevent possible issues with memory or traffic.

If you need to get ALL the objects you should retrieve them page by page in a loop using loadNextPage method of the result collection.

Regards Ilya

Hi ilya, i read the documentation but i don’t understand extract value into array object backendless.

Documentation:

Backendless::initApp(‘YOUR-REST-SECRET-KEY’, ‘YOUR-APPLICATION-ID’, ‘v1’);

$description = Backendless::Persistence->describe( “Person” );

how to foreach parse value name person?

I don’t see nothing example…

how to set limit query?, pagination?..

sorry, but i’m not very expert in php.

where i find a working example to try?–

thanks

T.

in javascript:

var PAGESIZE = 80;
						var dataQuery = new Backendless.DataQuery();
						Backendless.initApp(APPLICATION_ID, SECRET_KEY, VERSION);
						dataQuery.options = {
    					pageSize:PAGESIZE
						};
						function report( args )
						{ 
						  args = args || {}; 
						  this.cmdB = args.cmdB || ""; 
						  this.ackB = args.ackB || ""; 
						  this.dataB = args.dataB || ""; 
						}


						var contactsCollection = Backendless.Persistence.of( report ).find().data;
						
						var test = Backendless.Persistence.of(report).find(dataQuery);
						console.log(test.data.length); 
						 datatest =test.data.length;

for example retrieval cmdB from report : console.log(contactsCollection.data[1].cmdB);

Hi Tuxxo,
Sorry, but our Support Policy doesn’t cover such kind of questions.
If your knowledge in js is better then in PHP, maybe you should choose NodeJS.
Regards, Ilya

mmm…ok…

It seems a fairly obvious question in order to use Backendless .

thank you anyway.

T.

in this case i need the php, missing one easy step in documentation.

sorry Ilya,
To improve performance What Can I Buy ?

R.

Hi Tuxxo,

I don’t understand your previous comment but if you are wondering in purchasing support here is all information
Regards, Ilya

I downloaded the documents in php but for Rest api .
I have not found how to set the pagination limit to 10 .

Before buying additional services I would like to prove the validity of your sdk .

Pagination limit is 10 by default.
You quite right that the documentation of the PHP SDK does not cover all cases.
Here is a little example of code. I hope it will help you.

$query = new BackendlessDataQuery();
$query->setPageSize(50);
$query->setWhereClause(&lt;your criteria of query&gt;);  


$result_collection = Backendless::$Persistence->of(  'report' )->find( $query );


...
$result_collection.loadNextPage();
...

Regards Ilya

I tried to instantiate a query object , but I get error 500

require “…/backendless/autoload.php”;

use backendless\Backendless;
//use backendless\model\BackendlessUser;
use backendless\model\Data;
use backendless\model\BackendlessDataQuery;
use backendless\services\persistence;

$query = new BackendlessDataQuery();
$query->setPageSize(50);
$query->setWhereClause(“name = ‘cmdB’”);
$result_collection = Backendless::$Persistence->of( ‘report’ )->find( $query );

print_r($result_collection);