本文整理汇总了PHP中SMS::model方法的典型用法代码示例。如果您正苦于以下问题:PHP SMS::model方法的具体用法?PHP SMS::model怎么用?PHP SMS::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMS
的用法示例。
在下文中一共展示了SMS::model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cascade_delete
public function cascade_delete()
{
$id = $this->id;
// delete basic info mappings
$basic_info = BasicInfo::model()->findByAttributes(array('userid' => $id));
if (isset($basic_info)) {
$basic_info->delete();
}
// delete company info mapping
$comp_info = CompanyInfo::model()->findByAttributes(array('FK_userid' => $id));
if (isset($comp_info)) {
$comp_info->delete();
}
// delete sms mappings
$sms_mappings = SMS::model()->findAll("sender_id=:id OR receiver_id=:id ", array(':id' => $id));
foreach ($sms_mappings as $sms_mapping) {
$sms_mapping->delete();
}
// delete education mapping
$edu_mappings = Education::model()->findAllByAttributes(array('FK_user_id' => $id));
foreach ($edu_mappings as $edu_mapping) {
$edu_mapping->delete();
}
// delete skills mappings
$skills_mappings = StudentSkillMap::model()->findAllByAttributes(array('userid' => $id));
foreach ($skills_mappings as $skills_mapping) {
$skills_mapping->delete();
}
// delete application mappings
$app_mappings = Application::model()->findAllByAttributes(array('userid' => $id));
foreach ($app_mappings as $app_mapping) {
$app_mapping->delete();
}
// delete jobs mappings
$job_mappings = Job::model()->findAllByAttributes(array('FK_poster' => $id));
foreach ($job_mappings as $job_mapping) {
$job_mapping->cascade_delete();
}
$this->delete();
}
示例2: loadModel
/**
* 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 $id the ID of the model to be loaded
* @return SMS the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = SMS::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}