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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:14:42+00:00 2026-05-24T12:14:42+00:00

I have a little disturbing problem in here! an using symfony 1.4 with Doctrine!

  • 0

I have a little disturbing problem in here!
an using symfony 1.4 with Doctrine!
i fact i have a “many to many” relation (see code bellow) but i don’t have the RIGHT result!

     Monitor:
  actAs:
    Timestampable: ~
  columns:
    label: {type: string(45)}
    url: {type: string(80)}
    frequency: {type: integer}
    timeout: {type: integer}
    method: {type: enum, values: [GET, POST]}
    parameters: {type: string(255)}
  relations:
    Server:
      foreignAlias: Servers
      refClass: Benchmark
      local: monitor_id
      foreign: server_id

Server:
  actAs:
    Timestampable: ~
  columns:
    name: string(255)
    ip: string(255)
  relations:
     Monitor:
      foreignAlias: Monitors
      refClass: Benchmark
      local: server_id
      foreign: monitor_id

Benchmark:
  actAs:
    Timestampable: ~
  columns:
    monitor_id: { type: integer, primary: true }
    server_id: { type: integer, primary: true }
    connexionTime: {type: string(45)}
    executionTime: {type: string(45)}
    responseTime: {type: string(45)}
    responseCode: {type: string(45)}
    responseMessage: {type: string(45)}
  relations:
    Monitor:
      local: monitor_id
      foreign: id
      foreignAlias: Monitors
    Server:
      local: server_id
      foreign: id
      foreignAlias: Servers

1- when in the add server (or monitor) interface there is a list of monitors (or servers) that appears (but i can add a server(or monitor) without selecting it.

2- when in the add benchmark interface, i don’t have the monitors and servers list in order to select them! and when i submit i doesn’t work (it should’nt any way!). i get this error:

500 | Internal Server Error | Doctrine_Connection_Mysql_Exception
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`sfmonitoring`.`benchmark`, CONSTRAINT `benchmark_monitor_id_monitor_id` FOREIGN KEY (`monitor_id`) REFERENCES `monitor` (`id`))

i have this code in the BaseBenchmarkForm class

    abstract class BaseBenchmarkForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'monitor_id'      => new sfWidgetFormInputHidden(),
      'server_id'       => new sfWidgetFormInputHidden(),
      'connexionTime'   => new sfWidgetFormInputText(),
      'executionTime'   => new sfWidgetFormInputText(),
      'responseTime'    => new sfWidgetFormInputText(),
      'responseCode'    => new sfWidgetFormInputText(),
      'responseMessage' => new sfWidgetFormInputText(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'monitor_id'      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('monitor_id')), 'empty_value' => $this->getObject()->get('monitor_id'), 'required' => false)),
      'server_id'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('server_id')), 'empty_value' => $this->getObject()->get('server_id'), 'required' => false)),
      'connexionTime'   => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'executionTime'   => new sfValidatorString(array('max_length' => 45, 'required' => false)),

ANY IDEAS GUYS ??????
Pleaaaaaase am really Blocked !

############################################### V2

Thank you for the Help, it really means to me!
I did theses transformations:

 Monitor:
      tableName: monitor
      actAs:
        Timestampable: ~
      columns:
        label: {type: string(45)}
        url: {type: string(80)}
        frequency: {type: integer}
        timeout: {type: integer}
        method: {type: enum, values: [GET, POST]}
        parameters: {type: string(255)}

    Benchmark:
      actAs:
        Timestampable: ~
      columns:
        monitor_id: { type: integer, primary: true }
        server_id: { type: integer, primary: true }
        connexionTime: {type: string(45)}
        executionTime: {type: string(45)}
        responseTime: {type: string(45)}
        responseCode: {type: string(45)}
        responseMessage: {type: string(45)}
      relations:
        Monitor: { onDelete: CASCADE, local: monitor_id, foreign: id, foreignAlias: Monitors }
        Server: { onDelete: CASCADE, local: server_id, foreign: id, foreignAlias: Servers }

    Server:
      actAs:
        Timestampable: ~
      columns:
        name: string(255)
        ip: string(255)  

But in the benchmark “new” interface, i still don’t get the servers and the monitors list!

  • 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-24T12:14:43+00:00Added an answer on May 24, 2026 at 12:14 pm

    Okay, take two: The (SQL) error your getting means that the Benchmark you want to save, has an invalid monitor_id. So it’s either empty or refers to a non-existing monitor.

    This probably happens because you didn’t select a monitor/server, because they were invisible on the form (they are rendered as sfWidgetFormInputHidden).
    To show the <select>s for these two, you have to go to the BenchmarkForm (which overrides the BaseBenchmarkForm, and override the configure() method. Something like this:

    public function configure() {
      parent::configure();
      $this->widgetSchema['monitor_id'] = sfWidgetFormDoctrineChoice(array('model' => 'Monitor'));
      $this->widgetSchema['server_id'] = sfWidgetFormDoctrineChoice(array('model' => 'Server'));
    
      $this->validatorSchema['monitor_id'] = sfValidatorDoctrineChoice(array('model' => 'Monitor'));
      $this->validatorSchema['server_id'] = sfValidatorDoctrineChoice(array('model' => 'Server'));
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little problem in my iPhone application code but can not identify. please
I'm have little problem in retrieving the data from a table here's the code:
i have little problem in using my application application having msaccess database if i
I have little code like: using (WebClient wc = new WebClient()) { wc.Proxy =
Hey most of my issue has been solved but i have little problem This
I have little problem. In first method of my code I've loaded data about
I have little bit longer question for you - but hope answer will be
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,
I have little issue with detecting internet connection while using static IP on device.

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.