/** * @param Motivations $motivations * @return array */ public static function extractMotivations(Motivations $motivations) { return array("motivationsWeight" => true === $motivations->isWeight() ? "true" : "false", "motivationsEnergy" => true === $motivations->isEnergy() ? "true" : "false", "motivationsBodyPain" => true === $motivations->isBodyPain() ? "true" : "false", "motivationsFeelYounger" => true === $motivations->isFeelYounger() ? "true" : "false", "motivationsIndependence" => true === $motivations->isIndependence() ? "true" : "false", "motivationsAlertness" => true === $motivations->isAlertness() ? "true" : "false", "motivationsSocialLife" => true === $motivations->isSocialLife() ? "true" : "false", "motivationsAppearance" => true === $motivations->isAppearance() ? "true" : "false", "motivationsFamily" => true === $motivations->isFamily() ? "true" : "false", "motivationsCompleted" => true === $motivations->isCompleted() ? "true" : "false"); }
/** * @inheritdoc */ public function isCompleted() { return $this->feelings->isCompleted() && $this->hindrances->isCompleted() && $this->dependants->isCompleted() && $this->motivations->isCompleted(); }
/** * @param Motivations $motivations * @param ParamFetcher $paramFetcher * @return Questionnaire * @throws \Exception */ public function updateMotivations(Motivations $motivations, ParamFetcher $paramFetcher) { $entityManager = $this->getEntityManager(); $motivations->setWeight($paramFetcher->get('weight'))->setEnergy($paramFetcher->get('energy'))->setBodyPain($paramFetcher->get('body_pain'))->setFeelYounger($paramFetcher->get('feel_younger'))->setIndependence($paramFetcher->get('independence'))->setAlertness($paramFetcher->get('alertness'))->setSocialLife($paramFetcher->get('social_life'))->setAppearance($paramFetcher->get('appearance'))->setFamily($paramFetcher->get('family'))->setCompletedDate(new \DateTime()); $entityManager->persist($motivations); $entityManager->flush($motivations); return $this->getParentQuestionnaireForSection($motivations); }
public function testGetSetFamily() { $this->assertFalse($this->instance->isFamily()); $this->assertTrue($this->instance->setFamily(true) instanceof Motivations); $this->assertTrue($this->instance->isFamily()); }