{"action":"closed","issue":{"url":"https://api.github.com/repos/joomla-projects/webservices/issues/14","repository_url":"https://api.github.com/repos/joomla-projects/webservices","labels_url":"https://api.github.com/repos/joomla-projects/webservices/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/joomla-projects/webservices/issues/14/comments","events_url":"https://api.github.com/repos/joomla-projects/webservices/issues/14/events","html_url":"https://github.com/joomla-projects/webservices/issues/14","id":88149433,"number":14,"title":"JApiHalTransformXxxx::toExternal is being called twice for each field","user":{"login":"chrisdavenport","id":305153,"avatar_url":"https://avatars.githubusercontent.com/u/305153?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdavenport","html_url":"https://github.com/chrisdavenport","followers_url":"https://api.github.com/users/chrisdavenport/followers","following_url":"https://api.github.com/users/chrisdavenport/following{/other_user}","gists_url":"https://api.github.com/users/chrisdavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdavenport/subscriptions","organizations_url":"https://api.github.com/users/chrisdavenport/orgs","repos_url":"https://api.github.com/users/chrisdavenport/repos","events_url":"https://api.github.com/users/chrisdavenport/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdavenport/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla-projects/webservices/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-14T08:49:37Z","updated_at":"2016-03-12T22:24:17Z","closed_at":"2016-03-12T22:24:17Z","body":"The toExternal transform is being called twice for each field.  This doesn't give the correct result for some transforms such as JApiHalTransformState which transforms from a number to a non-numeric string.\r\n\r\nTest 1:\r\nin JApiHalTransformString change\r\n\r\n    return (string) $definition;\r\n\r\nto\r\n\r\n    return '[' . (string) $definition . ']';\r\n\r\nthen observe that the strings in the output are surrounded by '[[' and ']]' instead of just '[' and ']'.\r\n\r\nTest 2:\r\nIn site.contact.1.0.0.xml change the resource transform for 'published' from 'int' to 'state'.  For a published contact item the expected output would be 'published', but you actually get 'unpublished'.  In fact you get 'unpublished' regardless of the published state of the contact.  What happens is that the first time it is called with a value of '1', it correctly transforms to 'published', but then it gets called again and 'published' gets transformed to 'unpublished'.\r\n"}}