Release 0.4.2 is now available of the Harvest API PHP Wrapper Library hot on the heals of the 0.4.1 release. In this Bug Fix we resolved an unrelated issue with parsing of User and Project entries obtained by the getUserEntries and getProjectEntries methods. The underlying error was caused from the time tracking api using _ as their name delimiter while the extended api uses -. As a quick fix the parser method has been added with the day-entry case to match both instances.
A full fix for this inconsistency is in the works as part of the 1.0 release, where a converter will be introduced to properly manage the _ and – characters so that the end user (you) will not have to worry about these little quirks in the Harvest API.
To stay up-to-date with all the recent changes please visit the main HarvestAPI release page.
Than you Matthew,
sorry but my question wasn’t clear.
I can use getter and setter method for Entry object, but how i traverse the data structure?
It is an associative array containing objects i suppose so how to cycle through the data and extract the values:
Pseudo code:
for each element in the array
go to the object and extract hours, project etc..
My problem is that i don’t understand how to loop this kind of data structure, retrieve the single objects and finally use the getter method!
Thank you very much
PS: if you prefer we can continue by email without adding too much comments in your blog!
At work, I can’t access my outside email accounts. To put things simply the Wrapper Library either returns an object, or an array if multiple objects are returned like in the getUserEntries method call.(Or in the case of create methods it returns the id of the created object) To iterate over the results you can use a standard foreach loop:
Don’t worry about adding to many comments to the blog, The Q&As could provide help to other individuals.
Hi Matthew,
it seems that everything is ok.
A dumb question, sorry but my php is quite rusty!!
I receive back this kind of data strucuture
Array ( [22037537] => Harvest_DayEntry Object (
[_root:protected] => request [_values:protected] => Array (
[adjustment-record] => false
[created-at] => 2010-03-21T10:13:17Z
[hours] => 8.0
[id] => 22037537
[is-billed] => false
[is-closed] => true
[notes] =>
[project-id] => 587743
[spent-at] => 2010-03-01
[task-id] => 463360
[timer-started-at] =>
[updated-at] => 2010-04-01T13:51:27Z
[user-id] => 106928
)
)
If i want to extract some of the properties of Day Entry Object (hours, project_id, spent_at) which is the right way to do it?
Thank you very much!!
Not a dumb question at all, currently it is a little abstract. To get a value you would use the get method.
If you find yourself using the api to create new projects, clients, etc then you will want to use the set method to set property values.
Hope this helps you out and let me know if there is anything else you need help with.