Guest User

Untitled

a guest
Jul 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. Monitor:
  2. actAs:
  3. Timestampable: ~
  4. columns:
  5. label: {type: string(45)}
  6. url: {type: string(80)}
  7. frequency: {type: integer}
  8. timeout: {type: integer}
  9. method: {type: enum, values: [GET, POST]}
  10. parameters: {type: string(255)}
  11. relations:
  12. Server:
  13. foreignAlias: Servers
  14. refClass: Benchmark
  15. local: monitor_id
  16. foreign: server_id
  17.  
  18. Server:
  19. actAs:
  20. Timestampable: ~
  21. columns:
  22. name: string(255)
  23. ip: string(255)
  24. relations:
  25. Monitor:
  26. foreignAlias: Monitors
  27. refClass: Benchmark
  28. local: server_id
  29. foreign: monitor_id
  30.  
  31. Benchmark:
  32. actAs:
  33. Timestampable: ~
  34. columns:
  35. monitor_id: { type: integer, primary: true }
  36. server_id: { type: integer, primary: true }
  37. connexionTime: {type: string(45)}
  38. executionTime: {type: string(45)}
  39. responseTime: {type: string(45)}
  40. responseCode: {type: string(45)}
  41. responseMessage: {type: string(45)}
  42. relations:
  43. Monitor:
  44. local: monitor_id
  45. foreign: id
  46. foreignAlias: Monitors
  47. Server:
  48. local: server_id
  49. foreign: id
  50. foreignAlias: Servers
  51.  
  52. 500 | Internal Server Error | Doctrine_Connection_Mysql_Exception
  53. 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`))
  54.  
  55. abstract class BaseBenchmarkForm extends BaseFormDoctrine
  56. {
  57. public function setup()
  58. {
  59. $this->setWidgets(array(
  60. 'monitor_id' => new sfWidgetFormInputHidden(),
  61. 'server_id' => new sfWidgetFormInputHidden(),
  62. 'connexionTime' => new sfWidgetFormInputText(),
  63. 'executionTime' => new sfWidgetFormInputText(),
  64. 'responseTime' => new sfWidgetFormInputText(),
  65. 'responseCode' => new sfWidgetFormInputText(),
  66. 'responseMessage' => new sfWidgetFormInputText(),
  67. 'created_at' => new sfWidgetFormDateTime(),
  68. 'updated_at' => new sfWidgetFormDateTime(),
  69. ));
  70.  
  71. $this->setValidators(array(
  72. 'monitor_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('monitor_id')), 'empty_value' => $this->getObject()->get('monitor_id'), 'required' => false)),
  73. 'server_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('server_id')), 'empty_value' => $this->getObject()->get('server_id'), 'required' => false)),
  74. 'connexionTime' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
  75. 'executionTime' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
  76.  
  77. Monitor:
  78. tableName: monitor
  79. actAs:
  80. Timestampable: ~
  81. columns:
  82. label: {type: string(45)}
  83. url: {type: string(80)}
  84. frequency: {type: integer}
  85. timeout: {type: integer}
  86. method: {type: enum, values: [GET, POST]}
  87. parameters: {type: string(255)}
  88.  
  89. Benchmark:
  90. actAs:
  91. Timestampable: ~
  92. columns:
  93. monitor_id: { type: integer, primary: true }
  94. server_id: { type: integer, primary: true }
  95. connexionTime: {type: string(45)}
  96. executionTime: {type: string(45)}
  97. responseTime: {type: string(45)}
  98. responseCode: {type: string(45)}
  99. responseMessage: {type: string(45)}
  100. relations:
  101. Monitor: { onDelete: CASCADE, local: monitor_id, foreign: id, foreignAlias: Monitors }
  102. Server: { onDelete: CASCADE, local: server_id, foreign: id, foreignAlias: Servers }
  103.  
  104. Server:
  105. actAs:
  106. Timestampable: ~
  107. columns:
  108. name: string(255)
  109. ip: string(255)
  110.  
  111. public function configure() {
  112. parent::configure();
  113. $this->widgetSchema['monitor_id'] = sfWidgetFormDoctrineChoice(array('model' => 'Monitor'));
  114. $this->widgetSchema['server_id'] = sfWidgetFormDoctrineChoice(array('model' => 'Server'));
  115.  
  116. $this->validatorSchema['monitor_id'] = sfValidatorDoctrineChoice(array('model' => 'Monitor'));
  117. $this->validatorSchema['server_id'] = sfValidatorDoctrineChoice(array('model' => 'Server'));
  118.  
  119. }
Add Comment
Please, Sign In to add comment