Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.4
-
Fix Version/s: None
-
Component/s: Relations
-
Labels:None
-
Environment:linux, apache2, php 5.3
Description
Ok, so the object relations go like this:
- Comparison
- [1:N] Product (FK:comparison_id)
- [1:N] Rules (FK:product_id, FK:option_id)
- [1:N] Parameters (FK:product_id)
- [1:N] Options (FK:parameter_id)
- [1:N] Product (FK:comparison_id)
The testing code looks like following:
== CODE START ==
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save();
== CODE END ==
The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE.
Activity
Grzegorz Godlewski
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
Ok, so the object relations go like this:
- Comparison - [1:N] Product (FK:comparison_id) - [1:N] Rules (FK:product_id, FK:option_id) - [1:N] Parameters (FK:product_id) - [1:N] Options (FK:parameter_id) The testing code looks like following: == CODE START == $comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save(); == CODE END == The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE. |
Ok, so the object relations go like this:
- Comparison - [1:N] Product (FK:comparison_id) - [1:N] Rules (FK:product_id, FK:option_id) - [1:N] Parameters (FK:product_id) - [1:N] Options (FK:parameter_id) The testing code looks like following: == CODE START == {{ $comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save(); }} == CODE END == The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE. |
Grzegorz Godlewski
made changes -
| Description |
Ok, so the object relations go like this:
- Comparison - [1:N] Product (FK:comparison_id) - [1:N] Rules (FK:product_id, FK:option_id) - [1:N] Parameters (FK:product_id) - [1:N] Options (FK:parameter_id) The testing code looks like following: == CODE START == {{ $comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save(); }} == CODE END == The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE. |
Ok, so the object relations go like this:
- Comparison - [1:N] Product (FK:comparison_id) - [1:N] Rules (FK:product_id, FK:option_id) - [1:N] Parameters (FK:product_id) - [1:N] Options (FK:parameter_id) The testing code looks like following: == CODE START == {code:php} $comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save(); {code} == CODE END == The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE. |
Grzegorz Godlewski
made changes -
| Description |
Ok, so the object relations go like this:
- Comparison - [1:N] Product (FK:comparison_id) - [1:N] Rules (FK:product_id, FK:option_id) - [1:N] Parameters (FK:product_id) - [1:N] Options (FK:parameter_id) The testing code looks like following: == CODE START == {code:php} $comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save(); {code} == CODE END == The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE. |
Ok, so the object relations go like this:
* Comparison ** [1:N] Product (FK:comparison_id) *** [1:N] Rules (FK:product_id, FK:option_id) *** [1:N] Parameters (FK:product_id) **** [1:N] Options (FK:parameter_id) The testing code looks like following: == CODE START == {code:php} $comp = new Application_Model_Comparison(); /* Filling $comp with data */ for ($i = 0; $i < 10; $i++) { $product = new Application_Model_Product(); // Options referenced in Rules $options = array(); for ($j = 0; $j < 10; $j++) { $param = new Application_Model_Parameter(); for ($k = 0; $k < 10; $k++) { $option = new Application_Model_Option(); $param->Options->add($option); // Register a single option for this parameter if (!isset($options[$j])) { $options[$j] = $option; } } $product->Parameters->add($param); } for ($j = 0; $j < 10; $j++) { $rule = new Application_Model_Rule(); $rule->Option = $options[$j]; $product->Rules->add($rule); } $comp->Products->add($product); } /** * The first save() goes nicely, all objects * are created (INSERTed) */ $comp->save(); // Remove every second product $pCount = $comp->Products->count(); for ($i = 0; $i < $pCount; $i += 2) { $comp->Products->remove($i); } /** * Fails while trying to save * * Comparison->Product->Parameter->Option * INSERT ... `parameter_id` cannot be NULL * * Comparison->Product->Rule * INSERT ... `product_id` cannot be NULL */ $comp->save(); {code} == CODE END == The first save() cleans up the relation information in the graph. All child objects are INSERTED instead of UPDATE. |