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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:46:18+00:00 2026-05-26T11:46:18+00:00

I need to modify Admin Generator’s Doctrine Form which is included by: $this->embedRelation(‘MyRelation’); The

  • 0

I need to modify Admin Generator’s Doctrine Form which is included by:

$this->embedRelation('MyRelation');

The default layout looks like this:

Screenshot 1

The goal – every Item of Select should be displayed as text in separate row, plus Price and Quantity:

Screenshot 2

schema.yml

Game:
    actAs:
      Timestampable: ~
    columns:
      id: { type: integer(4), primary: true, autoincrement: true, unsigned: true }
      game_name: { type: string(100), notnull: true }
    indexes:
      it:
  fields: game_name
  type: unique

  Campaign:
    actAs:
      Timestampable: ~
    columns:
      id: { type: integer(4), primary: true, autoincrement: true, unsigned: true }
      name: { type: string(100), notnull: true }
      is_active: { type: boolean, notnull: true, default: 0 }
      start: { type: datetime, notnull: true }
      end: { type: datetime, notnull: true }
    relations:
      CampaignMatrix: { onDelete: CASCADE, local: id, foreign: campaign_id, foreignAlias: CampaignMatrixCampaign }

  CampaignGames:
    actAs:
      Timestampable: ~
    columns:
      id: { type: integer(4), primary: true, autoincrement: true, unsigned: true }
      campaign_id: { type: integer(4), notnull: true, unsigned: true }
      game_id: { type: integer(4), notnull: true, unsigned: true }
    indexes:
      tc:
  fields: [campaign_id, game_id]
  type: unique
    relations:
      Campaign: { onDelete: CASCADE, local: campaign_id, foreign: id, foreignAlias: CampaignCampaignGames }
      Game: { onDelete: CASCADE, local: game_id, foreign: id, foreignAlias: GameCampaignGames }

  CampaignMatrix:
    actAs:
      Timestampable: ~
    columns:
      id: { type: integer(4), primary: true, autoincrement: true, unsigned: true }
      item_id: { type: integer(4), notnull: true, unsigned: true }
      campaign_id: { type: integer(4), notnull: true, unsigned: true }
      price_id: { type: integer(4), notnull: true, unsigned: true }
      quantity: { type: integer(4), notnull: true, unsigned: true }
    relations:
      Item: { onDelete: CASCADE, local: item_id, foreign: id, foreignAlias: ItemCampaignMatrix }
      Campaign: { onDelete: CASCADE, local: campaign_id, foreign: id, foreignAlias: CampaignCampaignMatrix }
      Price: { onDelete: CASCADE, local: price_id, foreign: id, foreignAlias: PriceItems }

  Price:
    columns:
      id: { type: integer(4), unsigned: true }
      currency_code: { type: string(3), notnull: true }
      price: { type: float, notnull: true }
    indexes:
      tc:
  fields: [id, currency_code]
  type: unique

  Item:
    actAs:
      Timestampable: ~
      I18n:
  fields: [name, description, image]
    columns:
      id: { type: integer(4), primary: true, autoincrement: true, unsigned: true }
      game_id: { type: integer(4), notnull: true, unsigned: true }
      product_id: { type: string(100), notnull: true }
      price_id: { type: integer(4), notnull: true, unsigned: true }
      quantity: { type: integer(4), notnull: true, unsigned: true }
      name: { type: string(100), notnull: true }
      description: { type: string(255), notnull: true }
      image: { type: string(255), notnull: true }
    indexes:
      it:
  fields: item_type
    relations:
      Game: { onDelete: CASCADE, local: game_id, foreign: id, foreignAlias: GameItems }
      Price: { onDelete: CASCADE, local: price_id, foreign: id, foreignAlias: PriceItems }

This is how I do it:

$list = MainItemTable::getInstance()->findByGameId($gameId);

$CampaignMatrix = new CampaignMatrix();

foreach($list as $index => $item) {

    $itemAssocForm = new CampaignMatrixForm($CampaignMatrix);
    $itemAssocForm->item_id = $item->getId(); // Need it in the form as hidden field
    $this->embedForm($item->getProductId(), $itemAssocForm);
}

And this is how I’m trying to get the value:

$this->widgetSchema['item_id'] = new sfWidgetFormInputText(array(), array('value' => $this->item_id)); // It doesn't get the Id

But I have an error:
Fatal error: Maximum execution time of 30 seconds exceeded in /vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Relation/Parser.php on line 237

  1. If I unset price_id in CampaignMatrixForm, no error produced. How to avoid execution of select of the same data for every item row in the loop?
  2. Item id is missing, but I need it as hidden field. How to pass CampaignMatrix ID of current row to CampaignMatrixForm?
  • 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-26T11:46:19+00:00Added an answer on May 26, 2026 at 11:46 am

    You have to iterate on association to emebed the association form to the main form. It mays be simple if you post a part of your schema.yml.

    Try to re-use this snippet :

    $list = MyRelatedObjectTable::getInstance()->findAll();
    
    foreach($list as $item)
    {
      $itemAssoc = AssociationTable::getInstance()->findByObjectId($this->object->id, $item->id);
    
      if(!$itemAssoc)
      {
        $itemAssoc = new Association();
        $itemAssoc->value_id = $itemAssoc->id;
        $itemAssoc->user_id = $this->object->id;
      }
    
      $itemAssocForm = new AssociationForm($itemAssoc);
      $this->embedForm('itemAssoc'.$item->code, $itemAssocForm);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to modify the Django Admin interface. I need a custom type of
Got a c#.net app which I need to modify. The query at the moment
I have a modified admin form, where I added a field that shall modify
i need to modify an xml document which has multiple namespaces. my code runs
In the admin interface of Magento I need to modify the tables in the
I need to modify a (xml-)file from Apache Ant. loadfile task allows to load
I need to modify the following MySQL statement to include information from a third
I need to modify the contents of the child rows of a hierarchical Infragistics
I need to modify an MSI file, and I'd like to do it in
I need to modify the lm (or eventually loess ) function so I can

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.