-
Notifications
You must be signed in to change notification settings - Fork 194
Model Marks
Jeff Johns edited this page Feb 4, 2014
·
2 revisions
Model | Extends | Table | Path |
---|---|---|---|
Marks_Model | Plain_Model | marks | /application/models/marks_model.php |
$this->load->model('marks_model', 'marks');
Property | Visibility | Default Value | Description |
---|---|---|---|
$sort | Public | created_on DESC | The default sort direction for reads. |
Called automatically which in turn calls the parent constructor and sets the model $data_types
properties.
Used to create new records in the marks table.
Variable | Type | Default | Required | Description |
---|---|---|---|---|
$options | array | array() | Yes | An associative array that contains the column names and the values for the record to be created. Array keys are the column names for each value. |
$options['title'] | string | N/A/td> | Yes | The title for the mark. |
$options['url'] | string | N/A/td> | Yes | The full url for the mark. |
$this->load->model('marks_model', 'marks');
$mark = $this->marks->create(array('title' => $title, 'url' => $url));
// If mark was created
if (isset($mark->mark_id)) {
// Good to go
}
// Some sort of validation error
elseif (isset($mark['errors']) {
// Validation errors were found
}
// Some sort of database write error, check logs
else {
// will return false
}