Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5989421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:05:55+00:00 2026-05-22T23:05:55+00:00

i am trying to build an custom validator with symfony2 but something strange happens:

  • 0

i am trying to build an custom validator with symfony2 but something strange happens:

i have created both Password and PasswordValidate by following the steps in symfony2 cookbook but first time when i load the page i get this error:

AnnotationException: [Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\Password" in property NMSP\MyBundle\Entity\User::$password does not exist, or could not be auto-loaded. 

after reloading the error disappears and the validation still not fires and it return the code is valid.

here is the relevant code:

//annotation declaration:
/**
 * @ORM\Column(type="string", length="32", unique="true")
 * 
 * @Assert\MinLength(3)
 * @Assert\Password2()
 */
protected $password;

//load files with the following in the code
services:
  validator.password:
    class: NMSP\MyBundle\Validator\PasswordValidator
    tags:
        - { name: validator.constraint_validator, alias: password }

can`t figure this one out:(

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:05:56+00:00Added an answer on May 22, 2026 at 11:05 pm

    Assuming your custom validator constraint is not in the Symfony\Component\Validator\Constraints namespace, but your own namespace: NMSP\MyBundle\Validator.

    You should add the following use statement:

    use NMSP\MyBundle\Validator as NMSPAssert;
    

    Then use the following annotation on the $username property:

    @NMSPAssert\Password()
    

    That should do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a custom segue, but i can't seem to get the
I'm trying to build a menu using a UItableView with Custom cells which have
I'm trying to build a custom framework but for some reason, there is never
I have been trying to build a custom uitableview swipe. I am successful in
I am trying to build site with custom script. I have problem with allowing
I'm trying to build a custom gem I wrote called client_package but it is
I'm trying to build a custom clock view in Android. See image http://twitpic.com/1devk7 So
I'm fairly new to Android, and am trying to build a custom component in
I'm trying to build my own custom django form widgets (putting them in widgets.py
I am trying to add some custom build steps to my headless build process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.