ORM::create PHP Method

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 )
    public function create($data = null)
    {
        $this->_is_new = true;
        if (!is_null($data)) {
            return $this->hydrate($data)->force_all_dirty();
        }
        return $this;
    }

Usage Example

Example #1
0
 public function createmodels()
 {
     if (!auth::check(self::AUTH_REALM)) {
         $this->access_denied();
     }
     $created = 0;
     $models = $this->getModels();
     foreach ($models as $id => $model) {
         if (!$model['status']) {
             $created++;
             $filename = substr($model['info']['basename'], 0, strpos($model['info']['basename'], '.xml'));
             ORM::create($filename);
         }
     }
     $this->msg = "<strong>{$created} models</strong> created successfuly.";
     $this->database();
 }
All Usage Examples Of ORM::create
ORM