If I have this class:
<?php
class Model
{
var $db;
function Model()
{
$this->db=new Db_Class();
}
}
?>
and a second class that extended the parent class:
<?php
class LessonModel extends Model
{
public function LessonModel()
{
//code here
}
public function getTitle($id)
{
$this->db->setTable('myTable');
return $this->db->get('title',$id);
}
}
?>
Is it safe to assume that the $LessonModel->db
field would have been instantiated by the parent Model
class's constructor, or do I need to run it manually using something like parent::Model();
?