Email =============== Email Model This model defines automatic emails sent to users during their toolwatch adventure. ------------------ AUTOMATIC EMAILS ------------------ ADD_FIRST_WATCH : Send an email to registered users 48 hours after their sign up if they didn't add a watch CHECK_ACCURACY : Send an email 24 hours after an user synchronized a watch to remind him to take the second measure ADD_SECOND_WATCH : Send an email after this first completed measure if the user only has one registered watch CHECK_ACCURACY_1_WEEK : 1 week after a completed measure, we remind the user to check the precision again START_NEW_MEASURE : One month after a completed measure, we send a reminder to check the accuracy again ------------- EVENT EMAILS ------------- SIGN_UP : Classical email on signup (email of facebook) RESET_PASSWORD : Send a new password to users NEW_ACCURACY : Send an email after a complete measure with the measure accuracy. This is email has an .icc setting a calendar (iCal, Google Cal, ...) event. The event is for measuring the watch again in one month. Automatic emails are cron based. A call to hooks/emails is made at fixed intervals. Event emails are based on the observer pattern. This model observes other relevant model such as user of measure. * Class name: Email * Namespace: * Parent class: [MY_Model](MY_Model.md) Properties ---------- ### $ADD_FIRST_WATCH public mixed $ADD_FIRST_WATCH = 1 Constantes for emails ids. Theses ids are used to ensure that an email isn't sent twice for an user. * Visibility: **public** ### $CHECK_ACCURACY public mixed $CHECK_ACCURACY = 2 * Visibility: **public** ### $ADD_SECOND_WATCH public mixed $ADD_SECOND_WATCH = 3 * Visibility: **public** ### $START_NEW_MEASURE public mixed $START_NEW_MEASURE = 4 * Visibility: **public** ### $COMEBACK public mixed $COMEBACK = 5 * Visibility: **public** ### $START_FIRST_MEASURE public mixed $START_FIRST_MEASURE = 6 * Visibility: **public** ### $CHECK_ACCURACY_1_WEEK public mixed $CHECK_ACCURACY_1_WEEK = 7 * Visibility: **public** ### $idToType public mixed $idToType = array("ADD_FIRST_WATCH", "CHECK_ACCURACY", "ADD_SECOND_WATCH", "START_NEW_MEASURE", "COMEBACK", "START_FIRST_MEASURE", "CHECK_ACCURACY_1_WEEK") * Visibility: **public** ### $hour private mixed $hour = 3600 * Visibility: **private** ### $day private mixed $day = 86400 * Visibility: **private** ### $cancelledEmail private mixed $cancelledEmail = 1 * Visibility: **private** ### $timeOffset private mixed $timeOffset * Visibility: **private** ### $error public string $error = '' Stores custom errors that can be used in UI error reporting. * Visibility: **public** ### $table_name public string $table_name = '' The name of the db table this model primarily uses. * Visibility: **public** ### $key protected string $key = 'id' The primary key of the table. Used as the 'id' throughout. * Visibility: **protected** ### $created_field protected string $created_field = 'created_on' Field name to use for the created time column in the DB table if $set_created is enabled * Visibility: **protected** ### $modified_field protected string $modified_field = 'modified_on' Field name to use for the modified time column in the DB table if $set_modified is enabled * Visibility: **protected** ### $deleted_field protected string $deleted_field = 'deleted' Field name to use for the deleted column in the DB table if $soft_deletes is enabled * Visibility: **protected** ### $set_created protected boolean $set_created = false Whether or not to auto-fill the $created_field on inserts. * Visibility: **protected** ### $set_modified protected boolean $set_modified = false Whether or not to auto-fill the $modified_field on updates. * Visibility: **protected** ### $date_format protected string $date_format = 'datetime' The type of date/time field used for $created_field and $modified_field Valid values are 'int', 'datetime', 'date' * Visibility: **protected** ### $soft_deletes protected boolean $soft_deletes = false If false, the delete() method will perform a delete of that row. If true, the value in $deleted_field will be set to 1. * Visibility: **protected** ### $selects protected string $selects = '' Stores any selects here for use by the find* functions. * Visibility: **protected** ### $escape protected boolean $escape = true If false, the select() method will not try to protect your field or table names with backticks. This is useful if you need a compound select statement. * Visibility: **protected** ### $db_con protected mixed $db_con = '' DB Connection details (string or array) * Visibility: **protected** ### $before_insert protected array $before_insert = array() Observer Arrays Each array can contain the names of callback functions within the extending model which will be called during each event. $before_insert = array('set_created', 'validate_fields'); $before_insert contains the names of callback functions within the extending model which will be called before the insert method. * Visibility: **protected** ### $after_insert protected array $after_insert = array() Contains the names ozf callback functions within the extending model which will be called after the insert method * Visibility: **protected** ### $before_update protected array $before_update = array() Contains the names of callback functions within the extending model which will be called before the update method * Visibility: **protected** ### $after_update protected array $after_update = array() Contains the names of callback functions within the extending model which will be called after the update method * Visibility: **protected** ### $before_find protected array $before_find = array() Contains the names of callback functions within the extending model which will be called before the find method * Visibility: **protected** ### $after_find protected array $after_find = array() Contains the names of callback functions within the extending model which will be called after the find method * Visibility: **protected** ### $before_union_all protected array $before_union_all = array() Contains the names of callback functions within the extending model which will be called before the union_all method * Visibility: **protected** ### $after_union_all protected array $after_union_all = array() Contains the names of callback functions within the extending model which will be called after the union_all method * Visibility: **protected** ### $before_delete protected array $before_delete = array() Contains the names of callback functions within the extending model which will be called before the delete method * Visibility: **protected** ### $after_delete protected array $after_delete = array() Contains the names of callback functions within the extending model which will be called after the delete method * Visibility: **protected** ### $empty_validation_rules protected array $empty_validation_rules = array() Contains the names of callback functions within the extending model which will be called if $validation_rules is empty (or not an array) when requested via the get_validation_rules() method. Note: These methods should not add $insert_validation_rules, as they are added to the $validation_rules after these functions return. * Visibility: **protected** ### $protected_attributes protected array $protected_attributes = array() Protected, non-modifiable attributes * Visibility: **protected** ### $return_type protected string $return_type = 'object' By default, we return items as objects. You can change this for the entire class by setting this value to 'array' instead of 'object'. Alternatively, you can do it on a per-instance basis using the 'as_array()' and 'as_object()' methods. * Visibility: **protected** ### $temp_return_type protected string $temp_return_type = null Holds the return type temporarily when using the as_array() and as_object() methods * Visibility: **protected** ### $validation_rules protected Array $validation_rules = array() * Visibility: **protected** ### $insert_validation_rules protected Array $insert_validation_rules = array() * Visibility: **protected** ### $skip_validation protected boolean $skip_validation = false * Visibility: **protected** ### $return_insert_id protected boolean $return_insert_id = true * Visibility: **protected** ### $field_info protected Array $field_info = array() * Visibility: **protected** ### $pending_selects protected array $pending_selects = array() This array will be populated with selects and mainly use for union based query. * Visibility: **protected** Methods ------- ### __construct void CI_Model::__construct() Class constructor * Visibility: **public** * This method is defined by [CI_Model](CI_Model.md) ### updateObserver mixed Email::updateObserver(\MY_MODEL $subject, String $event, Array $data) Obverved model call this method one something noticieable happen on their side. This method will send event emails * Visibility: **public** #### Arguments * $subject **MY_MODEL** - <p>An instance of the model calling</p> * $event **String** - <p>Which event has been triggered</p> * $data **Array** - <p>data related to the event</p> ### cronCheck Array Email::cronCheck($timeOffset) Check which emails should be sent now according to the email specifications * Visibility: **public** #### Arguments * $timeOffset **mixed** - <p>seconds to add or retrieve to time().</p> ### showSentEmails mixed Email::showSentEmails(Array $emails, String $title) Convenient function to display the emails being generated by cronCheck * Visibility: **private** #### Arguments * $emails **Array** * $title **String** - <p>A nice title to distinguish between email types</p> ### insertAll mixed Email::insertAll(Array $array, \MY_MODEL $model) Helper method to batch insert in a model * Visibility: **private** #### Arguments * $array **Array** - <p>data to batch insert</p> * $model **MY_MODEL** - <p>Model to insert</p> ### sendMandrillEmail Array Email::sendMandrillEmail(String $subject, \html $content, String $recipientName, String $recipientEmail, String $tags, String $sendAt, \Base64 $attachments) Send an email throught the mandrill api * Visibility: **private** #### Arguments * $subject **String** * $content **html** * $recipientName **String** * $recipientEmail **String** * $tags **String** - <p>One tag for the email to see it in the Mandrill backend</p> * $sendAt **String** - <p>The date at which to send the email</p> * $attachments **Base64** - <p>A Base64 representation of an attachment</p> ### sendAtString String Email::sendAtString(\Long $scheduleTime) Helper method to convert a timestamp in a Mandrill valid string * Visibility: **private** #### Arguments * $scheduleTime **Long** - <p>timestamp</p> ### whereNotAlreadySentUser String Email::whereNotAlreadySentUser(integer $emailType) Helper thate created a subquery on email_user and emailType * Visibility: **private** #### Arguments * $emailType **integer** - <p>The type of the email to look for</p> ### whereNotAlreadySentWatch String Email::whereNotAlreadySentWatch(integer $emailType) Helper thate created a subquery on email_watch and emailType * Visibility: **private** #### Arguments * $emailType **integer** - <p>The type of the email to look for</p> ### whereNotAlreadySentMeasure String Email::whereNotAlreadySentMeasure(integer $emailType) Helper thate created a subquery on email_measure and emailType * Visibility: **private** #### Arguments * $emailType **integer** - <p>The type of the email to look for</p> ### addEmailToQueue mixed Email::addEmailToQueue(Array $queue, integer $userId, integer $emailType, \long $time, integer $idTitle, \html $content, array $mandrillResponse) Add a computed email to a $queue. * Visibility: **private** #### Arguments * $queue **Array** - <p>Received by reference and will be updated</p> * $userId **integer** * $emailType **integer** * $time **long** * $idTitle **integer** * $content **html** * $mandrillResponse **array** ### inactiveUser mixed Email::inactiveUser(\long $time, array $queuedEmail) Send email to incative user * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### userWithoutWatch mixed Email::userWithoutWatch(\long $time, array $queuedEmail) Send email to user who don't have any watch * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### userWithWatchWithoutMeasure mixed Email::userWithWatchWithoutMeasure(\long $time, array $queuedEmail) Send email to user witch a watch but without measure * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### userWithOneCompleteMeasureAndOneWatch mixed Email::userWithOneCompleteMeasureAndOneWatch(\long $time, array $queuedEmail) Send email to user With One Complet eMeasure And One Watch * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### checkAccuracy mixed Email::checkAccuracy(\long $time, array $queuedEmail) Send email to user that need to check their accuracy * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### checkAccuracyOneWeek mixed Email::checkAccuracyOneWeek(\long $time, array $queuedEmail) Send email to user to check their accuracy 1 week after * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### startANewMeasure mixed Email::startANewMeasure(\long $time, array $queuedEmail) Send email to user to start a new measure * Visibility: **private** #### Arguments * $time **long** - <p>Time at which compute the rule</p> * $queuedEmail **array** - <p>queue to store the computed email</p> ### signup Array Email::signup(\User $user) Send the welcome email * Visibility: **private** #### Arguments * $user **[User](User.md)** - <p>The newly created user</p> ### resetPassword mixed Email::resetPassword(\User $user, String $token) Send a password token for reset $user * Visibility: **private** #### Arguments * $user **[User](User.md)** * $token **String** ### newResult mixed Email::newResult(\Measure $measure) Send an email with the result of a measure * Visibility: **private** #### Arguments * $measure **[Measure](Measure.md)** ### find mixed MY_Model::find(string $id) Search for a single row in the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $id **string** - <p>The primary key of the record to search for.</p> ### find_all mixed MY_Model::find_all() Returns all records in the table. By default, there is no 'where' clause, but the where clause can be set by using either CodeIgniter's Active Record functions before calling this function, or through method chaining with the model's where() method. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### find_union_all mixed MY_Model::find_union_all() Returns all of unions, the $pending_selects value has to be populated trhought the union conveniant method * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### find_all_by boolean|mixed MY_Model::find_all_by(mixed $field, mixed $value, string $type) A convenience method that combines a where() and find_all() call into a single call. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** - <p>The table field to search in.</p> * $value **mixed** - <p>The value that field should be.</p> * $type **string** - <p>The type of where clause to create: 'and' or 'or'.</p> ### find_by boolean|mixed MY_Model::find_by(string $field, string $value, string $type) Returns the first result that matches the field/values passed. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **string** - <p>Either a string or an array of fields to match against. If an array is passed it, the $value parameter is ignored since the array is expected to have key/value pairs in it.</p> * $value **string** - <p>The value to match on the $field. Only used when $field is a string.</p> * $type **string** - <p>The type of where clause to create: 'and' or 'or'.</p> ### insert boolean|mixed MY_Model::insert(array $data) Insert a row of data into the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $data **array** - <p>an array of key/value pairs to insert.</p> ### insert_batch boolean MY_Model::insert_batch(array $data) Perform a batch insert of data into the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $data **array** - <p>an array of key/value pairs to insert.</p> ### update_table boolean MY_Model::update_table(mixed $where, array $data, $table) Update an existing row in the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $where **mixed** - <p>The primary_key value of the row to update, or an array to use for the where clause.</p> * $data **array** - <p>An array of key/value pairs to update.</p> * $table **mixed** ### update boolean MY_Model::update(mixed $where, array $data) Update an existing row in the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $where **mixed** - <p>The primary_key value of the row to update, or an array to use for the where clause.</p> * $data **array** - <p>An array of key/value pairs to update.</p> ### increment boolean MY_Model::increment(mixed $where, $field) Increment a field. Mostly use for views, likes and so on. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $where **mixed** - <p>The primary_key value of the row to update, or an array to use for the where clause.</p> * $field **mixed** ### decrement boolean MY_Model::decrement(mixed $where, $field) Decrement a field. Mostly use for views, likes and so on. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $where **mixed** - <p>The primary_key value of the row to update, or an array to use for the where clause.</p> * $field **mixed** ### update_where boolean MY_Model::update_where(string $field, string $value, array $data) A convenience method that allows use of any field/value pair as the 'where' portion of an update. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **string** - <p>The field to match on.</p> * $value **string** - <p>The value to search the $field for.</p> * $data **array** - <p>An array of key/value pairs to update.</p> ### update_batch boolean MY_Model::update_batch(array $data, string $index) Updates a batch of existing rows in the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $data **array** - <p>An array of key/value pairs to update.</p> * $index **string** - <p>The name of the db column to use as the where key</p> ### delete boolean MY_Model::delete(mixed $id) Delete the record with the specified primary key value. If $this->soft_deletes is true, it will attempt to set $this->deleted_field on the specified record to '1', to allow the data to remain in the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $id **mixed** - <p>The primary_key value to match against.</p> ### delete_where boolean MY_Model::delete_where($where) Delete the record(s) specified by the given field/value pair(s). Performs a delete using the field/value pair(s) as the 'where' portion of the delete statement. If $this->soft_deletes is true, it will attempt to set $this->deleted_field on the specified record(s) to '1', to allow the data to remain in the database. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $where **mixed** ### is_unique boolean MY_Model::is_unique(string $field, string $value) Check whether a field/value pair exists within the table. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **string** - <p>The name of the field to search</p> * $value **string** - <p>The value to match $field against.</p> ### count_by boolean|integer MY_Model::count_by(string $field, string $value) Return the number of elements that match the field/value pair. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **string** - <p>The field to search for.</p> * $value **string** - <p>The value to match $field against.</p> ### get_field boolean|mixed MY_Model::get_field(mixed $id, string $field) A convenience method to return only a single field of the specified row. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $id **mixed** - <p>The primary_key value to match against.</p> * $field **string** - <p>The field to search for.</p> ### format_dropdown array MY_Model::format_dropdown() A convenience method to return options for form dropdown menus. Can pass either Key ID and Label Table names or Just Label Table name. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### where \FF_Model MY_Model::where(mixed $field, string $value, $escape) Sets the where portion of the query in a chainable format. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** - <p>The field to search the db on. Can be either a string with the field name to search, or an associative array of key/value pairs.</p> * $value **string** - <p>The value to match the field against. If $field is an array, this value is ignored.</p> * $escape **mixed** ### order_by \FF_Model MY_Model::order_by(mixed $field, string $order) Inserts a chainable order_by method from either a string or an array of field/order combinations. If the $field value is an array, it should look like: array( 'field1' => 'asc', 'field2' => 'desc' ); * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** - <p>The field to order the results by, or an array of field/order pairs.</p> * $order **string** - <p>The direction to order the results ('asc' or 'desc')</p> ### soft_delete \FF_Model MY_Model::soft_delete(boolean $val) Set the value of the soft deletes flag. $this->my_model->soft_delete(true)->delete($id); * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $val **boolean** - <p>If true, will temporarily use soft_deletes.</p> ### as_array \FF_Model MY_Model::as_array() Temporarily set the return type to an array. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### as_object \FF_Model MY_Model::as_object() Temporarily sets the return type to an object. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### as_json \FF_Model MY_Model::as_json() Temporarily sets the object return to a json object. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### return_insert_id \FF_Model MY_Model::return_insert_id(Bool $return) Sets the value of the return_insert_id flag * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $return **Bool** - <p>(optional) whether insert will return the ID</p> ### skip_validation \FF_Model MY_Model::skip_validation(Bool $skip) Sets the value of the skip_validation flag * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $skip **Bool** - <p>(optional) whether to skip validation in the model</p> ### created_on array MY_Model::created_on(array $row) Sets the created date for the row Uses the current date/time, the model's date_format, and places the value in the model's created_field. Will not overwrite existing. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $row **array** - <p>The array of data to be inserted</p> ### modified_on array MY_Model::modified_on(array $row) Sets the modified date for the row Uses the current date/time, the model's date_format, and places the value in the model's modified_field. Will not overwrite existing. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $row **array** - <p>The array of data to be inserted</p> ### trigger mixed MY_Model::trigger(string $event, mixed $data) Triggers a model-specific event and calls each of its observers. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $event **string** - <p>The name of the event to trigger</p> * $data **mixed** - <p>The data to be passed to the callback functions.</p> ### get_validation_rules array MY_Model::get_validation_rules(String $type) Get the validation rules for the model * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $type **String** - <p>The type of validation rules to retrieve: 'update' or 'insert'. If 'insert', appends rules set in $insert_validation_rules.</p> ### validate \array/bool MY_Model::validate(array $data, string $type) Validate the $data passed into it Uses the form_validation rules setup in $this->validation_rules. If $type == 'insert', any additional rules in $insert_validation_rules for that field will be added to the rules. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $data **array** - <p>An array of data to validate</p> * $type **string** - <p>Either 'update' or 'insert'.</p> ### protect_attributes mixed MY_Model::protect_attributes(\object/array $row) Protect attributes by removing them from $row array. Useful for removing the primary key, or submit button names if $_POST is thrown at the model. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $row **object/array** - <p>The value pair item to remove.</p> ### set_date integer|null|string MY_Model::set_date(mixed $user_date) A utility function to allow child models to use the type of date/time format that they prefer. This is primarily used for setting created_on and modified_on values, but can be used for other fields as well. The available time formats are: * 'int' - Stores the date as an integer timestamp. * 'datetime' - Stores the date and time in the SQL datetime format. * 'date' - Stores teh date (only) in the SQL date format. * Visibility: **protected** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $user_date **mixed** - <p>An optional PHP timestamp to be converted.</p> ### _return_type string MY_Model::_return_type($multi) Return the method name for the current return type * Visibility: **protected** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $multi **mixed** ### get_db_error_message string MY_Model::get_db_error_message() Retrieve error messages from the database * Visibility: **protected** * This method is defined by [MY_Model](MY_Model.md) ### set_table void MY_Model::set_table(string $table) Allows setting the table to use for all methods during runtime. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $table **string** - <p>The table name to use (do not include the prefix!)</p> ### get_table string MY_Model::get_table() Get the table name * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_key string MY_Model::get_key() Get the table's primary key * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_created_by_field String MY_Model::get_created_by_field() Get the name of the created by field * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_created_field String MY_Model::get_created_field() Get the name of the created field * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_deleted_field String MY_Model::get_deleted_field() Get the name of the deleted field * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_deleted_by_field String MY_Model::get_deleted_by_field() Get the name of the deleted by field * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_field_info array MY_Model::get_field_info() Get the metadata for the model's database fields Returns the model's database field metadata stored in $this->field_info if set, else it tries to retrieve the metadata from $this->db->field_data($this->table_name); * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_modified_by_field String MY_Model::get_modified_by_field() Get the name of the modified by field * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### get_modified_field String MY_Model::get_modified_field() Get the name of the modified field * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### set_date_format boolean MY_Model::set_date_format(string $format) Sets the date_format to use for setting created_on and modified_on values. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $format **string** - <p>String describing format. Valid values are: 'int', 'datetime', 'date'</p> ### set_modified boolean MY_Model::set_modified(boolean $modified) Sets whether to auto-create modified_on dates in the update method. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $modified **boolean** ### set_soft_deletes boolean MY_Model::set_soft_deletes(boolean $soft) Sets whether soft deletes are used by the delete method. * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $soft **boolean** ### logit mixed MY_Model::logit(string $message, string $level) Logs an error to the Console (if loaded) and to the log files. * Visibility: **protected** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $message **string** - <p>The string to write to the logs.</p> * $level **string** - <p>The log level, as per CI log_message method.</p> ### prep_data Array MY_Model::prep_data(Array $post_data) Extracts the model's fields (except the key and those handled by Observers) from the $post_data and returns an array of name => value pairs * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $post_data **Array** - <p>The post data, usually $this->input->post() when called from the controller</p> ### raw_sql mixed MY_Model::raw_sql($sql) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $sql **mixed** ### select mixed MY_Model::select($select, $escape) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $select **mixed** * $escape **mixed** ### select_max mixed MY_Model::select_max($select, $alias) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $select **mixed** * $alias **mixed** ### select_min mixed MY_Model::select_min($select, $alias) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $select **mixed** * $alias **mixed** ### select_avg mixed MY_Model::select_avg($select, $alias) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $select **mixed** * $alias **mixed** ### select_sum mixed MY_Model::select_sum($select, $alias) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $select **mixed** * $alias **mixed** ### distinct mixed MY_Model::distinct($val) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $val **mixed** ### from mixed MY_Model::from($from) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $from **mixed** ### join mixed MY_Model::join($table, $cond, $type) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $table **mixed** * $cond **mixed** * $type **mixed** ### union mixed MY_Model::union($select) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $select **mixed** ### or_where mixed MY_Model::or_where($key, $value, $escape) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $value **mixed** * $escape **mixed** ### where_in mixed MY_Model::where_in($key, $values) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $values **mixed** ### or_where_in mixed MY_Model::or_where_in($key, $values) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $values **mixed** ### where_not_in mixed MY_Model::where_not_in($key, $values) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $values **mixed** ### or_where_not_in mixed MY_Model::or_where_not_in($key, $values) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $values **mixed** ### like mixed MY_Model::like($field, $match, $side) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** * $match **mixed** * $side **mixed** ### nto_like mixed MY_Model::nto_like($field, $match, $side) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** * $match **mixed** * $side **mixed** ### or_like mixed MY_Model::or_like($field, $match, $side) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** * $match **mixed** * $side **mixed** ### or_not_like mixed MY_Model::or_not_like($field, $match, $side) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $field **mixed** * $match **mixed** * $side **mixed** ### group_by mixed MY_Model::group_by($by) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $by **mixed** ### having mixed MY_Model::having($key, $value, $escape) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $value **mixed** * $escape **mixed** ### or_having mixed MY_Model::or_having($key, $value, $escape) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $value **mixed** * $escape **mixed** ### limit mixed MY_Model::limit($value, $offset) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $value **mixed** * $offset **mixed** ### offset mixed MY_Model::offset($offset) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $offset **mixed** ### set mixed MY_Model::set($key, $value, $escape) * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) #### Arguments * $key **mixed** * $value **mixed** * $escape **mixed** ### affected_rows mixed MY_Model::affected_rows() * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### last_query mixed MY_Model::last_query() * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### truncate mixed MY_Model::truncate() * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### inserted_id mixed MY_Model::inserted_id() * Visibility: **public** * This method is defined by [MY_Model](MY_Model.md) ### __get mixed CI_Model::__get(string $key) __get magic Allows models to access CI's loaded classes using the same syntax as controllers. * Visibility: **public** * This method is defined by [CI_Model](CI_Model.md) #### Arguments * $key **string**