Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony 1.4/doctrine schema.yml many to many relations does'nt work properly?
    text
    copied!<p>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!</p> <pre><code> 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 </code></pre> <p>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.</p> <p>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:</p> <pre><code>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`)) </code></pre> <p>i have this code in the <strong>BaseBenchmarkForm</strong> class </p> <pre><code> abstract class BaseBenchmarkForm extends BaseFormDoctrine { public function setup() { $this-&gt;setWidgets(array( 'monitor_id' =&gt; new sfWidgetFormInputHidden(), 'server_id' =&gt; new sfWidgetFormInputHidden(), 'connexionTime' =&gt; new sfWidgetFormInputText(), 'executionTime' =&gt; new sfWidgetFormInputText(), 'responseTime' =&gt; new sfWidgetFormInputText(), 'responseCode' =&gt; new sfWidgetFormInputText(), 'responseMessage' =&gt; new sfWidgetFormInputText(), 'created_at' =&gt; new sfWidgetFormDateTime(), 'updated_at' =&gt; new sfWidgetFormDateTime(), )); $this-&gt;setValidators(array( 'monitor_id' =&gt; new sfValidatorChoice(array('choices' =&gt; array($this-&gt;getObject()-&gt;get('monitor_id')), 'empty_value' =&gt; $this-&gt;getObject()-&gt;get('monitor_id'), 'required' =&gt; false)), 'server_id' =&gt; new sfValidatorChoice(array('choices' =&gt; array($this-&gt;getObject()-&gt;get('server_id')), 'empty_value' =&gt; $this-&gt;getObject()-&gt;get('server_id'), 'required' =&gt; false)), 'connexionTime' =&gt; new sfValidatorString(array('max_length' =&gt; 45, 'required' =&gt; false)), 'executionTime' =&gt; new sfValidatorString(array('max_length' =&gt; 45, 'required' =&gt; false)), </code></pre> <p>ANY IDEAS GUYS ?????? Pleaaaaaase am really Blocked !</p> ############################################### V2 <p>Thank you for the Help, it really means to me! I did theses transformations: </p> <pre><code> 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) </code></pre> <p>But in the benchmark "new" interface, i still don't get the servers and the monitors list!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload