[eluser]nottRobin[/eluser]
I installed PHP 5.3.2 just so I could take advantages of namespaces. Then I added "namespace Model;" to the top of my Model class.
Code:
namespace Model;
class Model_participant extends \DataMapper {
var $table = 'participant';
var $has_one = array('organisation' => array('class' => 'organisation', 'other_field' => 'participant'));
}
/* End of file model_participant.php */
And changed the reference to it:
Code:
class Participant extends Controller {
function index() {
$p = new \Model\Model_participant();
$p->get(); // No error :)
}
}
/* End of file participant.php */
However, I get this error:
Code:
Fatal error: Class 'Model\Model_participant' not found in /path/to/application/controllers/participant.php on line 22
After much investigation I discovered that the reason for this is that the class Model_participant doesn't actually get loaded at compile-time. It somehow gets stored by DMZ until it's needed and then loaded. And DMZ thinks it's called Model_participant, not Model\Model_participant.
I don't think there's an easy solution to this so I should probably give up. If anyone does have any suggestions please go ahead and let me know
Robin.