The below is the delete method coding,
public function actionDelete($id)
{
if (Yii::app()->getRequest()->getIsPostRequest())
{
$checkStd = count(Studentmaster::model()->findAllByAttributes(array('bloodGroupId'=>$id)));
if($checkStd > 0)
{
echo "<div class='flash-error'>Sorry, this Record related with Student!</div>";
}
else
{
$this->loadModel($id)->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
{
Yii::app()->user->setFlash('success','Deleted Successfully!');
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
else
{
echo "<div class='flash-success'>Deleted Successfully!</div>";
}
}
}
}
I am unable to get this "Studentmaster::model" … here… due to this I am getting this error,
Error 500: <h1>PHP Error [2]</h1>
<p>include(Studentmaster.php): failed to open stream: No such file or directory (D:\xampp\htdocs\svnprojects\SDT\Source\framework\YiiBase.php:421)</p>
<pre>#0 D:\xampp\htdocs\svnprojects\SDT\Source\framework\YiiBase.php(421): CWebApplication->handleError()
#1 D:\xampp\htdocs\svnprojects\SDT\Source\framework\YiiBase.php(421): autoload()
#2 unknown(0): autoload()
#3 D:\xampp\htdocs\svnprojects\SDT\Source\sdt\protected\modules\defaults\controllers\BloodgroupController.php(123): spl_autoload_call()
#4 unknown(0): BloodgroupController->actionDelete()
#5 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\actions\CAction.php(108): ReflectionMethod->invokeArgs()
#6 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\actions\CInlineAction.php(47): CInlineAction->runWithParamsInternal()
#7 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CController.php(308): CInlineAction->runWithParams()
#8 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\filters\CFilterChain.php(133): BloodgroupController->runAction()
#9 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CController.php(1116): CFilterChain->run()
#10 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\filters\CInlineFilter.php(58): BloodgroupController->filterPostOnly()
#11 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter()
#12 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\filters\CFilter.php(40): CFilterChain->run()
#13 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CController.php(1145): CAccessControlFilter->filter()
#14 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\filters\CInlineFilter.php(58): BloodgroupController->filterAccessControl()
#15 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter()
#16 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CController.php(291): CFilterChain->run()
#17 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CController.php(265): BloodgroupController->runActionWithFilters()
#18 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CWebApplication.php(282): BloodgroupController->run()
#19 D:\xampp\htdocs\svnprojects\SDT\Source\framework\web\CWebApplication.php(141): CWebApplication->runController()
#20 D:\xampp\htdocs\svnprojects\SDT\Source\framework\base\CApplication.php(169): CWebApplication->processRequest()
#21 D:\xampp\htdocs\svnprojects\SDT\Source\sdt\index.php(13): CWebApplication->run()
</pre>
How to fix this?