cdaguerre/php-trello-api

Labels in card are not saved

azorgh opened this issue · 2 comments

Hi guys,

When i'm trying to create a new card, there is no problem with this. But, if I want to assign a label on this card with the addLabel method, it seems doesn't work.

For example :

$card = new Card();
$card->setName('Name');
$card->setDescription('Description');

$card->addLabel('green');//-> $this->data['labels'] doesn't exists, a error was thrown
// OR
$card->setLabels([['colors' => 'green']]); //->Array has been taken from addLabel function

$card->save();

If we debug the body of the request send on save, we have this (with the addLabel and the fix for $data['labels'] not exists) :

array (
  'idBoard' => 'xxxxxxxxxxxx',
  'idList' => 'xxxxxxxxx',
  'name' => 'Name',
  'desc' => 'Description',
  'due' => NULL,
  'urlSource' => NULL,
  'labels/0' => 'green',
)  

I think the body is not good according to Trello API right ?

Thanks !

Same problem here.

Accordingly to https://developers.trello.com/advanced-reference/card#post-1-cards
the labels related to a card have to be specified by providing a comma-separated list of idLabels.

PS: thanks for the amazing work you did 👍

what status about this issue, I see the PR's not merged yet.