"Indirect modification of overloaded element"

Answered

Comments

3 comments

  • Andreas Haugstrup Pedersen

    Your item most likely doesn't have a value for that particular field. So you are trying to set values on something that doesn't exist in your object yet. In that case you have to create a PodioCategoryItemField and add it to the fields collection before setting the value

    0
    Comment actions Permalink
  • Jonathan Sala

    Thanks for that Andreas :). In case anyone else has this issue, the way to do this for a category field in the PHP API is:

    $item = PodioItem::get_basic($itemID);
    $newField = new PodioCategoryItemField($newFieldExternalID);
    $item->fields->offsetSet($newFieldExternalID, $newField);
    
    0
    Comment actions Permalink
  • Diego Ibanez

    Thanks a lot Jonathan. I don't really get why this use case it's not better documented anywhere. It's a mess to get the samples of the most basic operation working. It's a pain to work with the PHP API.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk