コード例 #1
0
 function onFlush(OnFlushEventArgs $args)
 {
     foreach ($this->getEntitiesToValidate($args->getEntityManager()) as $entity) {
         if (count($violations = $this->validator->validate($entity))) {
             $message = "Invalid entity {$this->objectToString($entity)}:\n";
             $message .= implode("\n", Collection::map($violations, function ($violation) {
                 return "- {$violation->getPropertyPath()}: {$violation->getMessage()}";
             }));
             throw new \InvalidArgumentException($message);
         }
     }
 }
コード例 #2
0
ファイル: ExtraLogging.php プロジェクト: msalsas/misc-bundle
 private function dictionaryToString($dictionary)
 {
     return String::indent(Yaml::dump(Collection::toArray($dictionary), 1));
 }
コード例 #3
0
ファイル: SwiftMailer.php プロジェクト: msalsas/misc-bundle
 private function getWorstRecord(array $records)
 {
     return Collection::wrap($records)->sort(array('getValue' => function ($record) {
         return -$record['level'];
     }, 'sorting' => SORT_NUMERIC))->first();
 }
コード例 #4
0
 private function isAMissingIgnoredFile(GetResponseForExceptionEvent $event)
 {
     return $event->getException() instanceof NotFoundHttpException && Collection::any($this->ignoredFilesRegexes, function ($regex) use($event) {
         return preg_match($regex, $event->getRequest()->getPathInfo());
     });
 }