ORM examples not working as described
-
Due to ongoing import problems (separate issue) I am forced to fix up events in large batches. The ORM documentation at
https://docs.theeventscalendar.com/apis/orm/basics/
has some basic code examples for tasks like this that look promising.
However, this does not work as expected when it comes to modifying events. See the following example , the most basic thing I can think of – modifying ONE field of ONE event ( simple non-recurring event )
#checking out and changing the title of a tec event , # using provisional and real ID #wp shell wp> tribe_events()->where( 'id',31444)->pluck('category'); => array(1) { [0]=> string(0) "" } # note this result is wrong, as the event has a category assigned # now checking the titles: wp> tribe_events()->where( 'id',31444)->pluck('post_title'); => array(1) { [0]=> string(17) "Fat Freddy's Drop" } wp> tribe_events()->where( 'id',10001111)->pluck('post_title'); => array(1) { [0]=> string(17) "Fat Freddy's Drop" } # Updating the titles: wp> $updated = tribe_events()->where( 'id', 10001111)->set( 'title', 'YYY FAT FREDDY' )->save(); => array(1) { [10001111]=> bool(true) } wp> $updated = tribe_events()->where( 'id', 31444)->set( 'title', 'YYY FAT FREDDY' )->save(); => array(1) { [10001111]=> bool(true) } wp> $updated = tribe_events()->where( 'id', 9999999)->set( 'title', 'YYY FAT FREDDY' )->save(); => array(0) { } # ok - using a nonexistant ID has an empty result, using the existing IDs has a true result. # now check the changed events for the new title wp> tribe_events()->where( 'id',10001111)->pluck('post_title'); => array(1) { [0]=> string(17) "Fat Freddy's Drop" } wp> tribe_events()->where( 'id',31444)->pluck('post_title'); => array(1) { [0]=> string(17) "Fat Freddy's Drop" } # bummer ... nothing changed.
Is the documentation up-to-date? What else could be the cause for this simple example to fail? I am posting it here since I assumed this is a function of the free plugin version. If not, let me know and I will create a pro version support ticket.
Regards
Uli
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.