ezstarrating: creating contentobject with ezstarrating attribute via PHP

Author Message

Benjamin Kroll

Wednesday 22 December 2010 11:05:29 am

Hi everyone,
I'm curious to find out if someone has created a contentobject with an ezstarrating attribute from PHP before. I've been looking through the forums as well as the ezstarrating extension classes for a little bit now, but wanted to make sure I'm not reinventing the wheel here.
I'm going the usual route of:
- create object (return new object)
- update via $data_map[ $key ]->fromString( $value );
- store via $data_map[ $key ]->store();
- execute content publish
I've tried simply passing in an integer of the star rating (0-5) as well as a few other combinations, but so far, no dice.
If anyone has done this before or has a hunch as to what kind of format in need to pass this in with I'd much appreciate a quick reply.
Thanks,
Ben

Carlos Revillo

Wednesday 22 December 2010 1:08:17 pm

Thing here is ezstarrating datatype has no fromString method yet. can be a enchancement...

Benjamin Kroll

Wednesday 22 December 2010 2:59:16 pm

Thanks for the reply Carlos I didn't see that (obviously didn't look very closely either). Are you aware of any plans for this to be added to the extension in the future?

Marco Rogers

Wednesday 22 December 2010 6:22:38 pm

Benjamin, check out the rating is saved in the ajax function when you click the stars. You can use this method.

https://github.com/ezsystems/ezstarrating/blob/master/packages/ezstarrating_extension/ezextension/ezstarrating/classes/ezsrserverfunctions.php#L75

Benjamin Kroll

Thursday 23 December 2010 12:30:28 pm

I was thinking of using that but was hoping to be able to do it the ez standard way.
Should be the same outcome so that's fine.
Appreciate the feedback.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.