CodeIgniter Forums

Full Version: How is model/table inheritance supported in CI?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hello,

I've read the article on Models (http://ellislab.com/codeigniter/user-gui...odels.html) but I am still unsure how should I represent the following structure:

Code:
abstract class Object_model
{
   var $name;
   var $colour;
   var $texture;
}

class Cube_model extends Object_model
{
  var $sideLength;
}

class Sphere_nodel extends Object_model
{
  var $radius;
}

What would be the most common way of implementing the above within CodeIgniter?
Would I keep the above hierarchy along with a class-table inheritance?

Thanks in advance.

El Forum

[eluser]nmweb[/eluser]
Class-table-inheritance nor single-table-inheritance are natively supported in CI. Your code looks like a valid way to implement it but it will require a lot of work.