Skip to content

Creating a new TrackingOption on an existing TrackingCategory #920

Open
@rushork

Description

@rushork

Hi,

I'm trying to create tracking options and add them to an existing tracking category (that has tracking options) like this:

     $option = new TrackingCategory\TrackingOption();
     $option->setName($name);
     $tracking->addOption($option);
     $tracking->save();

Each time I do so, apart from adding the FIRST tracking option to a tracking category, I get the following exception:

A validation exception occurred (For each specified tracking option the name must be unique)
Validation errors:
For each specified tracking option the name must be unique.

The value of $name does not exist in the tracking category before this, but it still says it must be unique?

It only happens when I try to add a new one. I also notice that it does actually create the tracking option, but the error means that when I try adding the tracking variable to a line item and save it for an invoice - it does not save the line item as there has been an error.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions