Search code examples
phpsymfony1doctrinesymfony-1.4

Symfony backend: specific test on field before insert


am using the symfony's admin generator, in the "new" interface, i have one specific field that i want to test before insert into database, and if it doesn't pass i return the user to the same interface until he gets the right value ! can any body tell me how it can be done?

for the one who voted down on my question : am not looking for a simple validator, what i want is that a url field i check whether it IP existe in my DB and then add it (avoid adding all external urls)


Solution

  • Reading your question an your comment on the negative vote, is clear that you need a custom validator class. You need to create a custom validator [link] and make it do what you want it to do.

    What I understood from your question, is that you want to get the IP address from a URL and check if the IP address exists in the DB, Symfony doesn't have a built in validator for something like this. That is why you need to create the validator yourself.