public static function Del($id) { $transport = ServTransport::model()->findAll('service_id=' . $id); if ($transport) { foreach ($transport as $mTrans) { ServTransportDeliv::model()->deleteAllByAttributes(array('serv_transport_id' => $mTrans->id)); ServTransportExtra::model()->deleteAllByAttributes(array('serv_transport_id' => $mTrans->id)); ServTransportTrip::model()->deleteAllByAttributes(array('serv_transport_id' => $mTrans->id)); } } ServTransport::model()->deleteAllByAttributes(array('service_id' => $id)); return true; }
<?php if ($service_id) { $curService = ServTransport::model()->findByAttributes(array('service_id' => $service_id)); ?> <input type="hidden" class="form-control" name="ServTransport[id]" value="<?php echo $curService->id; ?> " > <?php $partialData = array('service_id' => $curService->id); } else { $curService = false; } ?> <div class="row "> <div class="col-md-24"> <label class="control-label" for="serv-transport-deliv-city">Тип транспорта</label> </div> <div class="col-md-8"> <label class="control-label" for="serv-transport-deliv-city">Вместимость</label>