Question

I have an issue where I seem to be unable to load a namespace that I have created. I have read a bit about namespaces on SO, but I can't see what I am missing in this case.

This is my calling code:

<?php

use \CRMPicco\User\AlertReminder;
$alert_reminder = new AlertReminder($userObj);

?>

This is my namespaced code:

<?php
namespace CRMPicco\User;

class AlertReminder
{

}

This is my error:

Fatal error: Class 'CRMPicco\User\AlertReminder' not found in /var/www/vhosts/dev/web/login.inc.php on line 324

Line 324 is the new AlertReminder line.

Was it helpful?

Solution

This was due to some classname cleansing in my custom autoloader, which prevented the class from loading.

I refactored the class into another package and it now works as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top