Exemplo n.º 1
0
 /**
  * @param Dog $dog
  * @return Size
  */
 public function getSize(Dog $dog)
 {
     $minSize = null;
     $sizes = $this->getEntityManager()->getRepository('Application\\Entity\\Size')->findAll();
     foreach ($sizes as $size) {
         if ($dog->getHeight() < $size->getMaxHeight() && (!$minSize || $size->getMaxHeight() < $minSize->getMaxHeight())) {
             $minSize = $size;
         }
     }
     return $minSize;
 }