Completed
Branch fix-caching-loader-test (60c3ed)
by
unknown
13:01 queued 04:28
created
core/db_models/fields/EE_Enum_Integer_Field.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@
 block discarded – undo
89 89
     public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
90 90
     {
91 91
         $options = $this->_allowed_enum_values();
92
-        if (isset($options[ $value_on_field_to_be_outputted ])) {
93
-            return $options[ $value_on_field_to_be_outputted ];
92
+        if (isset($options[$value_on_field_to_be_outputted])) {
93
+            return $options[$value_on_field_to_be_outputted];
94 94
         } else {
95 95
             return $value_on_field_to_be_outputted;
96 96
         }
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -9,115 +9,115 @@
 block discarded – undo
9 9
  */
10 10
 class EE_Enum_Integer_Field extends EE_Integer_Field
11 11
 {
12
-    /**
13
-     * @var array $_allowed_enum_values
14
-     */
15
-    public $_allowed_enum_values;
12
+	/**
13
+	 * @var array $_allowed_enum_values
14
+	 */
15
+	public $_allowed_enum_values;
16 16
 
17 17
 
18
-    /**
19
-     * @param string  $table_column
20
-     * @param string  $nicename
21
-     * @param boolean $nullable
22
-     * @param int     $default_value
23
-     * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
24
-     */
25
-    public function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values)
26
-    {
27
-        $this->_allowed_enum_values = $allowed_enum_values;
28
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
29
-        $this->setSchemaType('object');
30
-    }
18
+	/**
19
+	 * @param string  $table_column
20
+	 * @param string  $nicename
21
+	 * @param boolean $nullable
22
+	 * @param int     $default_value
23
+	 * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
24
+	 */
25
+	public function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values)
26
+	{
27
+		$this->_allowed_enum_values = $allowed_enum_values;
28
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
29
+		$this->setSchemaType('object');
30
+	}
31 31
 
32
-    /**
33
-     * Returns the list of allowed enum options, but filterable.
34
-     * This is used internally
35
-     *
36
-     * @return array
37
-     */
38
-    protected function _allowed_enum_values()
39
-    {
40
-        return (array) apply_filters(
41
-            'FHEE__EE_Enum_Integer_Field___allowed_enum_options',
42
-            $this->_allowed_enum_values,
43
-            $this
44
-        );
45
-    }
32
+	/**
33
+	 * Returns the list of allowed enum options, but filterable.
34
+	 * This is used internally
35
+	 *
36
+	 * @return array
37
+	 */
38
+	protected function _allowed_enum_values()
39
+	{
40
+		return (array) apply_filters(
41
+			'FHEE__EE_Enum_Integer_Field___allowed_enum_options',
42
+			$this->_allowed_enum_values,
43
+			$this
44
+		);
45
+	}
46 46
 
47
-    /**
48
-     * When setting, just verify that the value being used matches what we've defined as allowable enum values.
49
-     * If not, throw an error (but if WP_DEBUG is false, just set the value to default)
50
-     *
51
-     * @param int $value_inputted_for_field_on_model_object
52
-     * @return int
53
-     * @throws EE_Error
54
-     */
55
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
56
-    {
57
-        $allowed_enum_values = $this->_allowed_enum_values();
58
-        if (
59
-            $value_inputted_for_field_on_model_object !== null
60
-            && ! array_key_exists($value_inputted_for_field_on_model_object, $allowed_enum_values)
61
-        ) {
62
-            if (defined('WP_DEBUG') && WP_DEBUG) {
63
-                $msg = sprintf(
64
-                    esc_html__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
65
-                    $value_inputted_for_field_on_model_object,
66
-                    $this->_name
67
-                );
68
-                $msg2 = sprintf(
69
-                    esc_html__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'),
70
-                    $this->_name,
71
-                    implode(', ', array_keys($allowed_enum_values)),
72
-                    $value_inputted_for_field_on_model_object
73
-                );
74
-                EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
75
-            }
76
-            return $this->get_default_value();
77
-        }
78
-        return (int) $value_inputted_for_field_on_model_object;
79
-    }
47
+	/**
48
+	 * When setting, just verify that the value being used matches what we've defined as allowable enum values.
49
+	 * If not, throw an error (but if WP_DEBUG is false, just set the value to default)
50
+	 *
51
+	 * @param int $value_inputted_for_field_on_model_object
52
+	 * @return int
53
+	 * @throws EE_Error
54
+	 */
55
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
56
+	{
57
+		$allowed_enum_values = $this->_allowed_enum_values();
58
+		if (
59
+			$value_inputted_for_field_on_model_object !== null
60
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $allowed_enum_values)
61
+		) {
62
+			if (defined('WP_DEBUG') && WP_DEBUG) {
63
+				$msg = sprintf(
64
+					esc_html__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
65
+					$value_inputted_for_field_on_model_object,
66
+					$this->_name
67
+				);
68
+				$msg2 = sprintf(
69
+					esc_html__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'),
70
+					$this->_name,
71
+					implode(', ', array_keys($allowed_enum_values)),
72
+					$value_inputted_for_field_on_model_object
73
+				);
74
+				EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
75
+			}
76
+			return $this->get_default_value();
77
+		}
78
+		return (int) $value_inputted_for_field_on_model_object;
79
+	}
80 80
 
81 81
 
82 82
 
83
-    /**
84
-     * Gets the pretty version of the enum's value.
85
-     *
86
-     * @param int | string $value_on_field_to_be_outputted
87
-     * @param null         $schema
88
-     * @return string
89
-     */
90
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
91
-    {
92
-        $options = $this->_allowed_enum_values();
93
-        if (isset($options[ $value_on_field_to_be_outputted ])) {
94
-            return $options[ $value_on_field_to_be_outputted ];
95
-        } else {
96
-            return $value_on_field_to_be_outputted;
97
-        }
98
-    }
83
+	/**
84
+	 * Gets the pretty version of the enum's value.
85
+	 *
86
+	 * @param int | string $value_on_field_to_be_outputted
87
+	 * @param null         $schema
88
+	 * @return string
89
+	 */
90
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
91
+	{
92
+		$options = $this->_allowed_enum_values();
93
+		if (isset($options[ $value_on_field_to_be_outputted ])) {
94
+			return $options[ $value_on_field_to_be_outputted ];
95
+		} else {
96
+			return $value_on_field_to_be_outputted;
97
+		}
98
+	}
99 99
 
100 100
 
101
-    public function getSchemaProperties()
102
-    {
103
-        return array(
104
-            'raw' => array(
105
-                'description' =>  sprintf(
106
-                    esc_html__('%s - the value in the database.', 'event_espresso'),
107
-                    $this->get_nicename()
108
-                ),
109
-                'enum' => array_keys($this->_allowed_enum_values()),
110
-                'type' => 'integer'
111
-            ),
112
-            'pretty' => array(
113
-                'description' =>  sprintf(
114
-                    esc_html__('%s - the value for display.', 'event_espresso'),
115
-                    $this->get_nicename()
116
-                ),
117
-                'enum' => array_values($this->_allowed_enum_values()),
118
-                'type' => 'string',
119
-                'read_only' => true
120
-            )
121
-        );
122
-    }
101
+	public function getSchemaProperties()
102
+	{
103
+		return array(
104
+			'raw' => array(
105
+				'description' =>  sprintf(
106
+					esc_html__('%s - the value in the database.', 'event_espresso'),
107
+					$this->get_nicename()
108
+				),
109
+				'enum' => array_keys($this->_allowed_enum_values()),
110
+				'type' => 'integer'
111
+			),
112
+			'pretty' => array(
113
+				'description' =>  sprintf(
114
+					esc_html__('%s - the value for display.', 'event_espresso'),
115
+					$this->get_nicename()
116
+				),
117
+				'enum' => array_values($this->_allowed_enum_values()),
118
+				'type' => 'string',
119
+				'read_only' => true
120
+			)
121
+		);
122
+	}
123 123
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Maybe_Serialized_Text_Field.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -2,36 +2,36 @@
 block discarded – undo
2 2
 
3 3
 class EE_Maybe_Serialized_Text_Field extends EE_Serialized_Text_Field
4 4
 {
5
-    /**
6
-     * Value could be an array or a string. If its an array, serialize it. Otherwise, leave it as a string
7
-     *
8
-     * @param array|string $value_of_field_on_model_object
9
-     * @return string (possibly serialized)
10
-     */
11
-    public function prepare_for_use_in_db($value_of_field_on_model_object)
12
-    {
13
-        if (is_array($value_of_field_on_model_object)) {
14
-            return parent::prepare_for_use_in_db($value_of_field_on_model_object);
15
-        } else {
16
-            return $value_of_field_on_model_object;
17
-        }
18
-    }
5
+	/**
6
+	 * Value could be an array or a string. If its an array, serialize it. Otherwise, leave it as a string
7
+	 *
8
+	 * @param array|string $value_of_field_on_model_object
9
+	 * @return string (possibly serialized)
10
+	 */
11
+	public function prepare_for_use_in_db($value_of_field_on_model_object)
12
+	{
13
+		if (is_array($value_of_field_on_model_object)) {
14
+			return parent::prepare_for_use_in_db($value_of_field_on_model_object);
15
+		} else {
16
+			return $value_of_field_on_model_object;
17
+		}
18
+	}
19 19
 
20
-    /**
21
-     * Formats the array (or string) according to $schema. Right now, just implode with commas
22
-     *
23
-     * @param type $value_on_field_to_be_outputted
24
-     * @param type $schema
25
-     * @return strubg
26
-     */
27
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
28
-    {
29
-        $pretty_value = null;
30
-        if (is_array($value_on_field_to_be_outputted)) {
31
-            $pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
32
-        } else {
33
-            $pretty_value = $value_on_field_to_be_outputted;
34
-        }
35
-        return $pretty_value;
36
-    }
20
+	/**
21
+	 * Formats the array (or string) according to $schema. Right now, just implode with commas
22
+	 *
23
+	 * @param type $value_on_field_to_be_outputted
24
+	 * @param type $schema
25
+	 * @return strubg
26
+	 */
27
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
28
+	{
29
+		$pretty_value = null;
30
+		if (is_array($value_on_field_to_be_outputted)) {
31
+			$pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
32
+		} else {
33
+			$pretty_value = $value_on_field_to_be_outputted;
34
+		}
35
+		return $pretty_value;
36
+	}
37 37
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Post_Content_Field.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function prepare_for_set($value)
30 30
     {
31
-        if (! current_user_can('unfiltered_html')) {
31
+        if ( ! current_user_can('unfiltered_html')) {
32 32
             $value = wp_kses("$value", wp_kses_allowed_html('post'));
33 33
         }
34 34
         return parent::prepare_for_set($value);
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected static function _setup_the_content_wp_core_only_filters()
98 98
     {
99
-        add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
100
-        add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
99
+        add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'run_shortcode'), 8);
100
+        add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'autoembed'), 8);
101 101
         add_filter('the_content_wp_core_only', 'wptexturize', 10);
102 102
         add_filter('the_content_wp_core_only', 'wpautop', 10);
103 103
         add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
Please login to merge, or discard this patch.
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -6,129 +6,129 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Post_Content_Field extends EE_Text_Field_Base
8 8
 {
9
-    /**
10
-     * @param string $table_column
11
-     * @param string $nicename
12
-     * @param bool   $nullable
13
-     * @param null   $default_value
14
-     */
15
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
16
-    {
17
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
18
-        $this->setSchemaType('object');
19
-    }
9
+	/**
10
+	 * @param string $table_column
11
+	 * @param string $nicename
12
+	 * @param bool   $nullable
13
+	 * @param null   $default_value
14
+	 */
15
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
16
+	{
17
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
18
+		$this->setSchemaType('object');
19
+	}
20 20
 
21 21
 
22
-    /**
23
-     * removes all tags which a WP Post wouldn't allow in its content normally
24
-     *
25
-     * @param string $value
26
-     * @return string
27
-     */
28
-    public function prepare_for_set($value)
29
-    {
30
-        if (! current_user_can('unfiltered_html')) {
31
-            $value = wp_kses("$value", wp_kses_allowed_html('post'));
32
-        }
33
-        return parent::prepare_for_set($value);
34
-    }
22
+	/**
23
+	 * removes all tags which a WP Post wouldn't allow in its content normally
24
+	 *
25
+	 * @param string $value
26
+	 * @return string
27
+	 */
28
+	public function prepare_for_set($value)
29
+	{
30
+		if (! current_user_can('unfiltered_html')) {
31
+			$value = wp_kses("$value", wp_kses_allowed_html('post'));
32
+		}
33
+		return parent::prepare_for_set($value);
34
+	}
35 35
 
36 36
 
37 37
 
38
-    /**
39
-     * Runs the content through `the_content`, or if prepares the content for placing in a form input
40
-     * @param string $value_on_field_to_be_outputted
41
-     * @param string   $schema possible values: 'form_input' or null (if null, will run through 'the_content')
42
-     * @return string
43
-     * @throws EE_Error when WP_DEBUG is on and recursive calling is detected
44
-     */
45
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
46
-    {
47
-        switch ($schema) {
48
-            case 'form_input':
49
-                return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
50
-            case 'the_content':
51
-                if (doing_filter('the_content')) {
52
-                    if (defined('WP_DEBUG') && WP_DEBUG) {
53
-                        throw new EE_Error(
54
-                            sprintf(
55
-                                esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
56
-                                'EE_Post_Content_Field::prepare_for_pretty_echoing',
57
-                                '$schema',
58
-                                'the_content',
59
-                                'the_content_wp_core_only'
60
-                            )
61
-                        );
62
-                    } else {
63
-                        return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only');
64
-                    }
65
-                }
66
-                return apply_filters(
67
-                    'the_content',
68
-                    parent::prepare_for_pretty_echoing(
69
-                        $value_on_field_to_be_outputted,
70
-                        $schema
71
-                    )
72
-                );
73
-            case 'the_content_wp_core_only':
74
-            default:
75
-                self::_setup_the_content_wp_core_only_filters();
76
-                $return_value = apply_filters(
77
-                    'the_content_wp_core_only',
78
-                    parent::prepare_for_pretty_echoing(
79
-                        $value_on_field_to_be_outputted,
80
-                        $schema
81
-                    )
82
-                );
83
-                // ya know what? adding these filters is super fast. Let's just
84
-                // avoid needing to maintain global state and set this up as-needed
85
-                remove_all_filters('the_content_wp_core_only');
86
-                do_action('AHEE__EE_Post_Content_Field__prepare_for_pretty_echoing__the_content_wp_core_only__done');
87
-                return $return_value;
88
-        }
89
-    }
38
+	/**
39
+	 * Runs the content through `the_content`, or if prepares the content for placing in a form input
40
+	 * @param string $value_on_field_to_be_outputted
41
+	 * @param string   $schema possible values: 'form_input' or null (if null, will run through 'the_content')
42
+	 * @return string
43
+	 * @throws EE_Error when WP_DEBUG is on and recursive calling is detected
44
+	 */
45
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
46
+	{
47
+		switch ($schema) {
48
+			case 'form_input':
49
+				return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
50
+			case 'the_content':
51
+				if (doing_filter('the_content')) {
52
+					if (defined('WP_DEBUG') && WP_DEBUG) {
53
+						throw new EE_Error(
54
+							sprintf(
55
+								esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
56
+								'EE_Post_Content_Field::prepare_for_pretty_echoing',
57
+								'$schema',
58
+								'the_content',
59
+								'the_content_wp_core_only'
60
+							)
61
+						);
62
+					} else {
63
+						return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only');
64
+					}
65
+				}
66
+				return apply_filters(
67
+					'the_content',
68
+					parent::prepare_for_pretty_echoing(
69
+						$value_on_field_to_be_outputted,
70
+						$schema
71
+					)
72
+				);
73
+			case 'the_content_wp_core_only':
74
+			default:
75
+				self::_setup_the_content_wp_core_only_filters();
76
+				$return_value = apply_filters(
77
+					'the_content_wp_core_only',
78
+					parent::prepare_for_pretty_echoing(
79
+						$value_on_field_to_be_outputted,
80
+						$schema
81
+					)
82
+				);
83
+				// ya know what? adding these filters is super fast. Let's just
84
+				// avoid needing to maintain global state and set this up as-needed
85
+				remove_all_filters('the_content_wp_core_only');
86
+				do_action('AHEE__EE_Post_Content_Field__prepare_for_pretty_echoing__the_content_wp_core_only__done');
87
+				return $return_value;
88
+		}
89
+	}
90 90
 
91 91
 
92 92
 
93
-    /**
94
-     * Verifies we've setup the standard WP core filters on  'the_content_wp_core_only' filter
95
-     */
96
-    protected static function _setup_the_content_wp_core_only_filters()
97
-    {
98
-        add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
99
-        add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
100
-        add_filter('the_content_wp_core_only', 'wptexturize', 10);
101
-        add_filter('the_content_wp_core_only', 'wpautop', 10);
102
-        add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
103
-        add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
104
-        if (function_exists('wp_filter_content_tags')) {
105
-            add_filter('the_content_wp_core_only', 'wp_filter_content_tags', 10);
106
-        } elseif (function_exists('wp_make_content_images_responsive')) {
107
-            add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
108
-        }
109
-        add_filter('the_content_wp_core_only', 'do_shortcode', 11);
110
-        add_filter('the_content_wp_core_only', 'convert_smilies', 20);
111
-    }
93
+	/**
94
+	 * Verifies we've setup the standard WP core filters on  'the_content_wp_core_only' filter
95
+	 */
96
+	protected static function _setup_the_content_wp_core_only_filters()
97
+	{
98
+		add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
99
+		add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
100
+		add_filter('the_content_wp_core_only', 'wptexturize', 10);
101
+		add_filter('the_content_wp_core_only', 'wpautop', 10);
102
+		add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
103
+		add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
104
+		if (function_exists('wp_filter_content_tags')) {
105
+			add_filter('the_content_wp_core_only', 'wp_filter_content_tags', 10);
106
+		} elseif (function_exists('wp_make_content_images_responsive')) {
107
+			add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
108
+		}
109
+		add_filter('the_content_wp_core_only', 'do_shortcode', 11);
110
+		add_filter('the_content_wp_core_only', 'convert_smilies', 20);
111
+	}
112 112
 
113 113
 
114 114
 
115
-    public function getSchemaProperties()
116
-    {
117
-        return array(
118
-            'raw' => array(
119
-                'description' =>  sprintf(
120
-                    esc_html__('%s - the content as it exists in the database.', 'event_espresso'),
121
-                    $this->get_nicename()
122
-                ),
123
-                'type' => 'string'
124
-            ),
125
-            'rendered' => array(
126
-                'description' =>  sprintf(
127
-                    esc_html__('%s - the content rendered for display.', 'event_espresso'),
128
-                    $this->get_nicename()
129
-                ),
130
-                'type' => 'string'
131
-            )
132
-        );
133
-    }
115
+	public function getSchemaProperties()
116
+	{
117
+		return array(
118
+			'raw' => array(
119
+				'description' =>  sprintf(
120
+					esc_html__('%s - the content as it exists in the database.', 'event_espresso'),
121
+					$this->get_nicename()
122
+				),
123
+				'type' => 'string'
124
+			),
125
+			'rendered' => array(
126
+				'description' =>  sprintf(
127
+					esc_html__('%s - the content rendered for display.', 'event_espresso'),
128
+					$this->get_nicename()
129
+				),
130
+				'type' => 'string'
131
+			)
132
+		);
133
+	}
134 134
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Maybe_Serialized_Simple_HTML_Field.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,59 +11,59 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field
13 13
 {
14
-    /**
15
-     * removes all non-basic tags when setting
16
-     *
17
-     * @param string $value_inputted_for_field_on_model_object
18
-     * @return string
19
-     */
20
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
21
-    {
22
-        return parent::prepare_for_set($this->_remove_tags($value_inputted_for_field_on_model_object));
23
-    }
14
+	/**
15
+	 * removes all non-basic tags when setting
16
+	 *
17
+	 * @param string $value_inputted_for_field_on_model_object
18
+	 * @return string
19
+	 */
20
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
21
+	{
22
+		return parent::prepare_for_set($this->_remove_tags($value_inputted_for_field_on_model_object));
23
+	}
24 24
 
25
-    /**
26
-     * Remove any non-"simple" html tags. @see EE_Simple_HTML_Field
27
-     *
28
-     * @param array|string $value
29
-     * @return array|string
30
-     */
31
-    protected function _remove_tags($value)
32
-    {
33
-        if (is_array($value)) {
34
-            foreach ($value as $key => $v) {
35
-                $value[ $key ] = $this->_remove_tags($v);
36
-            }
37
-        } elseif (is_string($value)) {
38
-            $value = wp_kses("$value", $this->_get_allowed_tags());
39
-        }
40
-        return $value;
41
-    }
25
+	/**
26
+	 * Remove any non-"simple" html tags. @see EE_Simple_HTML_Field
27
+	 *
28
+	 * @param array|string $value
29
+	 * @return array|string
30
+	 */
31
+	protected function _remove_tags($value)
32
+	{
33
+		if (is_array($value)) {
34
+			foreach ($value as $key => $v) {
35
+				$value[ $key ] = $this->_remove_tags($v);
36
+			}
37
+		} elseif (is_string($value)) {
38
+			$value = wp_kses("$value", $this->_get_allowed_tags());
39
+		}
40
+		return $value;
41
+	}
42 42
 
43
-    /**
44
-     * In case unsafe data somehow got inserted into the database, we want to remove tags again
45
-     *
46
-     * @param array|string $value_found_in_db_for_model_object
47
-     * @return array|string
48
-     */
49
-    public function prepare_for_set_from_db($value_found_in_db_for_model_object)
50
-    {
51
-        return $this->_remove_tags(parent::prepare_for_set_from_db($value_found_in_db_for_model_object));
52
-    }
43
+	/**
44
+	 * In case unsafe data somehow got inserted into the database, we want to remove tags again
45
+	 *
46
+	 * @param array|string $value_found_in_db_for_model_object
47
+	 * @return array|string
48
+	 */
49
+	public function prepare_for_set_from_db($value_found_in_db_for_model_object)
50
+	{
51
+		return $this->_remove_tags(parent::prepare_for_set_from_db($value_found_in_db_for_model_object));
52
+	}
53 53
 
54 54
 
55
-    /**
56
-     * Determines what tags to allow in this model field
57
-     *
58
-     * @global array $allowedtags
59
-     * @return array
60
-     */
61
-    public function _get_allowed_tags()
62
-    {
63
-        return apply_filters(
64
-            'FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags',
65
-            EEH_HTML::get_simple_tags(),
66
-            $this
67
-        );
68
-    }
55
+	/**
56
+	 * Determines what tags to allow in this model field
57
+	 *
58
+	 * @global array $allowedtags
59
+	 * @return array
60
+	 */
61
+	public function _get_allowed_tags()
62
+	{
63
+		return apply_filters(
64
+			'FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags',
65
+			EEH_HTML::get_simple_tags(),
66
+			$this
67
+		);
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         if (is_array($value)) {
34 34
             foreach ($value as $key => $v) {
35
-                $value[ $key ] = $this->_remove_tags($v);
35
+                $value[$key] = $this->_remove_tags($v);
36 36
             }
37 37
         } elseif (is_string($value)) {
38 38
             $value = wp_kses("$value", $this->_get_allowed_tags());
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_String_Field.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,22 +3,22 @@
 block discarded – undo
3 3
 class EE_Primary_Key_String_Field extends EE_Primary_Key_Field_Base
4 4
 {
5 5
 
6
-    public function __construct($table_column, $nicename)
7
-    {
8
-        parent::__construct($table_column, $nicename, null);
9
-    }
6
+	public function __construct($table_column, $nicename)
7
+	{
8
+		parent::__construct($table_column, $nicename, null);
9
+	}
10 10
 
11
-    /**
12
-     * removes all tags when setting
13
-     *
14
-     * @param string $value_inputted_for_field_on_model_object
15
-     * @return string
16
-     */
17
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
18
-    {
19
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
20
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
21
-        }
22
-        return wp_strip_all_tags($value_inputted_for_field_on_model_object);
23
-    }
11
+	/**
12
+	 * removes all tags when setting
13
+	 *
14
+	 * @param string $value_inputted_for_field_on_model_object
15
+	 * @return string
16
+	 */
17
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
18
+	{
19
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
20
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
21
+		}
22
+		return wp_strip_all_tags($value_inputted_for_field_on_model_object);
23
+	}
24 24
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Message_Template.model.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             );
50 50
         $this->_model_chain_to_wp_user = 'Message_Template_Group';
51 51
         foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
52
-            $this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global('Message_Template_Group.MTP_is_global');
52
+            $this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('Message_Template_Group.MTP_is_global');
53 53
         }
54 54
         $this->_caps_slug = 'messages';
55 55
         parent::__construct($timezone);
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -14,45 +14,45 @@
 block discarded – undo
14 14
  */
15 15
 class EEM_Message_Template extends EEM_Base
16 16
 {
17
-    // private instance of the EEM_Message_Template object
18
-    protected static $_instance = null;
17
+	// private instance of the EEM_Message_Template object
18
+	protected static $_instance = null;
19 19
 
20 20
 
21 21
 
22
-    /**
23
-     * private constructor to prevent direct creation
24
-     *
25
-     * @Constructor
26
-     * @access protected
27
-     * @param string $timezone
28
-     * @throws \EE_Error
29
-     */
30
-    protected function __construct($timezone = null)
31
-    {
32
-        $this->singular_item = esc_html__('Message Template', 'event_espresso');
33
-        $this->plural_item = esc_html__('Message Templates', 'event_espresso');
22
+	/**
23
+	 * private constructor to prevent direct creation
24
+	 *
25
+	 * @Constructor
26
+	 * @access protected
27
+	 * @param string $timezone
28
+	 * @throws \EE_Error
29
+	 */
30
+	protected function __construct($timezone = null)
31
+	{
32
+		$this->singular_item = esc_html__('Message Template', 'event_espresso');
33
+		$this->plural_item = esc_html__('Message Templates', 'event_espresso');
34 34
 
35
-        $this->_tables = array(
36
-            'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID')
37
-        );
38
-        $this->_fields = array(
39
-            'Message_Template' => array(
40
-                'MTP_ID' => new EE_Primary_Key_Int_Field('MTP_ID', esc_html__('Message Template ID', 'event_espresso')),
41
-                'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', esc_html__('Message Template Group ID', 'event_espresso'), false, 0, 'Message_Template_Group'),
42
-                'MTP_template_field' => new EE_Plain_Text_Field('MTP_template_field', esc_html__('Field Name for this Template', 'event_espresso'), false, 'default'),
43
-                'MTP_context' => new EE_Plain_Text_Field('MTP_context', esc_html__('Message Type Context for this field', 'event_espresso'), false, 'admin'),
44
-                'MTP_content' => new EE_Serialized_Text_Field('MTP_content', esc_html__('The field content for the template', 'event_espresso'), false, ''),
45
-            )
46
-        );
35
+		$this->_tables = array(
36
+			'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID')
37
+		);
38
+		$this->_fields = array(
39
+			'Message_Template' => array(
40
+				'MTP_ID' => new EE_Primary_Key_Int_Field('MTP_ID', esc_html__('Message Template ID', 'event_espresso')),
41
+				'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', esc_html__('Message Template Group ID', 'event_espresso'), false, 0, 'Message_Template_Group'),
42
+				'MTP_template_field' => new EE_Plain_Text_Field('MTP_template_field', esc_html__('Field Name for this Template', 'event_espresso'), false, 'default'),
43
+				'MTP_context' => new EE_Plain_Text_Field('MTP_context', esc_html__('Message Type Context for this field', 'event_espresso'), false, 'admin'),
44
+				'MTP_content' => new EE_Serialized_Text_Field('MTP_content', esc_html__('The field content for the template', 'event_espresso'), false, ''),
45
+			)
46
+		);
47 47
 
48
-        $this->_model_relations = array(
49
-            'Message_Template_Group' => new EE_Belongs_To_Relation()
50
-            );
51
-        $this->_model_chain_to_wp_user = 'Message_Template_Group';
52
-        foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
53
-            $this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global('Message_Template_Group.MTP_is_global');
54
-        }
55
-        $this->_caps_slug = 'messages';
56
-        parent::__construct($timezone);
57
-    }
48
+		$this->_model_relations = array(
49
+			'Message_Template_Group' => new EE_Belongs_To_Relation()
50
+			);
51
+		$this->_model_chain_to_wp_user = 'Message_Template_Group';
52
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
53
+			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global('Message_Template_Group.MTP_is_global');
54
+		}
55
+		$this->_caps_slug = 'messages';
56
+		parent::__construct($timezone);
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/db_models/relations/EE_Belongs_To_Any_Relation.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@
 block discarded – undo
35 35
         $this_table_alias     = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
36 36
             $model_relation_chain,
37 37
             $this->get_this_model()->get_this_model_name()
38
-        ) . $this_table_fk_field->get_table_alias();
39
-        $other_table_alias    = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
38
+        ).$this_table_fk_field->get_table_alias();
39
+        $other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
40 40
             $model_relation_chain,
41 41
             $this->get_other_model()->get_this_model_name()
42
-        ) . $other_table_pk_field->get_table_alias();
43
-        $other_table          = $this->get_other_model()->get_table_for_alias($other_table_alias);
42
+        ).$other_table_pk_field->get_table_alias();
43
+        $other_table = $this->get_other_model()->get_table_for_alias($other_table_alias);
44 44
         return $this->_left_join(
45 45
             $other_table,
46 46
             $other_table_alias,
47 47
             $other_table_pk_field->get_table_column(),
48 48
             $this_table_alias,
49 49
             $this_table_fk_field->get_table_column(),
50
-            $field_with_model_name->get_qualified_column() . "='" . $this->get_other_model()->get_this_model_name() . "'"
50
+            $field_with_model_name->get_qualified_column()."='".$this->get_other_model()->get_this_model_name()."'"
51 51
         )
52 52
                . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
53 53
     }
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -14,94 +14,94 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Belongs_To_Any_Relation extends EE_Belongs_To_Relation
16 16
 {
17
-    /**
18
-     * get_join_statement
19
-     *
20
-     * @param string $model_relation_chain
21
-     * @return string
22
-     * @throws \EE_Error
23
-     */
24
-    public function get_join_statement($model_relation_chain)
25
-    {
26
-        // create the sql string like
27
-        $this_table_fk_field = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
28
-        // ALSO, need to get the field with the model name
29
-        $field_with_model_name = $this->get_this_model()->get_field_containing_related_model_name();
17
+	/**
18
+	 * get_join_statement
19
+	 *
20
+	 * @param string $model_relation_chain
21
+	 * @return string
22
+	 * @throws \EE_Error
23
+	 */
24
+	public function get_join_statement($model_relation_chain)
25
+	{
26
+		// create the sql string like
27
+		$this_table_fk_field = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
28
+		// ALSO, need to get the field with the model name
29
+		$field_with_model_name = $this->get_this_model()->get_field_containing_related_model_name();
30 30
 
31 31
 
32
-        $other_table_pk_field = $this->get_other_model()->get_primary_key_field();
33
-        $this_table_alias     = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
34
-            $model_relation_chain,
35
-            $this->get_this_model()->get_this_model_name()
36
-        ) . $this_table_fk_field->get_table_alias();
37
-        $other_table_alias    = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
38
-            $model_relation_chain,
39
-            $this->get_other_model()->get_this_model_name()
40
-        ) . $other_table_pk_field->get_table_alias();
41
-        $other_table          = $this->get_other_model()->get_table_for_alias($other_table_alias);
42
-        return $this->_left_join(
43
-            $other_table,
44
-            $other_table_alias,
45
-            $other_table_pk_field->get_table_column(),
46
-            $this_table_alias,
47
-            $this_table_fk_field->get_table_column(),
48
-            $field_with_model_name->get_qualified_column() . "='" . $this->get_other_model()->get_this_model_name() . "'"
49
-        )
50
-               . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
51
-    }
32
+		$other_table_pk_field = $this->get_other_model()->get_primary_key_field();
33
+		$this_table_alias     = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
34
+			$model_relation_chain,
35
+			$this->get_this_model()->get_this_model_name()
36
+		) . $this_table_fk_field->get_table_alias();
37
+		$other_table_alias    = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
38
+			$model_relation_chain,
39
+			$this->get_other_model()->get_this_model_name()
40
+		) . $other_table_pk_field->get_table_alias();
41
+		$other_table          = $this->get_other_model()->get_table_for_alias($other_table_alias);
42
+		return $this->_left_join(
43
+			$other_table,
44
+			$other_table_alias,
45
+			$other_table_pk_field->get_table_column(),
46
+			$this_table_alias,
47
+			$this_table_fk_field->get_table_column(),
48
+			$field_with_model_name->get_qualified_column() . "='" . $this->get_other_model()->get_this_model_name() . "'"
49
+		)
50
+			   . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
51
+	}
52 52
 
53 53
 
54
-    /**
55
-     * Sets this model object's foreign key to the other model object's primary key. Feel free to do this manually if
56
-     * you like.
57
-     *
58
-     * @param EE_Base_Class|int $this_obj_or_id
59
-     * @param EE_Base_Class|int $other_obj_or_id
60
-     * @param array             $extra_join_model_fields_n_values
61
-     * @return \EE_Base_Class
62
-     * @throws \EE_Error
63
-     */
64
-    public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
65
-    {
66
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
67
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
68
-        // find the field on THIS model which a foreign key to the other model
69
-        $fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
70
-        // set that field on the other model to this model's ID
71
-        $this_model_obj->set($fk_on_this_model->get_name(), $other_model_obj->ID());
72
-        // and make sure this model's field with the foreign model name is set to the correct value
73
-        $this_model_obj->set(
74
-            $this->get_this_model()->get_field_containing_related_model_name()->get_name(),
75
-            $this->get_other_model()->get_this_model_name()
76
-        );
77
-        $this_model_obj->save();
78
-        return $other_model_obj;
79
-    }
54
+	/**
55
+	 * Sets this model object's foreign key to the other model object's primary key. Feel free to do this manually if
56
+	 * you like.
57
+	 *
58
+	 * @param EE_Base_Class|int $this_obj_or_id
59
+	 * @param EE_Base_Class|int $other_obj_or_id
60
+	 * @param array             $extra_join_model_fields_n_values
61
+	 * @return \EE_Base_Class
62
+	 * @throws \EE_Error
63
+	 */
64
+	public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
65
+	{
66
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
67
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
68
+		// find the field on THIS model which a foreign key to the other model
69
+		$fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
70
+		// set that field on the other model to this model's ID
71
+		$this_model_obj->set($fk_on_this_model->get_name(), $other_model_obj->ID());
72
+		// and make sure this model's field with the foreign model name is set to the correct value
73
+		$this_model_obj->set(
74
+			$this->get_this_model()->get_field_containing_related_model_name()->get_name(),
75
+			$this->get_other_model()->get_this_model_name()
76
+		);
77
+		$this_model_obj->save();
78
+		return $other_model_obj;
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     * Sets the this model object's foreign key to its default, instead of pointing to the other model object
84
-     *
85
-     * @param EE_Base_Class|int $this_obj_or_id
86
-     * @param EE_Base_Class|int $other_obj_or_id
87
-     * @param array             $where_query
88
-     * @return \EE_Base_Class
89
-     * @throws \EE_Error
90
-     */
91
-    public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
92
-    {
93
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
94
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id);
95
-        // find the field on the other model which is a foreign key to this model
96
-        $fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
97
-        // set that field on the other model to this model's ID
98
-        $this_model_obj->set($fk_on_this_model->get_name(), null, true);
99
-        $this_model_obj->set(
100
-            $this->get_this_model()->get_field_containing_related_model_name()->get_name(),
101
-            null,
102
-            true
103
-        );
104
-        $this_model_obj->save();
105
-        return $other_model_obj;
106
-    }
82
+	/**
83
+	 * Sets the this model object's foreign key to its default, instead of pointing to the other model object
84
+	 *
85
+	 * @param EE_Base_Class|int $this_obj_or_id
86
+	 * @param EE_Base_Class|int $other_obj_or_id
87
+	 * @param array             $where_query
88
+	 * @return \EE_Base_Class
89
+	 * @throws \EE_Error
90
+	 */
91
+	public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
92
+	{
93
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
94
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id);
95
+		// find the field on the other model which is a foreign key to this model
96
+		$fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
97
+		// set that field on the other model to this model's ID
98
+		$this_model_obj->set($fk_on_this_model->get_name(), null, true);
99
+		$this_model_obj->set(
100
+			$this->get_this_model()->get_field_containing_related_model_name()->get_name(),
101
+			null,
102
+			true
103
+		);
104
+		$this_model_obj->save();
105
+		return $other_model_obj;
106
+	}
107 107
 }
Please login to merge, or discard this patch.
core/db_models/relations/EE_Has_Many_Relation.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
         $pk_table_alias       = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
47 47
             $model_relation_chain,
48 48
             $this->get_this_model()->get_this_model_name()
49
-        ) . $this_table_pk_field->get_table_alias();
50
-        $fk_table_alias       = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
49
+        ).$this_table_pk_field->get_table_alias();
50
+        $fk_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
51 51
             $model_relation_chain,
52 52
             $this->get_other_model()->get_this_model_name()
53
-        ) . $other_table_fk_field->get_table_alias();
54
-        $fk_table             = $this->get_other_model()->get_table_for_alias($fk_table_alias);
53
+        ).$other_table_fk_field->get_table_alias();
54
+        $fk_table = $this->get_other_model()->get_table_for_alias($fk_table_alias);
55 55
 
56 56
         return $this->_left_join(
57 57
             $fk_table,
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             $other_table_fk_field->get_table_column(),
60 60
             $pk_table_alias,
61 61
             $this_table_pk_field->get_table_column()
62
-        ) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($fk_table_alias);
62
+        ).$this->get_other_model()->_construct_internal_join_to_table_with_alias($fk_table_alias);
63 63
     }
64 64
 
65 65
 
Please login to merge, or discard this patch.
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -10,102 +10,102 @@
 block discarded – undo
10 10
  */
11 11
 class EE_Has_Many_Relation extends EE_Model_Relation_Base
12 12
 {
13
-    /**
14
-     * Object representing the relationship between two models. Has_Many_Relations are where the OTHER model has the
15
-     * foreign key this model. IE, there can be many other model objects related to one of this model's objects (but
16
-     * NOT through a JOIN table, which is the case for EE_HABTM_Relations). This knows how to join the models, get
17
-     * related models across the relation, and add-and-remove the relationships.
18
-     *
19
-     * @param boolean $block_deletes                 For this type of r elation, we block by default. If there are
20
-     *                                               related models across this relation, block (prevent and add an
21
-     *                                               error) the deletion of this model
22
-     * @param string  $blocking_delete_error_message a customized error message on blocking deletes instead of the
23
-     *                                               default
24
-     */
25
-    public function __construct($block_deletes = true, $blocking_delete_error_message = null)
26
-    {
27
-        parent::__construct($block_deletes, $blocking_delete_error_message);
28
-    }
13
+	/**
14
+	 * Object representing the relationship between two models. Has_Many_Relations are where the OTHER model has the
15
+	 * foreign key this model. IE, there can be many other model objects related to one of this model's objects (but
16
+	 * NOT through a JOIN table, which is the case for EE_HABTM_Relations). This knows how to join the models, get
17
+	 * related models across the relation, and add-and-remove the relationships.
18
+	 *
19
+	 * @param boolean $block_deletes                 For this type of r elation, we block by default. If there are
20
+	 *                                               related models across this relation, block (prevent and add an
21
+	 *                                               error) the deletion of this model
22
+	 * @param string  $blocking_delete_error_message a customized error message on blocking deletes instead of the
23
+	 *                                               default
24
+	 */
25
+	public function __construct($block_deletes = true, $blocking_delete_error_message = null)
26
+	{
27
+		parent::__construct($block_deletes, $blocking_delete_error_message);
28
+	}
29 29
 
30 30
 
31
-    /**
32
-     * Gets the SQL string for performing the join between this model and the other model.
33
-     *
34
-     * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
35
-     * @return string of SQL, eg "LEFT JOIN table_name AS table_alias ON this_model_primary_table.pk =
36
-     *                other_model_primary_table.fk" etc
37
-     * @throws \EE_Error
38
-     */
39
-    public function get_join_statement($model_relation_chain)
40
-    {
41
-        // create the sql string like
42
-        // LEFT JOIN other_table AS table_alias ON this_table_alias.pk = other_table_alias.fk extra_join_conditions
43
-        $this_table_pk_field  = $this->get_this_model()->get_primary_key_field();
44
-        $other_table_fk_field = $this->get_other_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
45
-        $pk_table_alias       = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
46
-            $model_relation_chain,
47
-            $this->get_this_model()->get_this_model_name()
48
-        ) . $this_table_pk_field->get_table_alias();
49
-        $fk_table_alias       = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
50
-            $model_relation_chain,
51
-            $this->get_other_model()->get_this_model_name()
52
-        ) . $other_table_fk_field->get_table_alias();
53
-        $fk_table             = $this->get_other_model()->get_table_for_alias($fk_table_alias);
31
+	/**
32
+	 * Gets the SQL string for performing the join between this model and the other model.
33
+	 *
34
+	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
35
+	 * @return string of SQL, eg "LEFT JOIN table_name AS table_alias ON this_model_primary_table.pk =
36
+	 *                other_model_primary_table.fk" etc
37
+	 * @throws \EE_Error
38
+	 */
39
+	public function get_join_statement($model_relation_chain)
40
+	{
41
+		// create the sql string like
42
+		// LEFT JOIN other_table AS table_alias ON this_table_alias.pk = other_table_alias.fk extra_join_conditions
43
+		$this_table_pk_field  = $this->get_this_model()->get_primary_key_field();
44
+		$other_table_fk_field = $this->get_other_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
45
+		$pk_table_alias       = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
46
+			$model_relation_chain,
47
+			$this->get_this_model()->get_this_model_name()
48
+		) . $this_table_pk_field->get_table_alias();
49
+		$fk_table_alias       = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
50
+			$model_relation_chain,
51
+			$this->get_other_model()->get_this_model_name()
52
+		) . $other_table_fk_field->get_table_alias();
53
+		$fk_table             = $this->get_other_model()->get_table_for_alias($fk_table_alias);
54 54
 
55
-        return $this->_left_join(
56
-            $fk_table,
57
-            $fk_table_alias,
58
-            $other_table_fk_field->get_table_column(),
59
-            $pk_table_alias,
60
-            $this_table_pk_field->get_table_column()
61
-        ) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($fk_table_alias);
62
-    }
55
+		return $this->_left_join(
56
+			$fk_table,
57
+			$fk_table_alias,
58
+			$other_table_fk_field->get_table_column(),
59
+			$pk_table_alias,
60
+			$this_table_pk_field->get_table_column()
61
+		) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($fk_table_alias);
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     * Sets the other model object's foreign key to this model object's primary key. Feel free to do this manually if
67
-     * you like.
68
-     *
69
-     * @param EE_Base_Class|int $this_obj_or_id
70
-     * @param EE_Base_Class|int $other_obj_or_id
71
-     * @param array             $extra_join_model_fields_n_values
72
-     * @return \EE_Base_Class
73
-     * @throws \EE_Error
74
-     */
75
-    public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
76
-    {
77
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
78
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
65
+	/**
66
+	 * Sets the other model object's foreign key to this model object's primary key. Feel free to do this manually if
67
+	 * you like.
68
+	 *
69
+	 * @param EE_Base_Class|int $this_obj_or_id
70
+	 * @param EE_Base_Class|int $other_obj_or_id
71
+	 * @param array             $extra_join_model_fields_n_values
72
+	 * @return \EE_Base_Class
73
+	 * @throws \EE_Error
74
+	 */
75
+	public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
76
+	{
77
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
78
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
79 79
 
80
-        // find the field on the other model which is a foreign key to this model
81
-        $fk_field_on_other_model = $this->get_other_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
82
-        if ($other_model_obj->get($fk_field_on_other_model->get_name()) != $this_model_obj->ID()) {
83
-            // set that field on the other model to this model's ID
84
-            $other_model_obj->set($fk_field_on_other_model->get_name(), $this_model_obj->ID());
85
-            $other_model_obj->save();
86
-        }
87
-        return $other_model_obj;
88
-    }
80
+		// find the field on the other model which is a foreign key to this model
81
+		$fk_field_on_other_model = $this->get_other_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
82
+		if ($other_model_obj->get($fk_field_on_other_model->get_name()) != $this_model_obj->ID()) {
83
+			// set that field on the other model to this model's ID
84
+			$other_model_obj->set($fk_field_on_other_model->get_name(), $this_model_obj->ID());
85
+			$other_model_obj->save();
86
+		}
87
+		return $other_model_obj;
88
+	}
89 89
 
90 90
 
91
-    /**
92
-     * Sets the other model object's foreign key to its default, instead of pointing to this model object.
93
-     * If $other_obj_or_id doesn't have any other relations, this function is essentially orphaning it
94
-     *
95
-     * @param EE_Base_Class|int $this_obj_or_id
96
-     * @param EE_Base_Class|int $other_obj_or_id
97
-     * @param array             $where_query
98
-     * @return \EE_Base_Class
99
-     * @throws \EE_Error
100
-     */
101
-    public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
102
-    {
103
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
104
-        // find the field on the other model which is a foreign key to this model
105
-        $fk_field_on_other_model = $this->get_other_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
106
-        // set that field on the other model to this model's ID
107
-        $other_model_obj->set($fk_field_on_other_model->get_name(), null, true);
108
-        $other_model_obj->save();
109
-        return $other_model_obj;
110
-    }
91
+	/**
92
+	 * Sets the other model object's foreign key to its default, instead of pointing to this model object.
93
+	 * If $other_obj_or_id doesn't have any other relations, this function is essentially orphaning it
94
+	 *
95
+	 * @param EE_Base_Class|int $this_obj_or_id
96
+	 * @param EE_Base_Class|int $other_obj_or_id
97
+	 * @param array             $where_query
98
+	 * @return \EE_Base_Class
99
+	 * @throws \EE_Error
100
+	 */
101
+	public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
102
+	{
103
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
104
+		// find the field on the other model which is a foreign key to this model
105
+		$fk_field_on_other_model = $this->get_other_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
106
+		// set that field on the other model to this model's ID
107
+		$other_model_obj->set($fk_field_on_other_model->get_name(), null, true);
108
+		$other_model_obj->save();
109
+		return $other_model_obj;
110
+	}
111 111
 }
Please login to merge, or discard this patch.
core/db_models/relations/EE_Belongs_To_Relation.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
         $this_table_alias     = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
46 46
             $model_relation_chain,
47 47
             $this->get_this_model()->get_this_model_name()
48
-        ) . $this_table_fk_field->get_table_alias();
49
-        $other_table_alias    = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
48
+        ).$this_table_fk_field->get_table_alias();
49
+        $other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
50 50
             $model_relation_chain,
51 51
             $this->get_other_model()->get_this_model_name()
52
-        ) . $other_table_pk_field->get_table_alias();
53
-        $other_table          = $this->get_other_model()->get_table_for_alias($other_table_alias);
52
+        ).$other_table_pk_field->get_table_alias();
53
+        $other_table = $this->get_other_model()->get_table_for_alias($other_table_alias);
54 54
         return $this->_left_join(
55 55
             $other_table,
56 56
             $other_table_alias,
57 57
             $other_table_pk_field->get_table_column(),
58 58
             $this_table_alias,
59 59
             $this_table_fk_field->get_table_column()
60
-        ) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
60
+        ).$this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
61 61
     }
62 62
 
63 63
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
         }
140 140
         $ID_value_on_other_model = $model_obj->get($fk_field_obj->get_name());
141 141
         // get all where their PK matches that value
142
-        $query_params[0][ $this->get_other_model()->get_primary_key_field()->get_name() ] = $ID_value_on_other_model;
143
-        $query_params                                                                   = $this->_disable_default_where_conditions_on_query_param($query_params);
142
+        $query_params[0][$this->get_other_model()->get_primary_key_field()->get_name()] = $ID_value_on_other_model;
143
+        $query_params = $this->_disable_default_where_conditions_on_query_param($query_params);
144 144
 //      echo '$query_params';
145 145
 //      var_dump($query_params);
146 146
         return $this->get_other_model()->get_all($query_params);
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -11,137 +11,137 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Belongs_To_Relation extends EE_Model_Relation_Base
13 13
 {
14
-    /**
15
-     * Object representing the relationship between two models. Belongs_To means that THIS model has the foreign key
16
-     * to the other model. This knows how to join the models,
17
-     * get related models across the relation, and add-and-remove the relationships.
18
-     *
19
-     * @param boolean $block_deletes                                For Belongs_To relations, this is set to FALSE by
20
-     *                                                              default. if there are related models across this
21
-     *                                                              relation, block (prevent and add an error) the
22
-     *                                                              deletion of this model
23
-     * @param string  $related_model_objects_deletion_error_message a customized error message on blocking deletes
24
-     *                                                              instead of the default
25
-     */
26
-    public function __construct($block_deletes = false, $related_model_objects_deletion_error_message = null)
27
-    {
28
-        parent::__construct($block_deletes, $related_model_objects_deletion_error_message);
29
-    }
14
+	/**
15
+	 * Object representing the relationship between two models. Belongs_To means that THIS model has the foreign key
16
+	 * to the other model. This knows how to join the models,
17
+	 * get related models across the relation, and add-and-remove the relationships.
18
+	 *
19
+	 * @param boolean $block_deletes                                For Belongs_To relations, this is set to FALSE by
20
+	 *                                                              default. if there are related models across this
21
+	 *                                                              relation, block (prevent and add an error) the
22
+	 *                                                              deletion of this model
23
+	 * @param string  $related_model_objects_deletion_error_message a customized error message on blocking deletes
24
+	 *                                                              instead of the default
25
+	 */
26
+	public function __construct($block_deletes = false, $related_model_objects_deletion_error_message = null)
27
+	{
28
+		parent::__construct($block_deletes, $related_model_objects_deletion_error_message);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * get_join_statement
34
-     *
35
-     * @param string $model_relation_chain
36
-     * @return string
37
-     * @throws \EE_Error
38
-     */
39
-    public function get_join_statement($model_relation_chain)
40
-    {
41
-        // create the sql string like
42
-        $this_table_fk_field  = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
43
-        $other_table_pk_field = $this->get_other_model()->get_primary_key_field();
44
-        $this_table_alias     = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
45
-            $model_relation_chain,
46
-            $this->get_this_model()->get_this_model_name()
47
-        ) . $this_table_fk_field->get_table_alias();
48
-        $other_table_alias    = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
49
-            $model_relation_chain,
50
-            $this->get_other_model()->get_this_model_name()
51
-        ) . $other_table_pk_field->get_table_alias();
52
-        $other_table          = $this->get_other_model()->get_table_for_alias($other_table_alias);
53
-        return $this->_left_join(
54
-            $other_table,
55
-            $other_table_alias,
56
-            $other_table_pk_field->get_table_column(),
57
-            $this_table_alias,
58
-            $this_table_fk_field->get_table_column()
59
-        ) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
60
-    }
32
+	/**
33
+	 * get_join_statement
34
+	 *
35
+	 * @param string $model_relation_chain
36
+	 * @return string
37
+	 * @throws \EE_Error
38
+	 */
39
+	public function get_join_statement($model_relation_chain)
40
+	{
41
+		// create the sql string like
42
+		$this_table_fk_field  = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
43
+		$other_table_pk_field = $this->get_other_model()->get_primary_key_field();
44
+		$this_table_alias     = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
45
+			$model_relation_chain,
46
+			$this->get_this_model()->get_this_model_name()
47
+		) . $this_table_fk_field->get_table_alias();
48
+		$other_table_alias    = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
49
+			$model_relation_chain,
50
+			$this->get_other_model()->get_this_model_name()
51
+		) . $other_table_pk_field->get_table_alias();
52
+		$other_table          = $this->get_other_model()->get_table_for_alias($other_table_alias);
53
+		return $this->_left_join(
54
+			$other_table,
55
+			$other_table_alias,
56
+			$other_table_pk_field->get_table_column(),
57
+			$this_table_alias,
58
+			$this_table_fk_field->get_table_column()
59
+		) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
60
+	}
61 61
 
62 62
 
63
-    /**
64
-     * Sets this model object's foreign key to the other model object's primary key. Feel free to do this manually if
65
-     * you like.
66
-     *
67
-     * @param EE_Base_Class|int $this_obj_or_id
68
-     * @param EE_Base_Class|int $other_obj_or_id
69
-     * @param array             $extra_join_model_fields_n_values
70
-     * @return \EE_Base_Class
71
-     * @throws \EE_Error
72
-     */
73
-    public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
74
-    {
75
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
76
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
77
-        // find the field on the other model which is a foreign key to this model
78
-        $fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
79
-        if ($this_model_obj->get($fk_on_this_model->get_name()) != $other_model_obj->ID()) {
80
-            // set that field on the other model to this model's ID
81
-            $this_model_obj->set($fk_on_this_model->get_name(), $other_model_obj->ID());
82
-            $this_model_obj->save();
83
-        }
84
-        return $other_model_obj;
85
-    }
63
+	/**
64
+	 * Sets this model object's foreign key to the other model object's primary key. Feel free to do this manually if
65
+	 * you like.
66
+	 *
67
+	 * @param EE_Base_Class|int $this_obj_or_id
68
+	 * @param EE_Base_Class|int $other_obj_or_id
69
+	 * @param array             $extra_join_model_fields_n_values
70
+	 * @return \EE_Base_Class
71
+	 * @throws \EE_Error
72
+	 */
73
+	public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
74
+	{
75
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
76
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
77
+		// find the field on the other model which is a foreign key to this model
78
+		$fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
79
+		if ($this_model_obj->get($fk_on_this_model->get_name()) != $other_model_obj->ID()) {
80
+			// set that field on the other model to this model's ID
81
+			$this_model_obj->set($fk_on_this_model->get_name(), $other_model_obj->ID());
82
+			$this_model_obj->save();
83
+		}
84
+		return $other_model_obj;
85
+	}
86 86
 
87 87
 
88
-    /**
89
-     * Sets the this model object's foreign key to its default, instead of pointing to the other model object
90
-     *
91
-     * @param EE_Base_Class|int $this_obj_or_id
92
-     * @param EE_Base_Class|int $other_obj_or_id
93
-     * @param array             $where_query
94
-     * @return \EE_Base_Class
95
-     * @throws \EE_Error
96
-     */
97
-    public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
98
-    {
99
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
100
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id);
101
-        // find the field on the other model which is a foreign key to this model
102
-        $fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
103
-        // set that field on the other model to this model's ID
104
-        $this_model_obj->set($fk_on_this_model->get_name(), null, true);
105
-        $this_model_obj->save();
106
-        return $other_model_obj;
107
-    }
88
+	/**
89
+	 * Sets the this model object's foreign key to its default, instead of pointing to the other model object
90
+	 *
91
+	 * @param EE_Base_Class|int $this_obj_or_id
92
+	 * @param EE_Base_Class|int $other_obj_or_id
93
+	 * @param array             $where_query
94
+	 * @return \EE_Base_Class
95
+	 * @throws \EE_Error
96
+	 */
97
+	public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
98
+	{
99
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
100
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id);
101
+		// find the field on the other model which is a foreign key to this model
102
+		$fk_on_this_model = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
103
+		// set that field on the other model to this model's ID
104
+		$this_model_obj->set($fk_on_this_model->get_name(), null, true);
105
+		$this_model_obj->save();
106
+		return $other_model_obj;
107
+	}
108 108
 
109 109
 
110
-    /**
111
-     * Overrides parent so that we don't NEED to save the $model_object before getting the related objects.
112
-     *
113
-     * @param EE_Base_Class $model_obj_or_id
114
-     * @param array         $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
115
-     * @param boolean       $values_already_prepared_by_model_object @deprecated since 4.8.1
116
-     * @return EE_Base_Class[]
117
-     * @throws \EE_Error
118
-     */
119
-    public function get_all_related(
120
-        $model_obj_or_id,
121
-        $query_params = array(),
122
-        $values_already_prepared_by_model_object = false
123
-    ) {
124
-        if ($values_already_prepared_by_model_object !== false) {
125
-            EE_Error::doing_it_wrong(
126
-                'EE_Model_Relation_Base::get_all_related',
127
-                esc_html__('The argument $values_already_prepared_by_model_object is no longer used.', 'event_espresso'),
128
-                '4.8.1'
129
-            );
130
-        }
131
-        // get column on this model object which is a foreign key to the other model
132
-        $fk_field_obj = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
133
-        // get its value
134
-        if ($model_obj_or_id instanceof EE_Base_Class) {
135
-            $model_obj = $model_obj_or_id;
136
-        } else {
137
-            $model_obj = $this->get_this_model()->ensure_is_obj($model_obj_or_id);
138
-        }
139
-        $ID_value_on_other_model = $model_obj->get($fk_field_obj->get_name());
140
-        // get all where their PK matches that value
141
-        $query_params[0][ $this->get_other_model()->get_primary_key_field()->get_name() ] = $ID_value_on_other_model;
142
-        $query_params                                                                   = $this->_disable_default_where_conditions_on_query_param($query_params);
110
+	/**
111
+	 * Overrides parent so that we don't NEED to save the $model_object before getting the related objects.
112
+	 *
113
+	 * @param EE_Base_Class $model_obj_or_id
114
+	 * @param array         $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
115
+	 * @param boolean       $values_already_prepared_by_model_object @deprecated since 4.8.1
116
+	 * @return EE_Base_Class[]
117
+	 * @throws \EE_Error
118
+	 */
119
+	public function get_all_related(
120
+		$model_obj_or_id,
121
+		$query_params = array(),
122
+		$values_already_prepared_by_model_object = false
123
+	) {
124
+		if ($values_already_prepared_by_model_object !== false) {
125
+			EE_Error::doing_it_wrong(
126
+				'EE_Model_Relation_Base::get_all_related',
127
+				esc_html__('The argument $values_already_prepared_by_model_object is no longer used.', 'event_espresso'),
128
+				'4.8.1'
129
+			);
130
+		}
131
+		// get column on this model object which is a foreign key to the other model
132
+		$fk_field_obj = $this->get_this_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
133
+		// get its value
134
+		if ($model_obj_or_id instanceof EE_Base_Class) {
135
+			$model_obj = $model_obj_or_id;
136
+		} else {
137
+			$model_obj = $this->get_this_model()->ensure_is_obj($model_obj_or_id);
138
+		}
139
+		$ID_value_on_other_model = $model_obj->get($fk_field_obj->get_name());
140
+		// get all where their PK matches that value
141
+		$query_params[0][ $this->get_other_model()->get_primary_key_field()->get_name() ] = $ID_value_on_other_model;
142
+		$query_params                                                                   = $this->_disable_default_where_conditions_on_query_param($query_params);
143 143
 //      echo '$query_params';
144 144
 //      var_dump($query_params);
145
-        return $this->get_other_model()->get_all($query_params);
146
-    }
145
+		return $this->get_other_model()->get_all($query_params);
146
+	}
147 147
 }
Please login to merge, or discard this patch.