| @@ 68-70 (lines=3) @@ | ||
| 65 | * @return EEM_Base | EEM_Soft_Delete_Base |
|
| 66 | */ |
|
| 67 | public function model() { |
|
| 68 | if( ! $this->_model instanceof EEM_Base ) { |
|
| 69 | throw new EE_Error( sprintf( __( 'Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso' ), get_class( $this ) ) ); |
|
| 70 | } |
|
| 71 | return $this->_model; |
|
| 72 | } |
|
| 73 | ||
| @@ 43-45 (lines=3) @@ | ||
| 40 | if(isset($options_array['model']) && $options_array['model'] instanceof EEM_Base){ |
|
| 41 | $this->_model = $options_array['model']; |
|
| 42 | } |
|
| 43 | if( ! $this->_model || ! $this->_model instanceof EEM_Base ){ |
|
| 44 | throw new EE_Error(sprintf(__("Model Form Sections must first specify the _model property to be a subclass of EEM_Base", "event_espresso"))); |
|
| 45 | } |
|
| 46 | ||
| 47 | if(isset($options_array['subsection_args'])){ |
|
| 48 | $subsection_args = $options_array['subsection_args']; |
|
| @@ 334-336 (lines=3) @@ | ||
| 331 | * the new entry on insert; 0 on failure |
|
| 332 | */ |
|
| 333 | public function save(){ |
|
| 334 | if( ! $this->_model_object){ |
|
| 335 | throw new EE_Error(sprintf(__("Cannot save the model form's model object (model is '%s') because there is no model object set. You must either set it, or call receive_form_submission where it is set automatically", "event_espresso"),get_class($this->_model))); |
|
| 336 | } |
|
| 337 | $success = $this->_model_object->save(); |
|
| 338 | foreach($this->_model->relation_settings() as $relation_name => $relation_obj){ |
|
| 339 | if(isset($this->_subsections[$relation_name])){ |
|
| @@ 810-812 (lines=3) @@ | ||
| 807 | ||
| 808 | $this->_model = EE_Registry::instance()->load_model( $this->_model_name ); |
|
| 809 | ||
| 810 | if ( ! $this->_model instanceof EEM_Base ) { |
|
| 811 | throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class. Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) ); |
|
| 812 | } |
|
| 813 | } |
|
| 814 | ||
| 815 | ||