/** * Resets all references to other model objects or collections of model objects. * * This method is a user-space workaround for PHP's inability to garbage collect * objects with circular references (even in PHP 5.3). This is currently necessary * when using Propel in certain daemon or large-volume/high-memory operations. * * @param boolean $deep Whether to also clear the references on all referrer objects. */ public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collCustomerss) { foreach ($this->collCustomerss as $o) { $o->clearAllReferences($deep); } } if ($this->collProdusens) { foreach ($this->collProdusens as $o) { $o->clearAllReferences($deep); } } if ($this->collSuppliers) { foreach ($this->collSuppliers as $o) { $o->clearAllReferences($deep); } } if ($this->aPropinsi instanceof Persistent) { $this->aPropinsi->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) if ($this->collCustomerss instanceof PropelCollection) { $this->collCustomerss->clearIterator(); } $this->collCustomerss = null; if ($this->collProdusens instanceof PropelCollection) { $this->collProdusens->clearIterator(); } $this->collProdusens = null; if ($this->collSuppliers instanceof PropelCollection) { $this->collSuppliers->clearIterator(); } $this->collSuppliers = null; $this->aPropinsi = null; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Propinsi::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
} ?> <?php echo $form->error($model, 'kode_role'); ?> </div> <div class="form-row row"> <?php echo $form->labelEx($model, 'kode_provinsi'); ?> <?php if (Yii::app()->user->getState('role') == 1) { echo $form->dropDownList($model, 'kode_provinsi', Propinsi::model()->getProvinsiList(), array('empty' => 'Pilih Provinsi', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('kabupaten/dinamis'), 'data' => array('kode_provinsi' => 'js:this.value'), 'update' => '#' . CHtml::activeId($model, 'kode_kabkot')))); } else { $prop = Propinsi::model()->findByPk($model['kode_provinsi']); echo CHtml::textField('kode_provinsi', $prop['nama'], array('disabled' => 'disabled')); } ?> <?php echo $form->error($model, 'kode_provinsi'); ?> </div> <div class="form-row row"> <?php echo $form->labelEx($model, 'kode_kabkot'); ?> <?php if ($model->kode_provinsi != '') { if (Yii::app()->user->getState('role') == 1) {
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Propinsi $obj A Propinsi object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null PropinsiPeer::$instances[$key] = $obj; } }
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'kecamatan-form', 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <p> <?php echo CHtml::dropDownList('idprop', '', CHtml::listData(Propinsi::model()->getPropinsi(), 'idprop', 'nama_prop'), array('empty' => 'Pilih Prop', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('kabupaten/dinamis2'), 'data' => 'js:"idprop="+jQuery(this).val()', 'update' => '#idkab'))); ?> </p> <p> <?php $idprop = Yii::app()->db->createCommand("select idprop from kabupaten;")->queryScalar(); echo $form->dropDownList($model, 'idkab', Kabupaten::model()->getStateOptions($idprop), array('id' => 'idkab', 'empty' => 'Pilih Kab', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('kecamatan/dinamis'), 'data' => 'js:"idkab="+jQuery(this).val()', 'update' => '#idkec'))); ?> </p> <p> <?php echo $form->dropDownList($model, 'idkec', Kecamatan::model()->getCityOptionsByState($model->idkab), array('id' => 'idkec')); ?>
/** * Filter the query by a related Propinsi object * * @param Propinsi|PropelObjectCollection $propinsi the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return NegaraQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByPropinsi($propinsi, $comparison = null) { if ($propinsi instanceof Propinsi) { return $this->addUsingAlias(NegaraPeer::ID, $propinsi->getIdNegara(), $comparison); } elseif ($propinsi instanceof PropelObjectCollection) { return $this->usePropinsiQuery()->filterByPrimaryKeys($propinsi->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByPropinsi() only accepts arguments of type Propinsi or PropelCollection'); } }
/** * Exclude object from result * * @param Propinsi $propinsi Object to remove from the list of results * * @return PropinsiQuery The current query, for fluid interface */ public function prune($propinsi = null) { if ($propinsi) { $this->addUsingAlias(PropinsiPeer::ID, $propinsi->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Filter the query by a related Propinsi object * * @param Propinsi|PropelObjectCollection $propinsi The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return KotaQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByPropinsi($propinsi, $comparison = null) { if ($propinsi instanceof Propinsi) { return $this->addUsingAlias(KotaPeer::ID_PROPINSI, $propinsi->getId(), $comparison); } elseif ($propinsi instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(KotaPeer::ID_PROPINSI, $propinsi->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByPropinsi() only accepts arguments of type Propinsi or PropelCollection'); } }
/** * @param Propinsi $propinsi The propinsi object to add. */ protected function doAddPropinsi($propinsi) { $this->collPropinsis[] = $propinsi; $propinsi->setNegara($this); }