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 573919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:46:32+00:00 2026-05-13T13:46:32+00:00

N00b question: I’m using Symfony with Doctrine. I have a form where I’ve added

  • 0

N00b question:

I’m using Symfony with Doctrine. I have a form where I’ve added a little Jquery & Ajax check of whether a username that has been inputted into the form already exists. The jQuery calls a short PHP script on my web root that does the MySQL database check and returns true/false, which is then used to determine what error message to show.

However, if possible, I’d like to move the database call to a symfony helper function that then returns the true/false, rather having all the connection info etc on my web root. But I can’t seem to be able to call the helper function correctly – all other components of the functionality work fine.

This is what I’ve got in my little php script:

$availability = GenericHelper::checkUsername();  // a public static function
echo $availability; // returns true/false to Jquery

Anyone? Thanks.

  • 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-13T13:46:32+00:00Added an answer on May 13, 2026 at 1:46 pm

    Helpers are not meant for that sort of job (they are only meant for “view” related work, that is, generate html, etc).

    Instead your should create an action (either in the same controller as your form or in a dedicated ajax controller, I personaly find the first option more easily maintenable) that will do the username check using a method of the model. See http://gist.github.com/286797 for a code example on how to do that (please note this code has not been tested and therefore could not work ootb).

    You would then direct your Ajax query to that action.

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

Sidebar

Related Questions

I have a very simple (n00b) question. A 20-bit external address bus gave a
Y.A.N.Q. (yet another n00b question). I have managed to design my db, defining tables
Total n00b question here. I am using pgAdmin to attempt to administer a remote
This is probably a n00b question, but nontheless... I have a bit of a
This feels like an extremely n00b question, but here goes... I have a series
I have resisted asking this seemingly n00b question, but all my recent effort to
this is probably a n00b question, but I don't really have any experience in
Yeah, sorry about asking a stupid n00b question. So I have a C# program.
Totally n00b question, Im making my first ASP.NET website, with the added twist of
Here's a question from a Crystal n00b. Accessing a database using JDBC and using

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.