title: Codeigniter - using getters/setters to pass the value from controller to model
body: <p>I would like to use getters/setters to store and retrieve values in my Model.Below is my Controller and Model code. I would like to know its a standard right way to do that? </p>
  
  <p>CONTROLLER CODE: </p>
  
  <pre><code>  public function saveevent() {
  
    $this-&gt;event_model-&gt;setEvent_title($this-&gt;input-&gt;post('event_title'));
    $this-&gt;event_model-&gt;setSms_description($this-&gt;input-&gt;post('sms_description'));
    $event_id = $this-&gt;event_model-&gt;saveEvent();
   }
  </code></pre>
  
  <p>MODEL CODE: </p>
  
  <pre><code>class Event_Model extends CI_Model{
  
  private $id;
  private $event_title;
  private $sms_description;
  
  function __construct() {
      parent::__construct();
  }
  
  public function getId() {
      return $this-&gt;id;
  }
  
  public function setId($id) {
      $this-&gt;id = $id;
  }
  
  public function getEvent_title() {
      return $this-&gt;event_title;
  }
  
  public function setEvent_title($event_title) {
      $this-&gt;event_title = $event_title;
  }
  
  public function getSms_description() {
      return $this-&gt;sms_description;
  }
  
  public function setSms_description($sms_description) {
      $this-&gt;sms_description = $sms_description;
  }
  
  public function saveEvent() {
      $data = array(
          'title' =&gt; $this-&gt;getEvent_title() ,
          'sms_description' =&gt; $this-&gt;getSms_description() 
      );
  
      $this-&gt;db-&gt;insert('events', $data);
      return $this-&gt;db-&gt;insert_id();
  }
  }
  </code></pre>