So I am aware of the implementation of the PSR-0 standard in Kohana 3.3 . However, there must be something I am not understanding as I am getting a class not found error for the following code:
$model = Model::factory('MyModel');
the model definition is located at:
classes/Model/MyModel.php
How is it that my class is not being found exactly?
Actual Code:
Model located at classes/Model/VoiceTalent.php
<?php defined('SYSPATH') or die('No direct script access.');
class VoiceTalent
{
//methods and fields
}
Controller Code:
$talent = Model::factory('VoiceTalent');
Exact Error Message:
ErrorException [ Fatal Error ]: Class 'Model_VoiceTalent' not found
SYSPATH\classes\Kohana\Model.php [ 26 ]
Your class is badly named.
You have:
class VoiceTalent
Should be:
class Model_VoiceTalent
as you have to include all folders it is contained within (separated by _
) in the class name. In this case you just need to add Model_
prefix. You can read more about class naming convention in Kohana's docs.