Вот моя модель:
Код: Выделить всё
class Custom_lesson extends Domain_class
{
//private $customSftObj = null;
public $customSftObj = null;
public $custom_sft = null;
public function __construct()
{
parent::__construct();
}
public function getCustomSft()
{
if (FALSE == empty($this->customSftObj))
return $this->customSftObj;
$customSftDAO = $this->loadDAO('custom_sft');
$this->customSftObj = $customSftDAO->find($this->custom_sft);
return $this->customSftObj;
}
public function getSft() {
return $this->getCustomSft();
}
public function doDestroy()
{
$custom_sft = $this->getCustomSft();
if ( $this->hasSM() )
unlink( custom_sft_path($custom_sft->owner_id, $custom_sft->subject, $custom_sft->grade) . 'lessons/_lesson_' . $this->id . '_SM.pdf' );
if ( $this->hasTM() )
unlink( custom_sft_path($custom_sft->owner_id, $custom_sft->subject, $custom_sft->grade) . 'lessons/_lesson_' . $this->id . '_TM.pdf' );
}
public function hasSM()
{
$custom_sft = $this->getCustomSft();
return file_exists( custom_sft_path($custom_sft->owner_id, $custom_sft->subject, $custom_sft->grade) . 'lessons/_lesson_' . $this->id . '_SM.pdf');
}
public function hasTM()
{
$custom_sft = $this->getCustomSft();
return file_exists( custom_sft_path($custom_sft->owner_id, $custom_sft->subject, $custom_sft->grade) . 'lessons/_lesson_' . $this->id . '_TM.pdf');
}
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/23572739/error-with-custom-model-trying-to-get-property-of-non-object-codeigniter-2-x[/url]