Support

Home Forums Event Espresso Premium Setting the Question Group for an Event/Registering at one time

Setting the Question Group for an Event/Registering at one time

Posted: September 9, 2016 at 9:23 am

Viewing 5 reply threads


Chris

September 9, 2016 at 9:23 am

I am having difficulty associating an existing Question Group with a generated event.

Here’s my current process.

// Grab the formerly created event
$event = EE_Event::new_instance_from_db(array('EVT_ID' => $post_id));

// Grab the question group
$question_group = EE_Question_Group::new_instance_from_db(array('QSG_name' => 'Campus Tour Questions'));

// When I try the line below I get the following error " 'The incoming value // being prepared for setting in the database must either be empty or a php // DateTime object'"
$event->_add_relation_to($question_group, 'Question_Group');

// This line runs but to no avail
$question_group->_add_relation_to($event, 'Question_Group');

In the database schema given here I see that a through model exists. However, when I associated the ticket to the datetime it said a through model was needed, but only worked with direct association.

Can someone clarify what code is needed to associate the question group to the event?

</hr>

Side Note:

Where is the “max registration at one time” set and how can I set it?
I believed it was set on the tickets with TKT_max , but I’ve found that belief to be incorrect.

Thank You


Chris

September 12, 2016 at 8:41 am

Also, it may be helpful to know that the event seems to be correct in other aspects. Meaning the DateTime and Ticket associations are set correctly. (If that is related)


Josh

  • Support Staff

September 12, 2016 at 1:37 pm

However, when I associated the ticket to the datetime it said a through model was needed, but only worked with direct association.

Can you post the exact error message that was thrown?

Where is the “max registration at one time” set and how can I set it?
I believed it was set on the tickets with TKT_max , but I’ve found that belief to be incorrect.

This value is stored in _esp_event_meta.EVT_additional_limit and the default value of 10 is set in /core/db_models/EEM_Event.model.php. I can suggest adding a filter hook to allow changing that value, then submit a pull request on our Github project:

https://github.com/eventespresso/event-espresso-core/


Chris

September 12, 2016 at 2:12 pm

Great, that’s all I need for the additional_limit. I just used the set_additional_limit helper and it seemed to do the trick.

To the Question Group Problem:

When I try the line below
$event->_add_relation_to($question_group, 'Question_Group');

I get this error
Fatal error: Uncaught exception 'EE_Error' with message 'The incoming value being prepared for setting in the database must either be empty or a php DateTime object' in /wp-content/plugins/event-espresso-core-reg/core/db_models/fields/EE_Datetime_Field.php:486

Stack Trace:
#0 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2552): EE_Datetime_Field->prepare_for_use_in_db(1473710909) #1 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2532): EEM_Base->_prepare_value_for_use_in_db(1473710909, Object(EE_Datetime_Field)) #2 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(1573): EEM_Base->_prepare_value_or_use_default(Object(EE_Datetime_Field), Array) #3 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(1489): EEM_Base->_construct_update_sql(Array) #4 /nas/cont in /wp-content/plugins/event-espresso-core-reg/core/db_models/fields/EE_Datetime_Field.php on line 486


Chris

September 12, 2016 at 2:12 pm

Great, that’s all I need for the additional_limit. I just used the set_additional_limit helper and it seemed to do the trick.

To the Question Group Problem:

When I try the line below
$event->_add_relation_to($question_group, 'Question_Group');

I get this error
Fatal error: Uncaught exception 'EE_Error' with message 'The incoming value being prepared for setting in the database must either be empty or a php DateTime object' in /wp-content/plugins/event-espresso-core-reg/core/db_models/fields/EE_Datetime_Field.php:486

Stack Trace:
#0 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2552): EE_Datetime_Field->prepare_for_use_in_db(1473710909) #1 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2532): EEM_Base->_prepare_value_for_use_in_db(1473710909, Object(EE_Datetime_Field)) #2 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(1573): EEM_Base->_prepare_value_or_use_default(Object(EE_Datetime_Field), Array) #3 /wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(1489): EEM_Base->_construct_update_sql(Array) #4 /nas/cont in /wp-content/plugins/event-espresso-core-reg/core/db_models/fields/EE_Datetime_Field.php on line 486


Josh

  • Support Staff

September 14, 2016 at 1:08 pm

You might get a better idea on how to set a Question group for an event by taking at the code in the _duplicate_event() method in Extend_Events_Admin_Page.core.php. There it’s taking an existing event, and applying the data from that event into a new event.

Viewing 5 reply threads

The support post ‘Setting the Question Group for an Event/Registering at one time’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso