-
Notifications
You must be signed in to change notification settings - Fork 119
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
Too many api calls when trying to get cards moved from a list to another #24
Comments
Hi @seblegall namespace Your\Namespace\Model;
use Trello\Model\Card as BaseCard;
use Trello\ClientInterface;
class Card extends BaseCard
{
/**
* {@inheritdoc}
*/
public function __construct(ClientInterface $client, $id = null)
{
$this->client = $client;
$this->api = $client->api($this->apiName);
$this->fields = $this->api->getFields();
if ($id) {
$this->id = $id;
// Comment the line below to avoid unnecessary api calls
// $this->refresh();
}
}
} You'd also have to extend the Manager to use your custom classes and use your own namespace Your\Namespace;
use Trello\Manager as BaseManager;
use Your\Namespace\Model\Card;
class Manager extends BaseManager
{
/**
* {@inheritdoc}
*/
public function getCard($id = null)
{
return new Card($this->client, $id);
}
} Hope that helps. |
@seblegall By the way, having a look at your blackfire profile it seems you would need to override |
@cdaguerre Yes, I will try that. Another way to improve api calls I implemented is to call the api directly. Instead of $lists = $board->getLists() I use : $lists = $this->client->api('board')->lists()->all($board->getId()); Then... new Cardlist($this->client, $list['id']); |
Hi,
Here is a use case I needed to implement for generating BurnDown Chart using Trello actions.
Here is my algorithme :
The global goal is to find all cards which have been moved from a list 1 to a list 2 during an interval of 2 dates.
Unfortunately, it seems that Trello API does not provide a web service to get all the moved card from or to a selected list.
Anyway, with your php-trello-api wrapper, it seems that the refresh method is called each time an object is instantiated... resulting an API call for each instantiation...
In my example it result 1865 API Calls...
Here is the Blackfire profile : https://blackfire.io/profiles/dff19c00-03a0-41b8-99f7-d36dcf542f3e/graph?settings%5Bdimension%5D=wt&settings%5Bdisplay%5D=landscape&settings%5BtabPane%5D=nodes&selected=&callname=main()
The text was updated successfully, but these errors were encountered: