Skip to content

Commit

Permalink
[ci skip] Add a note about entities in model docs, and fix the simple…
Browse files Browse the repository at this point in the history
… Entity class. Fixes #499
  • Loading branch information
lonnieezell committed May 19, 2017
1 parent 0a4703b commit bbb3bbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions user_guide_src/source/database/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ CodeIgniter does provide a model class that provides a few nice features, includ
- automatic database connection
- basic CRUD methods
- in-model validation
- automatic pagination
- and more

This class provides a solid base from which to build your own models, allowing you to
Expand Down Expand Up @@ -316,15 +317,15 @@ simplest, they might look like this::

public function __get($key)
{
if (isset($this->$key))
if (property_exists($this, $key))
{
return $this->$key;
}
}

public function __set($key, $value)
{
if (isset($this->$key))
if (property_exists($this, $key))
{
$this->$key = $value;
}
Expand Down Expand Up @@ -355,6 +356,9 @@ model's ``save()`` method to inspect the class, grab any public and private prop
// Save the changes
$model->save($job);

.. note:: If you find yourself working with Entities a lot, CodeIgniter provides a built-in :doc:`Entity class </database/entities>`
that provides several handy features that make developing Entities simpler.

Deleting Data
-------------

Expand Down

0 comments on commit bbb3bbc

Please sign in to comment.