rendered paste body // Calculate $transportPrice
$c = new Criteria();
$c->add(TownsDistancesPeer::TOWN_A, 1);
$c->add(TownsDistancesPeer::TOWN_A, 2);
$row = TownsDistancesPeer::doSelectOne($c);
$transportPrice = $row->getDistance();
this will throw this error:
[wrapped: Could not execute query [Native Error: Unknown column 'towns_distances.ID' in 'field list'] [User Info: SELECT towns_distances.TOWN_A, towns_distances.TOWN_B, towns_distances.DISTANCE, towns_distances.ID FROM towns_distances WHERE towns_distances.TOWN_A=2 LIMIT 1]]
towns_distances:
town_a:
type: INTEGER
required: true
default:
foreignTable: town
foreignReference: id
onDelete: RESTRICT
onUpdate: RESTRICT
town_b:
type: INTEGER
required: true
default:
foreignTable: town
foreignReference: id
onDelete: RESTRICT
onUpdate: RESTRICT
distance:
type: FLOAT
required: true
default: 0
_indexes:
town_b:
- town_b
_uniques:
town_a:
- town_a
- town_b