Fosrestbundle: [SF3.4] "Symfony\Component\Validator\Constraints" ๋„ค์ž„์ŠคํŽ˜์ด์Šค์—์„œ "NotNull" ํด๋ž˜์Šค ๋กœ๋“œ ์‹œ๋„

์— ๋งŒ๋“  2018๋…„ 01์›” 11์ผ  ยท  4์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: FriendsOfSymfony/FOSRestBundle

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

Validator ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๊นŒ?

๋ชจ๋“  4 ๋Œ“๊ธ€

์ปจํŠธ๋กค๋Ÿฌ ์ฝ”๋“œ:

```
/**
* ์ด๋ฉ”์ผ/๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ†ตํ•ด ์‹œ์Šคํ…œ์— ๋กœ๊ทธ์ธํ•˜๊ณ  ๋ณด์•ˆ ํ† ํฐ์„ ๋ฐ›์Šต๋‹ˆ๋‹ค.
* @Rest\View()
* @Route("/user/login.{_format}",defaults={"_format": "json"})
* @๋ฉ”์†Œ๋“œ("ํฌ์ŠคํŠธ")
*
* @RequestParam(name="apikey", ์š”๊ตฌ ์‚ฌํ•ญ="[a-zA-Z0-9]{32}", allowBlank=false, strict=true, description="์‘์šฉ ํ”„๋กœ๊ทธ๋žจ API ํ‚ค")
* @RequestParam(name="email", requirements=".+@.+..+", allowBlank=false, strict=true, description="์‚ฌ์šฉ์ž์˜ ์ด๋ฉ”์ผ ์ฃผ์†Œ")
* @RequestParam(name="password", requirements=".{4,30}", allowBlank=false, strict=true, description="์‚ฌ์šฉ์ž ๋น„๋ฐ€๋ฒˆํ˜ธ")
* @param ParamFetcher $paramFetcher
* @param ์š”์ฒญ $request
* @param LoggerInterface $logger
* @return ์‘๋‹ต
* ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ์‹คํŒจ ์‹œ @throws HttpException
*/
๊ณต๊ฐœ ํ•จ์ˆ˜ postLoginAction(ParamFetcher $paramFetcher, ์š”์ฒญ $request, LoggerInterface $logger)
{

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

[2018-01-11 16:13:57] php.CRITICAL: 'Symfony\Component\Validator\Constraints\NotNull' ํด๋ž˜์Šค๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. {"์˜ˆ์™ธ":"[๊ฐ์ฒด] (Symfony\Component\Debug\Exception\FatalThrowableError( ์ฝ”๋“œ: 0): 'Symfony\Component\Validator\Constraints\NotNull' ํด๋ž˜์Šค๊ฐ€ /home/eross/myp/vendor/friendsofsymfony/rest-bundle/Controller/Annotations/AbstractParam.php:75)์—์„œ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."} []
[2018-01-11 16:13:57] request.CRITICAL: ์žกํžˆ์ง€ ์•Š์€ PHP ์˜ˆ์™ธ Symfony\Component\Debug\Exception\ClassNotFoundException: ""Symfony\Component\Validator\Constraints" ๋„ค์ž„์ŠคํŽ˜์ด์Šค์—์„œ "NotNull" ํด๋ž˜์Šค๋ฅผ ๋กœ๋“œํ•˜๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์ด๋ฆ„ ๊ณต๊ฐ„์— ๋Œ€ํ•œ "use" ๋ฌธ์„ ์žŠ์œผ์…จ์Šต๋‹ˆ๊นŒ?" /home/eross/myp/vendor/friendsofsymfony/rest-bundle/Controller/Annotations/AbstractParam.php ์ค„ 75 {"์˜ˆ์™ธ":"[๊ฐ์ฒด] (Symfony\Component\Debug\Exception\ClassNotFoundException(์ฝ”๋“œ: 0): \"Symfony\Component\Validator\Constraints\" ๋„ค์ž„์ŠคํŽ˜์ด์Šค์—์„œ \"NotNull\" ํด๋ž˜์Šค๋ฅผ ๋กœ๋“œํ•˜๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค.\n/home/eross/myp/vendor/friendsofsymfony/์—์„œ ๋‹ค๋ฅธ ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ๋Œ€ํ•œ \"use\" ๋ฌธ์„ ์žŠ์–ด๋ฒ„๋ ธ์Šต๋‹ˆ๊นŒ? ๋‚˜๋จธ์ง€ ๋ฒˆ๋“ค/์ปจํŠธ๋กค๋Ÿฌ/์ฃผ์„/AbstractParam.php:75)"} []
```

Validator ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๊นŒ?

์•„, ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ, ๊ทธ๊ฒŒ ์ œ๊ฐ€ ํ•„์š”ํ•œ ์ „๋ถ€์˜€์Šต๋‹ˆ๋‹ค.

composer require symfony/validator

์–ด๋–ป๊ฒŒ๋“  ์ œ์•ˆํ•ด์•ผ ํ•˜์ง€ ์•Š์„๊นŒ์š”?

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰