|
@@ 3871-3884 (lines=14) @@
|
| 3868 |
|
$allow_fields = in_array($query_param_type, array('where', 'having', 'order_by', 'group_by', 'order')); |
| 3869 |
|
//check to see if we have a field on this model |
| 3870 |
|
$this_model_fields = $this->field_settings(true); |
| 3871 |
|
if (array_key_exists($query_param, $this_model_fields)) { |
| 3872 |
|
if ($allow_fields) { |
| 3873 |
|
return; |
| 3874 |
|
} |
| 3875 |
|
throw new EE_Error( |
| 3876 |
|
sprintf( |
| 3877 |
|
__( |
| 3878 |
|
"Using a field name (%s) on model %s is not allowed on this query param type '%s'. Original query param was %s", |
| 3879 |
|
"event_espresso" |
| 3880 |
|
), |
| 3881 |
|
$query_param, get_class($this), $query_param_type, $original_query_param |
| 3882 |
|
) |
| 3883 |
|
); |
| 3884 |
|
} |
| 3885 |
|
//check if this is a special logic query param |
| 3886 |
|
if (in_array($query_param, $this->_logic_query_param_keys, true)) { |
| 3887 |
|
if ($allow_logic_query_params) { |
|
@@ 4239-4253 (lines=15) @@
|
| 4236 |
|
$cleaned_value = $this->_construct_between_value($value, $field_obj); |
| 4237 |
|
return $operator . SP . $cleaned_value; |
| 4238 |
|
} |
| 4239 |
|
if (in_array($operator, $this->_null_style_operators)) { |
| 4240 |
|
if ($value !== null) { |
| 4241 |
|
throw new EE_Error( |
| 4242 |
|
sprintf( |
| 4243 |
|
__( |
| 4244 |
|
"You attempted to give a value (%s) while using a NULL-style operator (%s). That isn't valid", |
| 4245 |
|
"event_espresso" |
| 4246 |
|
), |
| 4247 |
|
$value, |
| 4248 |
|
$operator |
| 4249 |
|
) |
| 4250 |
|
); |
| 4251 |
|
} |
| 4252 |
|
return $operator; |
| 4253 |
|
} |
| 4254 |
|
if ($operator === 'LIKE' && ! is_array($value)) { |
| 4255 |
|
//if the operator is 'LIKE', we want to allow percent signs (%) and not |
| 4256 |
|
//remove other junk. So just treat it as a string. |
|
@@ 5085-5088 (lines=4) @@
|
| 5082 |
|
public function add_to_entity_map(EE_Base_Class $object) |
| 5083 |
|
{ |
| 5084 |
|
$className = $this->_get_class_name(); |
| 5085 |
|
if (! $object instanceof $className) { |
| 5086 |
|
throw new EE_Error(sprintf(__("You tried adding a %s to a mapping of %ss", "event_espresso"), |
| 5087 |
|
is_object($object) ? get_class($object) : $object, $className)); |
| 5088 |
|
} |
| 5089 |
|
/** @var $object EE_Base_Class */ |
| 5090 |
|
if (! $object->ID()) { |
| 5091 |
|
throw new EE_Error(sprintf(__("You tried storing a model object with NO ID in the %s entity mapper.", |