From: Iain Patterson Date: Wed, 10 Apr 2013 16:41:41 +0000 (-0400) Subject: Fix foreign key constraints. X-Git-Tag: 2013-04-10~4 X-Git-Url: http://git.iain.cx/?p=readifood.git;a=commitdiff_plain;h=7910a9551304a4789ba1fde0c85eeaf5bb21003b Fix foreign key constraints. OrderState references a contact ID rather than a user. Foreign keys must be explicitly set as NULL from Propel. --- diff --git a/lib/order.php b/lib/order.php index 74306d9..5c7e0d8 100644 --- a/lib/order.php +++ b/lib/order.php @@ -377,6 +377,7 @@ $hub_id = $_POST['hub_id']; $quantity = $_POST['quantity']; $driver_id = $_POST['driver_id']; + if (! $driver_id) $driver_id = null; $state = $_POST['state']; if (! $state) $state = $GLOBALS['STATE_PLACED']; @@ -406,6 +407,7 @@ return false; } } + else $hub_id = null; if (! is_numeric($quantity)) { echo "

Invalid quantity!

\n"; diff --git a/propel/schema.xml b/propel/schema.xml index b6a4804..62658f5 100644 --- a/propel/schema.xml +++ b/propel/schema.xml @@ -158,7 +158,7 @@ - +