create() public method

Create a new, empty instance of the class. Used to add a new row to your database. May optionally be passed an associative array of data to populate the instance. If so, all fields will be flagged as dirty so all will be saved to the database when save() is called.
public create ( $data = null )
Beispiel #1
0
 /**
  * Wrap Idiorm's create method to return an
  * empty instance of the class associated with
  * this wrapper instead of the raw ORM class.
  */
 public function create($data = null)
 {
     $model = $this->_create_model_instance(parent::create(null));
     if ($data !== null) {
         $model->set($data);
     }
     return $model;
 }