'controller_prefix' => 'Controller\\',
namespace Controller\Rest\awesome
<?php
namespace Controller\Rest\Common\Exceptions;
class TokenExpiredException extends \Exception
{
}
namespace Controller\Rest\awesome;
use Controller\Rest\Common\Exception;
class Authentication extends \Controller\Rest\Common\Base
{
public function authentication()
{
throw new \TokenExpiredException("Token expired!");
}
}
Its gives me Class 'TokenExpiredException' not found
The only way I can do is the following?
use Controller\Rest\Common\Exceptions as Exceptions;
then call Exceptions\TokenExpiredException("Token expired!");
I just want to be like C# or Java, define using the namespace then I can call the classes within the namespace
use Controller\Rest\Common\Exception;
it will use the namespace. If, however, you want to use the TokenExpiredException
class from that namespace (and just that) then you would have touse Controller\Rest\Common\Exception\TokenExpiredException;
\throw new \TokenExpiredCollection('Token Expired')
will work just fine.use Controller\Rest\Common\Exception\TokenExpiredException;
\throw new \TokenExpiredCollection('Token Expired')
It looks like you're new here. If you want to get involved, click one of these buttons!