Permalink
Browse files

Group in carbon copy (parameter of the exercise)

  • Loading branch information...
1 parent 98ce0e9 commit 14c7d14813b03d5322ebc69ce5ffc15469112c54 @SamuelHassine SamuelHassine committed Jan 11, 2017
@@ -110,6 +110,7 @@ public function getInjectsAction(Request $request)
// enrich injects
foreach ($injects as &$inject) {
/* @var $inject Inject */
+ $inject->setInjectExercise($exercise);
$inject->setInjectHeader($exercise->getExerciseMessageHeader());
$inject->setInjectFooter($exercise->getExerciseMessageFooter());
}
@@ -144,6 +145,23 @@ public function getInjectsAction(Request $request)
}
}
}
+
+ if( $inject->getInjectExercise()->getExerciseAnimationGroup() != null ) {
+ foreach( $inject->getInjectExercise()->getExerciseAnimationGroup()->getGroupUsers() as $user ) {
+ if( array_search($user->getUserEmail(), array_column($data['data']['users'], 'user_email')) === false ) {
+ $userData = array();
+ $userData['user_firstname'] = $user->getUserFirstname();
+ $userData['user_lastname'] = $user->getUserLastname();
+ $userData['user_email'] = $user->getUserEmail();
+ $userData['user_phone'] = $user->getUserPhone();
+ $userData['user_pgp_key'] = base64_encode($user->getUserPgpKey());
+ $userData['user_organization'] = array();
+ $userData['user_organization']['organization_name'] = $user->getUserOrganization()->getOrganizationName();
+ $data['data']['users'][] = $userData;
+ }
+ }
+ }
+
$output[] = $data;
}
@@ -185,6 +203,22 @@ public function getInjectsAction(Request $request)
}
}
+ if( $dryinject->getDryinjectDryrun()->getDryrunExercise()->getExerciseAnimationGroup() != null ) {
+ foreach( $dryinject->getDryinjectDryrun()->getDryrunExercise()->getExerciseAnimationGroup()->getGroupUsers() as $user ) {
+ if( array_search($user->getUserEmail(), array_column($data['data']['users'], 'user_email')) === false ) {
+ $userData = array();
+ $userData['user_firstname'] = $user->getUserFirstname();
+ $userData['user_lastname'] = $user->getUserLastname();
+ $userData['user_email'] = $user->getUserEmail();
+ $userData['user_phone'] = $user->getUserPhone();
+ $userData['user_pgp_key'] = base64_encode($user->getUserPgpKey());
+ $userData['user_organization'] = array();
+ $userData['user_organization']['organization_name'] = $user->getUserOrganization()->getOrganizationName();
+ $data['data']['users'][] = $userData;
+ }
+ }
+ }
+
$output[] = $data;
}
@@ -88,6 +88,12 @@ class Exercise
*/
protected $exercise_canceled = false;
+ /**
+ * @ORM\ManyToOne(targetEntity="Group")
+ * @ORM\JoinColumn(name="exercise_animation_group", referencedColumnName="group_id", onDelete="SET NULL", nullable=true)
+ */
+ protected $exercise_animation_group;
+
protected $exercise_status = 'SCHEDULED';
public function __construct()
@@ -262,6 +268,17 @@ public function setExerciseCanceled($canceled)
return $this;
}
+ public function getExerciseAnimationGroup()
+ {
+ return $this->exercise_animation_group;
+ }
+
+ public function setExerciseAnimationGroup($group)
+ {
+ $this->exercise_animation_group = $group;
+ return $this;
+ }
+
public function computeExerciseStatus($injects) {
if( $this->exercise_canceled == true ) {
$status = 'CANCELED';
@@ -0,0 +1,63 @@
+<?php
+
+namespace APIBundle\Entity;
+
+use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * @ORM\Entity()
+ * @ORM\Table(name="parameters")
+ */
+class Parameter
+{
+ /**
+ * @ORM\Id
+ * @ORM\Column(type="string")
+ * @ORM\GeneratedValue(strategy="UUID")
+ */
+ protected $parameter_id;
+
+ /**
+ * @ORM\Column(type="string")
+ */
+ protected $parameter_key;
+
+ /**
+ * @ORM\Column(type="string")
+ */
+ protected $parameter_value;
+
+ public function getParameterId()
+ {
+ return $this->parameter_id;
+ }
+
+ public function setParameterId($id)
+ {
+ $this->parameter_id = $id;
+ return $this;
+ }
+
+ public function getParameterKey()
+ {
+ return $this->parameter_key;
+ }
+
+ public function setParameterKey($key)
+ {
+ $this->parameter_key = $key;
+ return $this;
+ }
+
+ public function getParameterValue()
+ {
+ return $this->parameter_value;
+ }
+
+ public function setParameterValue($value)
+ {
+ $this->parameter_value = $value;
+ return $this;
+ }
+}
@@ -27,6 +27,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add('exercise_canceled');
$builder->add('exercise_message_header');
$builder->add('exercise_message_footer');
+ $builder->add('exercise_animation_group');
}
public function configureOptions(OptionsResolver $resolver)
@@ -10,6 +10,7 @@ class ParameterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
+ $builder->add('parameter_key');
$builder->add('parameter_value');
}
@@ -21,4 +21,6 @@ APIBundle\Entity\Exercise:
exercise_message_header:
groups: ['exercise']
exercise_message_footer:
- groups: ['exercise']
+ groups: ['exercise']
+ exercise_animation_group:
+ groups: ['exercise']
@@ -1,7 +1,7 @@
APIBundle\Entity\Group:
attributes:
group_id:
- groups: ['group', 'user', 'grant']
+ groups: ['group', 'user', 'grant', 'exercise']
group_name:
groups: ['group', 'user', 'grant']
group_users:
@@ -2,7 +2,7 @@ APIBundle\Entity\Parameter:
attributes:
parameter_id:
groups: ['parameter']
- parameter_name:
+ parameter_key:
groups: ['parameter']
parameter_value:
groups: ['parameter']

0 comments on commit 14c7d14

Please sign in to comment.