Fosrestbundle: [SF3.4] Attempted to load class "NotNull" from namespace "Symfony\Component\Validator\Constraints"

Created on 11 Jan 2018  路  4Comments  路  Source: FriendsOfSymfony/FOSRestBundle

Most helpful comment

Did you install the Validator component?

All 4 comments

Controller code:

```
/**
* Login to the system via email/password and receive a security token.
* @Rest\View()
* @Route("/user/login.{_format}",defaults={"_format": "json"})
* @Method("POST")
*
* @RequestParam(name="apikey", requirements="[a-zA-Z0-9]{32}", allowBlank=false, strict=true, description="Application API Key")
* @RequestParam(name="email", requirements=".+@.+..+", allowBlank=false, strict=true, description="User's e-mail address")
* @RequestParam(name="password", requirements=".{4,30}", allowBlank=false, strict=true, description="User's password")
* @param ParamFetcher $paramFetcher
* @param Request $request
* @param LoggerInterface $logger
* @return Response
* @throws HttpException on application failure
*/
public function postLoginAction(ParamFetcher $paramFetcher, Request $request, LoggerInterface $logger)
{

Upon sending an API request, this results in an error like:

[2018-01-11 16:13:57] php.CRITICAL: Class 'Symfony\Component\Validator\Constraints\NotNull' not found {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'Symfony\Component\Validator\Constraints\NotNull' not found at /home/eross/myp/vendor/friendsofsymfony/rest-bundle/Controller/Annotations/AbstractParam.php:75)"} []
[2018-01-11 16:13:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "NotNull" from namespace "Symfony\Component\Validator\Constraints". Did you forget a "use" statement for another namespace?" at /home/eross/myp/vendor/friendsofsymfony/rest-bundle/Controller/Annotations/AbstractParam.php line 75 {"exception":"[object] (Symfony\Component\Debug\Exception\ClassNotFoundException(code: 0): Attempted to load class \"NotNull\" from namespace \"Symfony\Component\Validator\Constraints\".\nDid you forget a \"use\" statement for another namespace? at /home/eross/myp/vendor/friendsofsymfony/rest-bundle/Controller/Annotations/AbstractParam.php:75)"} []
```

Did you install the Validator component?

Ahh, thank you, yes that's all I needed apparently.

composer require symfony/validator

Shouldn't it be somehow suggested?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dkorsak picture dkorsak  路  5Comments

JeroenDeDauw picture JeroenDeDauw  路  6Comments

MissbachMichael picture MissbachMichael  路  7Comments

feridmovsumov picture feridmovsumov  路  7Comments

matrix818181 picture matrix818181  路  7Comments