예제 #1
0
 public function callbackPostSubmit(FormEvent $event)
 {
     $form = $event->getForm();
     if ($form->has('picture')) {
         $picFile = $form->get('picture')->getViewData();
         if ($picFile instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) {
             try {
                 $pub = $event->getData();
                 $this->repository->insertUpload($pub, $picFile);
                 $event->setData($pub);
             } catch (\Exception $e) {
                 $form->get('picture')->addError(new FormError($e->getMessage()));
             }
         }
     }
 }
예제 #2
0
 public function testClearCache()
 {
     $cpt = $this->sut->clearCache(0);
     $this->assertGreaterThan(0, $cpt);
 }