diff --git a/src/Bundle/ChillPersonBundle/src/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/src/Form/Type/Select2MaritalStatusType.php index 0cff8ee51..c94e7b05f 100644 --- a/src/Bundle/ChillPersonBundle/src/Form/Type/Select2MaritalStatusType.php +++ b/src/Bundle/ChillPersonBundle/src/Form/Type/Select2MaritalStatusType.php @@ -27,6 +27,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\RequestStack; use Doctrine\Persistence\ObjectManager; use Chill\MainBundle\Form\Type\Select2ChoiceType; +use Doctrine\ORM\EntityManagerInterface; /** * A type to select the marital status @@ -38,10 +39,12 @@ class Select2MaritalStatusType extends AbstractType /** @var RequestStack */ private $requestStack; - /** @var ObjectManager */ + /** + * @var EntityManagerInterface + */ private $em; - public function __construct(RequestStack $requestStack,ObjectManager $em) + public function __construct(RequestStack $requestStack, EntityManagerInterface $em) { $this->requestStack = $requestStack; $this->em = $em; diff --git a/src/Bundle/ChillPersonBundle/src/Timeline/AbstractTimelineAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/src/Timeline/AbstractTimelineAccompanyingPeriod.php index 37f185bb2..d29c2abde 100644 --- a/src/Bundle/ChillPersonBundle/src/Timeline/AbstractTimelineAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/src/Timeline/AbstractTimelineAccompanyingPeriod.php @@ -21,10 +21,11 @@ namespace Chill\PersonBundle\Timeline; use Chill\MainBundle\Timeline\TimelineProviderInterface; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\EntityManagerInterface; /** * Provide method to build timeline for accompanying periods - * + * * This class is resued by TimelineAccompanyingPeriodOpening (for opening) * and TimelineAccompanyingPeriodClosing (for closing) * @@ -34,17 +35,17 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt { /** * - * @var EntityManager + * @var EntityManagerInterface */ protected $em; - - public function __construct(EntityManager $em) + + public function __construct(EntityManagerInterface $em) { $this->em = $em; } /** - * + * * {@inheritDoc} */ public function getEntities(array $ids) @@ -52,19 +53,19 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt $periods = $this->em ->getRepository('ChillPersonBundle:AccompanyingPeriod') ->findBy(array('id' => $ids)); - + //set results in an associative array with id as indexes $results = array(); foreach($periods as $period) { $results[$period->getId()] = $period; } - + return $results; } /** * prepare fetchQuery without `WHERE` and `TYPE` clause - * + * * @param string $context * @param array $args * @return array @@ -76,15 +77,15 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt throw new \LogicException('TimelineAccompanyingPeriod is not able ' . 'to render context '.$context); } - + $metadata = $this->em ->getClassMetadata('ChillPersonBundle:AccompanyingPeriod') ; - + return array( 'id' => $metadata->getColumnName('id'), 'FROM' => $metadata->getTableName(), - 'WHERE' => sprintf('%s = %d', + 'WHERE' => sprintf('%s = %d', $metadata ->getAssociationMapping('person')['joinColumns'][0]['name'], $args['person']->getId()) @@ -93,7 +94,7 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt /** * return the expected response for TimelineProviderInterface::getEntityTemplate - * + * * @param string $template the template for rendering * @param mixed $entity * @param string $context