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

  • Home
  • SEARCH
  • 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 6230747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:48:29+00:00 2026-05-24T09:48:29+00:00

My action: public function executeEdit(sfWebRequest $request) { // Get the object $article = $this->getRoute()->getObject();

  • 0

My action:

public function executeEdit(sfWebRequest $request)
{
    // Get the object
    $article = $this->getRoute()->getObject();

    // Create the form
    $this->form = new ArticleEditForm( $article );
}

You can see that $article is the Doctrine Collection that gets passed to the Form as default values. The $article object contains a fields like “title”, “text”, “author”, etc.

But this causes an error in the Form creation:

500 | Internal Server Error | Doctrine_Record_UnknownPropertyException
Unknown record property / related component "_csrf_token" on "article"

So basically, the form is trying to use the Doctrine Collection to fill out default values for the form elements. But there obviously isn’t a csrf_token in that object… But it’s still trying to find one to use as the default value…

And what happens if you have a form where there are always extra empty fields that are empty but others have default values that are passed. If those empty fields don’t have set values in the Doctrine Collection then you get an error…

Now, obviously I could just make a simple array ahead of time where I specify the default values and pass that:

$defaults = array( 'title' => $article->title, 'text' => $article->text, 'author' => $article->author );
$this->form = new ArticleEditForm( $defaults);

This works. My problem is that the above “article” is an example for simplicity reasons. In reality my form has about 30 fields in it. So the only way that this solution would work is to have to manually specify 30 individual default values in an array. This is a poor solution from a maintenance point-of-view, obviously.

I figure the Symfony developers are smart enough to come up with a good solution but I just can’t find it… Any clues?

  • 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-24T09:48:30+00:00Added an answer on May 24, 2026 at 9:48 am

    I discovered my problem. My custom form was extending BaseForm. Once I changed this to extend BaseArticleForm then I was able to successfully pass article Doctrine Collections in as default values.

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

Sidebar

Related Questions

this action is generated in symfony 1.2 when you create a module: public function
For example I have: public function executeTestOne(sfWebRequest $request) { $this->value = Doctrine::getTable('Test')->createQuery('a')->where('id = ?',
I created the following interface: <?php interface Action { public function execute(\requests\Request $request, array
This is my action class public Iterator<CgConsultant> getSearchresult() { List<CgConsultant> list =userSearch.getConsultantMatches(searchstring); System.out.println(The size
I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
The following code is in the /Courses/Detail action: [AcceptVerbs(GET)] public ActionResult Detail(int id) {
What is considered better style for an event definition: public event Action<object, double> OnNumberChanged;
This is what I want to do: class IndexController extends Zend_Controller_Action { public function
For every new controller and action I create, Zend expects a template file in
On my controller I have the following Action: public function indexAction() { $teamDao =

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.