protected function add(array $directions)
 {
     $insertCnt = 0;
     $version = TableUpdate::getVersion();
     foreach ($directions as $d) {
         $boundParams = array($this->route->getId(), $d->getTitle(), $this->getPrettyTitle($d->getTitle()), $d->getName(), $this->getPrettyName($d->getName()), $d->getTag(), $d->getUseForUi() ? 1 : 0, $d->getShow() ? 1 : 0, $version);
         //var_dump($boundParams);
         $this->dbObj->bindParams($boundParams);
         $query = "INSERT INTO direction (route_id, title, pretty_title,\n                name, pretty_name, tag, use_for_ui, show, version, created_date)\n                VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())";
         $this->dbObj->query($query);
         //$this->dbObj->debug();
         //print $query;
         if ($this->dbObj->rows_affected != 1) {
             throw new DBException("Addition of direction failed [agency:" . $this->route->getAgency()->getId() . "] [route tag:" . $this->route->getTag() . "] [route title:" . $this->route->getTitle() . "]");
         }
         $insertCnt++;
     }
     //TODO: Add a log for the total number of directions added
     //Write the changes to the change log
     $this->saveChangesToFile();
 }
 /**
  * Determine changes between two routes with the same tag
  * 
  * @param Route $o - Old value
  * @param Route $n - New value
  * @return Array - of changes
  */
 protected function dataUpdated(Route $o, Route $n)
 {
     $changes = array();
     if ($o->getTitle() != $n->getTitle()) {
         $changes["title"] = $o->getTitle() . " | " . $n->getTitle();
     }
     if ($o->getShortTitle() != $n->getShortTitle()) {
         $changes["short title"] = $o->getShortTitle() . " | " . $n->getShortTitle();
     }
     if ($o->getColor() != $n->getColor()) {
         $changes["color"] = $o->getColor() . " | " . $n->getColor();
     }
     if ($o->getLatMax() != $n->getLatMax()) {
         $changes["lat max"] = $o->getLatMax() . " | " . $n->getLatMax();
     }
     if ($o->getLatMin() != $n->getLatMin()) {
         $changes["lat min"] = $o->getLatMin() . " | " . $n->getLatMin();
     }
     if ($o->getLonMax() != $n->getLonMax()) {
         $changes["lon max"] = $o->getLonMax() . " | " . $n->getLonMax();
     }
     if ($o->getLonMin() != $n->getLonMin()) {
         $changes["lon min"] = $o->getLonMin() . " | " . $n->getLonMin();
     }
     if ($o->getVehicleType() != $n->getVehicleType()) {
         $changes["vehicle type"] = $o->getVehicleType() . " | " . $n->getVehicleType();
     }
     /*
     if($o->getPosition() != $n->getPosition()) {
         $changes["position"] = $o->getPosition(). " | " .$n->getPosition();
     }
     */
     return $changes;
 }