Jump to content
  • 0

How To Get All Service Includes Active,pending,suspended And Canceled In Once Query


ty0716

Question

I want to get all services list in once sql query.

 

and i see the docs in http://source-docs.blesta.com/class-Services.html

getList( integer $client_id = null, string $status = "active", integer $page = 1, array $order_by = array('date_added'=>"DESC"), boolean $children = true )

 

 

 

whether this only can query a status in a function use? $status = "active".  

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Services::getList is paginated, so you will only receive a max of 20 results by default. Also, additional queries are made automatically for more service information (e.g. package pricing) for each service found. If that's fine for you, then set the status to "all" as naja7host suggested.

 

There is no direct method to fetch every service in a single query. If you really need all services in one method call, you might try Services::getAllChildren by passing in a null $parent_service_id. But of course, that would retrieve all parent services and no addon services. It would also be slow for large numbers of services.

Link to comment
Share on other sites

  • 0

Services::getList is paginated, so you will only receive a max of 20 results by default. Also, additional queries are made automatically for more service information (e.g. package pricing) for each service found. If that's fine for you, then set the status to "all" as naja7host suggested.

 

There is no direct method to fetch every service in a single query. If you really need all services in one method call, you might try Services::getAllChildren by passing in a null $parent_service_id. But of course, that would retrieve all parent services and no addon services. It would also be slow for large numbers of services.

 

getAllChildren() not for all services without client_id filtered .

 

the getServices() is the best fucntion , but is pain that is a private . i suggest to return it as public , because it will help in more cases . and the other public function are limited in result (20 max) .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...