Пример #1
0
 public function saveDistanceList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['distance_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(DistancePeer::DISTANCETYPE_ID, $this->object->getPrimaryKey());
     DistancePeer::doDelete($c, $con);
     $values = $this->getValue('distance_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new Distance();
             $obj->setDistancetypeId($this->object->getPrimaryKey());
             $obj->setTrackAId($value);
             $obj->save();
         }
     }
 }