zendesk / zendesk_api_client_php

Official Zendesk API v2 client library for PHP
336 stars 259 forks source link

Locale set in setLocale is only evaluated if the route is not defined #373

Closed samgavinio closed 4 months ago

samgavinio commented 6 years ago

The Locale::setLocale and Locale::getRoute methods are supposed to be able to set the locale for HelpCenter API calls, however

This results in setLocale() only really being usable if the route is not explicitly defined in a setRoutes call.

Not only does setLocale have this limit in it's usability, but it also has a pretty hard to follow logic of having to rely on an exception to be thrown for it do what it's supposed to do.

How to reproduce:

$section = $client->helpCenter->categories($categoryId)->sections()->setLocale('fil')->create([
        'name' => 'A section in the locale FIL',
        'description' => 'A section in the locale FIL',
])

What is expected

This should make a call to

POST /api/v2/help_center/fil/categories/{$categoryId}/sections.json

What is the actual result

It instead ignores the locale and makes the call to

POST /api/v2/help_center/categories/{$categoryId}/sections.json
ecoologic commented 5 months ago

Hi,

thank you for your request, are you still interested in a solution for this issue?

ecoologic commented 4 months ago

Closing due to inactivity. Re-open if needed.