php - Error Message using Symfony -


can me please. system should allow addition or modification of activities in periods in open/active state. studentid foreign key in activity table. therefore when user tries edit activity associated student id that's in inactive, user should error.

this have far doesn't seem did correctly because i'm getting error both when active , inactive?

repository

public function findbytransid($studentid) {     $student= $this->getentitymanager()->getrepository(acmedemobundle:student')         ->findby(['studentid' => $studentid,'state'=>0]);      if ($student){         return false;     } else {         return true;     } } 

controller

public function editaction($studentid) {     $em = $this->getdoctrine()->getmanager();      $entity = $em->getrepository('acmedemobundle:activity1')->find($studentid);     $state = $em->getrepository('acmedemobundle:activity1')->findbytransid($studentid);      if (!$entity) {         throw $this->createnotfoundexception('unable find activity1 entity.');     } elseif ($state) {          $this->addflash('error','error! activity active' );     }      $editform = $this->createeditform($entity);     $deleteform = $this->createdeleteform($transid);      return array(         'entity'      => $entity,         'edit_form'   => $editform->createview(),         'delete_form' => $deleteform->createview(),     );  } 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -