@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class Index extends AbstractActionController |
28 | 28 | { |
29 | - protected $installForm; |
|
29 | + protected $installForm; |
|
30 | 30 | |
31 | - public function __construct(FormElementManager $formElementManager) |
|
32 | - { |
|
33 | - $this->installForm = $formElementManager->get('Install/Installation'); |
|
34 | - } |
|
31 | + public function __construct(FormElementManager $formElementManager) |
|
32 | + { |
|
33 | + $this->installForm = $formElementManager->get('Install/Installation'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Hook for custom preDispatch event. |
38 | 38 | * |
39 | 39 | * @param MvcEvent $event |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $routeMatch->setParam('action', $p); |
51 | 51 | $response = $this->getResponse(); |
52 | 52 | $response->getHeaders() |
53 | - ->addHeaderLine('Content-Type', 'application/json') |
|
54 | - ->addHeaderLine('Content-Encoding', 'utf8'); |
|
53 | + ->addHeaderLine('Content-Type', 'application/json') |
|
54 | + ->addHeaderLine('Content-Encoding', 'utf8'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $form = $this->installForm; |
66 | 66 | $prereqs = $this->plugin('Install/Prerequisites')->check(); |
67 | 67 | |
68 | - return $this->createViewModel( |
|
69 | - array( |
|
70 | - 'prerequisites' => $prereqs, |
|
71 | - 'form' => $form, |
|
72 | - 'lang' => $this->params('lang'), |
|
73 | - ) |
|
74 | - ); |
|
68 | + return $this->createViewModel( |
|
69 | + array( |
|
70 | + 'prerequisites' => $prereqs, |
|
71 | + 'form' => $form, |
|
72 | + 'lang' => $this->params('lang'), |
|
73 | + ) |
|
74 | + ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $form->setData($_POST); |
101 | 101 | |
102 | 102 | if (!$form->isValid()) { |
103 | - return $this->createJsonResponse( |
|
104 | - array( |
|
105 | - 'ok' => false, |
|
106 | - 'errors' => $form->getMessages(), |
|
107 | - ) |
|
108 | - ); |
|
103 | + return $this->createJsonResponse( |
|
104 | + array( |
|
105 | + 'ok' => false, |
|
106 | + 'errors' => $form->getMessages(), |
|
107 | + ) |
|
108 | + ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | $data = $form->getData(); |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function attachDefaultListeners() |
135 | 135 | { |
136 | - parent::attachDefaultListeners(); |
|
136 | + parent::attachDefaultListeners(); |
|
137 | 137 | |
138 | - $events = $this->getEventManager(); |
|
139 | - $events->attach( MvcEvent::EVENT_DISPATCH, array( $this, 'preDispatch' ), 100 ); |
|
138 | + $events = $this->getEventManager(); |
|
139 | + $events->attach( MvcEvent::EVENT_DISPATCH, array( $this, 'preDispatch' ), 100 ); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -136,7 +136,7 @@ |
||
136 | 136 | parent::attachDefaultListeners(); |
137 | 137 | |
138 | 138 | $events = $this->getEventManager(); |
139 | - $events->attach( MvcEvent::EVENT_DISPATCH, array( $this, 'preDispatch' ), 100 ); |
|
139 | + $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 100); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -26,57 +26,57 @@ discard block |
||
26 | 26 | |
27 | 27 | public function init() |
28 | 28 | { |
29 | - $this->setName('installation'); |
|
29 | + $this->setName('installation'); |
|
30 | 30 | |
31 | - $this->setAttributes( |
|
32 | - array( |
|
33 | - 'method' => 'post', |
|
34 | - ) |
|
35 | - ); |
|
31 | + $this->setAttributes( |
|
32 | + array( |
|
33 | + 'method' => 'post', |
|
34 | + ) |
|
35 | + ); |
|
36 | 36 | |
37 | - $this->add( |
|
38 | - array( |
|
39 | - 'type' => 'Text', |
|
40 | - 'name' => 'db_conn', |
|
41 | - 'options' => array( |
|
42 | - 'label' => /* @translate */ 'Database connection string', |
|
43 | - ), |
|
44 | - 'attributes' => array( |
|
45 | - 'placeholder' => 'mongodb://localhost:27017/YAWIK', |
|
46 | - ), |
|
37 | + $this->add( |
|
38 | + array( |
|
39 | + 'type' => 'Text', |
|
40 | + 'name' => 'db_conn', |
|
41 | + 'options' => array( |
|
42 | + 'label' => /* @translate */ 'Database connection string', |
|
43 | + ), |
|
44 | + 'attributes' => array( |
|
45 | + 'placeholder' => 'mongodb://localhost:27017/YAWIK', |
|
46 | + ), |
|
47 | 47 | |
48 | - ) |
|
49 | - ); |
|
48 | + ) |
|
49 | + ); |
|
50 | 50 | |
51 | - $this->add( |
|
52 | - array( |
|
53 | - 'type' => 'Text', |
|
54 | - 'name' => 'username', |
|
55 | - 'options' => array( |
|
56 | - 'label' => /* @translate */ 'Initial user name', |
|
57 | - ), |
|
58 | - ) |
|
59 | - ); |
|
51 | + $this->add( |
|
52 | + array( |
|
53 | + 'type' => 'Text', |
|
54 | + 'name' => 'username', |
|
55 | + 'options' => array( |
|
56 | + 'label' => /* @translate */ 'Initial user name', |
|
57 | + ), |
|
58 | + ) |
|
59 | + ); |
|
60 | 60 | |
61 | - $this->add( |
|
62 | - array( |
|
63 | - 'type' => 'Password', |
|
64 | - 'name' => 'password', |
|
65 | - 'options' => array( |
|
66 | - 'label' => /* @translate */ 'Password', |
|
67 | - ), |
|
68 | - ) |
|
69 | - ); |
|
61 | + $this->add( |
|
62 | + array( |
|
63 | + 'type' => 'Password', |
|
64 | + 'name' => 'password', |
|
65 | + 'options' => array( |
|
66 | + 'label' => /* @translate */ 'Password', |
|
67 | + ), |
|
68 | + ) |
|
69 | + ); |
|
70 | 70 | |
71 | - $this->add( |
|
72 | - array( |
|
73 | - 'type' => 'Text', |
|
74 | - 'name' => 'email', |
|
75 | - 'options' => array( |
|
76 | - 'label' => /* @translate */ 'Email address for system messages', |
|
77 | - ), |
|
78 | - ) |
|
79 | - ); |
|
71 | + $this->add( |
|
72 | + array( |
|
73 | + 'type' => 'Text', |
|
74 | + 'name' => 'email', |
|
75 | + 'options' => array( |
|
76 | + 'label' => /* @translate */ 'Email address for system messages', |
|
77 | + ), |
|
78 | + ) |
|
79 | + ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function getInputFilterSpecification() |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ), |
91 | 91 | 'validators' => array( |
92 | 92 | array('name' => MongoDbConnectionString::class, |
93 | - 'break_chain_on_failure' => true), |
|
93 | + 'break_chain_on_failure' => true), |
|
94 | 94 | array('name' => MongoDbConnection::class), |
95 | 95 | ), |
96 | 96 | ), |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $element = $page->find('css',$mapMultiple[$field]); |
180 | 180 | if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
181 | 181 | $this->minkContext->selectOption($value,$multipleField); |
182 | - }else{ |
|
182 | + } else{ |
|
183 | 183 | $locator = $mapSelect2[$field]; |
184 | 184 | $this->select2Context->iFillInSelect2Field($locator,$value); |
185 | 185 | } |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | if($user instanceof User){ |
231 | 231 | $job->setUser($user); |
232 | 232 | $job->setOrganization($user->getOrganization()->getOrganization()); |
233 | - }else{ |
|
233 | + } else{ |
|
234 | 234 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | 238 | if($status == 'draft'){ |
239 | 239 | $job->setIsDraft(true); |
240 | - }elseif($status == 'published'){ |
|
240 | + } elseif($status == 'published'){ |
|
241 | 241 | $job->setIsDraft(false); |
242 | 242 | $job->setDatePublishStart(new \DateTime()); |
243 | 243 | } |
@@ -33,324 +33,324 @@ |
||
33 | 33 | */ |
34 | 34 | class JobContext implements Context |
35 | 35 | { |
36 | - use CommonContextTrait; |
|
36 | + use CommonContextTrait; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var Select2Context |
|
40 | - */ |
|
41 | - private $select2Context; |
|
38 | + /** |
|
39 | + * @var Select2Context |
|
40 | + */ |
|
41 | + private $select2Context; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var Job |
|
45 | - */ |
|
46 | - private $currentJob; |
|
43 | + /** |
|
44 | + * @var Job |
|
45 | + */ |
|
46 | + private $currentJob; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var JobRepository |
|
50 | - */ |
|
51 | - static private $jobRepo; |
|
48 | + /** |
|
49 | + * @var JobRepository |
|
50 | + */ |
|
51 | + static private $jobRepo; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param User $user |
|
55 | - */ |
|
56 | - static public function removeJobByUser(User $user) |
|
57 | - { |
|
58 | - $repo = static::$jobRepo; |
|
59 | - $results = $repo->findBy(['user' => $user]); |
|
60 | - foreach($results as $result){ |
|
61 | - $repo->remove($result,true); |
|
62 | - } |
|
63 | - } |
|
53 | + /** |
|
54 | + * @param User $user |
|
55 | + */ |
|
56 | + static public function removeJobByUser(User $user) |
|
57 | + { |
|
58 | + $repo = static::$jobRepo; |
|
59 | + $results = $repo->findBy(['user' => $user]); |
|
60 | + foreach($results as $result){ |
|
61 | + $repo->remove($result,true); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @BeforeScenario |
|
67 | - * |
|
68 | - * @param BeforeScenarioScope $scope |
|
69 | - */ |
|
70 | - public function beforeScenario(BeforeScenarioScope $scope) |
|
71 | - { |
|
72 | - $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
|
73 | - if(is_null(static::$jobRepo)){ |
|
74 | - $this->gatherContexts($scope); |
|
75 | - static::$jobRepo = $this->getJobRepository(); |
|
76 | - } |
|
77 | - } |
|
65 | + /** |
|
66 | + * @BeforeScenario |
|
67 | + * |
|
68 | + * @param BeforeScenarioScope $scope |
|
69 | + */ |
|
70 | + public function beforeScenario(BeforeScenarioScope $scope) |
|
71 | + { |
|
72 | + $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
|
73 | + if(is_null(static::$jobRepo)){ |
|
74 | + $this->gatherContexts($scope); |
|
75 | + static::$jobRepo = $this->getJobRepository(); |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @Given I go to job board page |
|
81 | - */ |
|
82 | - public function iGoToJobBoardPage() |
|
83 | - { |
|
84 | - $this->visit('/jobboard'); |
|
85 | - } |
|
79 | + /** |
|
80 | + * @Given I go to job board page |
|
81 | + */ |
|
82 | + public function iGoToJobBoardPage() |
|
83 | + { |
|
84 | + $this->visit('/jobboard'); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * @Given I go to create job page |
|
89 | - */ |
|
90 | - public function iGoToCreateJob() |
|
91 | - { |
|
92 | - $url = $this->generateUrl('lang/jobs/manage',['action' => 'edit']); |
|
93 | - $this->visit($url); |
|
94 | - } |
|
87 | + /** |
|
88 | + * @Given I go to create job page |
|
89 | + */ |
|
90 | + public function iGoToCreateJob() |
|
91 | + { |
|
92 | + $url = $this->generateUrl('lang/jobs/manage',['action' => 'edit']); |
|
93 | + $this->visit($url); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * @Given I go to job overview page |
|
98 | - */ |
|
99 | - public function iGoToJobOverviewPage() |
|
100 | - { |
|
101 | - $this->visit('/jobs'); |
|
102 | - } |
|
96 | + /** |
|
97 | + * @Given I go to job overview page |
|
98 | + */ |
|
99 | + public function iGoToJobOverviewPage() |
|
100 | + { |
|
101 | + $this->visit('/jobs'); |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * @Given I go to edit job draft with title :jobTitle |
|
106 | - * @param $jobTitle |
|
107 | - * @throws \Exception when job is not found |
|
108 | - */ |
|
109 | - public function iGoToEditJobWithTitle($jobTitle) |
|
110 | - { |
|
111 | - $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
|
112 | - if(!$job instanceof Job){ |
|
113 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
114 | - } |
|
115 | - $this->currentJob = $job; |
|
116 | - $url = $this->generateUrl('lang/jobs/manage',[ |
|
117 | - 'id' => $job->getId() |
|
104 | + /** |
|
105 | + * @Given I go to edit job draft with title :jobTitle |
|
106 | + * @param $jobTitle |
|
107 | + * @throws \Exception when job is not found |
|
108 | + */ |
|
109 | + public function iGoToEditJobWithTitle($jobTitle) |
|
110 | + { |
|
111 | + $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
|
112 | + if(!$job instanceof Job){ |
|
113 | + throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
114 | + } |
|
115 | + $this->currentJob = $job; |
|
116 | + $url = $this->generateUrl('lang/jobs/manage',[ |
|
117 | + 'id' => $job->getId() |
|
118 | 118 | ]); |
119 | - $this->visit($url); |
|
120 | - } |
|
119 | + $this->visit($url); |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * @Given I don't have any classification data |
|
124 | - */ |
|
125 | - public function iDonTHaveAnyClassificationData() |
|
126 | - { |
|
127 | - $this->currentJob->setClassifications(new Classifications()); |
|
128 | - $this->getJobRepository()->store($this->currentJob); |
|
129 | - } |
|
122 | + /** |
|
123 | + * @Given I don't have any classification data |
|
124 | + */ |
|
125 | + public function iDonTHaveAnyClassificationData() |
|
126 | + { |
|
127 | + $this->currentJob->setClassifications(new Classifications()); |
|
128 | + $this->getJobRepository()->store($this->currentJob); |
|
129 | + } |
|
130 | 130 | |
131 | - /** |
|
132 | - * @When I don't have any posted job |
|
133 | - */ |
|
134 | - public function iDonTHaveAnyPostedJob() |
|
135 | - { |
|
136 | - /* @var $jobRepository JobRepository */ |
|
137 | - /* @var $job Job */ |
|
138 | - $user = $this->getUserContext()->getCurrentUser(); |
|
131 | + /** |
|
132 | + * @When I don't have any posted job |
|
133 | + */ |
|
134 | + public function iDonTHaveAnyPostedJob() |
|
135 | + { |
|
136 | + /* @var $jobRepository JobRepository */ |
|
137 | + /* @var $job Job */ |
|
138 | + $user = $this->getUserContext()->getCurrentUser(); |
|
139 | 139 | |
140 | - $jobRepository = $this->getJobRepository(); |
|
141 | - $results = $jobRepository->getUserJobs($user->getId()); |
|
142 | - foreach($results as $job){ |
|
143 | - $jobRepository->remove($job,true); |
|
144 | - } |
|
145 | - $this->currentJob = null; |
|
146 | - } |
|
140 | + $jobRepository = $this->getJobRepository(); |
|
141 | + $results = $jobRepository->getUserJobs($user->getId()); |
|
142 | + foreach($results as $job){ |
|
143 | + $jobRepository->remove($job,true); |
|
144 | + } |
|
145 | + $this->currentJob = null; |
|
146 | + } |
|
147 | 147 | |
148 | - /** |
|
149 | - * @When I fill job location search with :search and choose :choice |
|
150 | - * |
|
151 | - */ |
|
152 | - public function iFillJobLocationAndChoose($search,$choice) |
|
153 | - { |
|
154 | - $select2 = $this->select2Context; |
|
155 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
156 | - } |
|
148 | + /** |
|
149 | + * @When I fill job location search with :search and choose :choice |
|
150 | + * |
|
151 | + */ |
|
152 | + public function iFillJobLocationAndChoose($search,$choice) |
|
153 | + { |
|
154 | + $select2 = $this->select2Context; |
|
155 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * @When I choose :value from :field |
|
160 | - */ |
|
161 | - public function iJobClassificationSelect($value,$field) |
|
162 | - { |
|
163 | - $field = Inflector::camelize($field); |
|
158 | + /** |
|
159 | + * @When I choose :value from :field |
|
160 | + */ |
|
161 | + public function iJobClassificationSelect($value,$field) |
|
162 | + { |
|
163 | + $field = Inflector::camelize($field); |
|
164 | 164 | |
165 | - $mapSelect2 = [ |
|
166 | - 'professions' => '#classifications-professions-span .select2-container', |
|
167 | - 'industries' => '#classifications-industries-span .select2-container', |
|
168 | - 'employmentTypes' => '#classifications-employmentTypes-span .select2-container', |
|
169 | - ]; |
|
165 | + $mapSelect2 = [ |
|
166 | + 'professions' => '#classifications-professions-span .select2-container', |
|
167 | + 'industries' => '#classifications-industries-span .select2-container', |
|
168 | + 'employmentTypes' => '#classifications-employmentTypes-span .select2-container', |
|
169 | + ]; |
|
170 | 170 | |
171 | - $mapMultiple = [ |
|
172 | - 'professions' => "select#classifications-professions", |
|
173 | - 'industries' => "select#classifications-industries", |
|
174 | - 'employmentTypes' => "select#classifications-employmentTypes", |
|
175 | - ]; |
|
171 | + $mapMultiple = [ |
|
172 | + 'professions' => "select#classifications-professions", |
|
173 | + 'industries' => "select#classifications-industries", |
|
174 | + 'employmentTypes' => "select#classifications-employmentTypes", |
|
175 | + ]; |
|
176 | 176 | |
177 | - if(!isset($mapSelect2[$field])){ |
|
178 | - throw new \Exception('Undefined field selection value "'.$field.'"'); |
|
179 | - } |
|
177 | + if(!isset($mapSelect2[$field])){ |
|
178 | + throw new \Exception('Undefined field selection value "'.$field.'"'); |
|
179 | + } |
|
180 | 180 | |
181 | - $multipleField = $mapMultiple[$field]; |
|
182 | - $page = $this->minkContext->getSession()->getPage(); |
|
183 | - $element = $page->find('css',$mapMultiple[$field]); |
|
184 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
185 | - $this->minkContext->selectOption($value,$multipleField); |
|
186 | - }else{ |
|
187 | - $locator = $mapSelect2[$field]; |
|
188 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
189 | - } |
|
190 | - } |
|
181 | + $multipleField = $mapMultiple[$field]; |
|
182 | + $page = $this->minkContext->getSession()->getPage(); |
|
183 | + $element = $page->find('css',$mapMultiple[$field]); |
|
184 | + if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
185 | + $this->minkContext->selectOption($value,$multipleField); |
|
186 | + }else{ |
|
187 | + $locator = $mapSelect2[$field]; |
|
188 | + $this->select2Context->iFillInSelect2Field($locator,$value); |
|
189 | + } |
|
190 | + } |
|
191 | 191 | |
192 | - /** |
|
193 | - * @return JobRepository |
|
194 | - */ |
|
195 | - public function getJobRepository() |
|
196 | - { |
|
197 | - return $this->getRepository('Jobs/Job'); |
|
198 | - } |
|
192 | + /** |
|
193 | + * @return JobRepository |
|
194 | + */ |
|
195 | + public function getJobRepository() |
|
196 | + { |
|
197 | + return $this->getRepository('Jobs/Job'); |
|
198 | + } |
|
199 | 199 | |
200 | - /** |
|
201 | - * @return CategoriesRepo |
|
202 | - */ |
|
203 | - public function getCategoriesRepository() |
|
204 | - { |
|
205 | - return $this->getRepository('Jobs/Category'); |
|
206 | - } |
|
200 | + /** |
|
201 | + * @return CategoriesRepo |
|
202 | + */ |
|
203 | + public function getCategoriesRepository() |
|
204 | + { |
|
205 | + return $this->getRepository('Jobs/Category'); |
|
206 | + } |
|
207 | 207 | |
208 | - /** |
|
209 | - * @When I have a :status job with the following: |
|
210 | - * @param TableNode $fields |
|
211 | - */ |
|
212 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
213 | - { |
|
214 | - $normalizedField = [ |
|
215 | - 'template' => 'modern', |
|
216 | - ]; |
|
217 | - foreach($fields->getRowsHash() as $field => $value){ |
|
218 | - $field = Inflector::camelize($field); |
|
219 | - if($field == 'professions' || $field == 'industries'){ |
|
220 | - $value = explode(',',$value); |
|
221 | - } |
|
222 | - $normalizedField[$field] = $value; |
|
223 | - } |
|
224 | - $jobRepo = $this->getJobRepository(); |
|
225 | - $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]); |
|
226 | - if(!$job instanceof Job){ |
|
227 | - $job = new Job(); |
|
228 | - $job->setTitle($normalizedField['title']); |
|
229 | - } |
|
230 | - if(isset($normalizedField['user'])){ |
|
231 | - /* @var $userRepo UserRepository */ |
|
232 | - $userRepo = $this->getRepository('Auth\Entity\User'); |
|
233 | - $user = $userRepo->findOneBy(['login' => $normalizedField['user']]); |
|
234 | - if($user instanceof User){ |
|
235 | - $job->setUser($user); |
|
236 | - $job->setOrganization($user->getOrganization()->getOrganization()); |
|
237 | - }else{ |
|
238 | - throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
|
239 | - } |
|
240 | - } |
|
208 | + /** |
|
209 | + * @When I have a :status job with the following: |
|
210 | + * @param TableNode $fields |
|
211 | + */ |
|
212 | + public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
213 | + { |
|
214 | + $normalizedField = [ |
|
215 | + 'template' => 'modern', |
|
216 | + ]; |
|
217 | + foreach($fields->getRowsHash() as $field => $value){ |
|
218 | + $field = Inflector::camelize($field); |
|
219 | + if($field == 'professions' || $field == 'industries'){ |
|
220 | + $value = explode(',',$value); |
|
221 | + } |
|
222 | + $normalizedField[$field] = $value; |
|
223 | + } |
|
224 | + $jobRepo = $this->getJobRepository(); |
|
225 | + $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]); |
|
226 | + if(!$job instanceof Job){ |
|
227 | + $job = new Job(); |
|
228 | + $job->setTitle($normalizedField['title']); |
|
229 | + } |
|
230 | + if(isset($normalizedField['user'])){ |
|
231 | + /* @var $userRepo UserRepository */ |
|
232 | + $userRepo = $this->getRepository('Auth\Entity\User'); |
|
233 | + $user = $userRepo->findOneBy(['login' => $normalizedField['user']]); |
|
234 | + if($user instanceof User){ |
|
235 | + $job->setUser($user); |
|
236 | + $job->setOrganization($user->getOrganization()->getOrganization()); |
|
237 | + }else{ |
|
238 | + throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
|
239 | + } |
|
240 | + } |
|
241 | 241 | |
242 | - if($status == 'draft'){ |
|
243 | - $job->setIsDraft(true); |
|
244 | - }elseif($status == 'published'){ |
|
245 | - $job->setIsDraft(false); |
|
246 | - $job->setDatePublishStart(new \DateTime()); |
|
247 | - } |
|
248 | - $job->setStatus(Status::ACTIVE); |
|
242 | + if($status == 'draft'){ |
|
243 | + $job->setIsDraft(true); |
|
244 | + }elseif($status == 'published'){ |
|
245 | + $job->setIsDraft(false); |
|
246 | + $job->setDatePublishStart(new \DateTime()); |
|
247 | + } |
|
248 | + $job->setStatus(Status::ACTIVE); |
|
249 | 249 | |
250 | - if(isset($normalizedField['location'])){ |
|
251 | - $this->setLocation($job,$normalizedField['location']); |
|
252 | - } |
|
253 | - if(isset($normalizedField['companyName'])){ |
|
254 | - //$job->setCompany($normalizedField['companyName']); |
|
255 | - } |
|
256 | - if(isset($normalizedField['professions'])){ |
|
257 | - $this->addProfessions($job,$normalizedField['professions']); |
|
258 | - } |
|
250 | + if(isset($normalizedField['location'])){ |
|
251 | + $this->setLocation($job,$normalizedField['location']); |
|
252 | + } |
|
253 | + if(isset($normalizedField['companyName'])){ |
|
254 | + //$job->setCompany($normalizedField['companyName']); |
|
255 | + } |
|
256 | + if(isset($normalizedField['professions'])){ |
|
257 | + $this->addProfessions($job,$normalizedField['professions']); |
|
258 | + } |
|
259 | 259 | |
260 | - if(isset($normalizedField['industries'])){ |
|
261 | - $this->addIndustries($job,$normalizedField['industries']); |
|
262 | - } |
|
263 | - if(isset($normalizedField['employmentTypes'])){ |
|
264 | - $types = $this->getCategories([$normalizedField['employmentTypes']]); |
|
265 | - $type = array_shift($types); |
|
266 | - $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
|
267 | - if(!is_array($values) || !in_array($type,$values)){ |
|
268 | - $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
|
269 | - } |
|
270 | - } |
|
260 | + if(isset($normalizedField['industries'])){ |
|
261 | + $this->addIndustries($job,$normalizedField['industries']); |
|
262 | + } |
|
263 | + if(isset($normalizedField['employmentTypes'])){ |
|
264 | + $types = $this->getCategories([$normalizedField['employmentTypes']]); |
|
265 | + $type = array_shift($types); |
|
266 | + $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
|
267 | + if(!is_array($values) || !in_array($type,$values)){ |
|
268 | + $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
|
269 | + } |
|
270 | + } |
|
271 | 271 | |
272 | - $jobRepo->store($job); |
|
273 | - $this->currentJob = $job; |
|
274 | - } |
|
272 | + $jobRepo->store($job); |
|
273 | + $this->currentJob = $job; |
|
274 | + } |
|
275 | 275 | |
276 | - private function setLocation(Job $job, $term) |
|
277 | - { |
|
278 | - /* @var $client Photon */ |
|
279 | - $client = $this->coreContext->getServiceManager()->get('Geo/Client'); |
|
280 | - $result = $client->queryOne($term); |
|
281 | - $location = new Location(); |
|
282 | - $serialized = Json::encode($result); |
|
283 | - $location->fromString($serialized); |
|
276 | + private function setLocation(Job $job, $term) |
|
277 | + { |
|
278 | + /* @var $client Photon */ |
|
279 | + $client = $this->coreContext->getServiceManager()->get('Geo/Client'); |
|
280 | + $result = $client->queryOne($term); |
|
281 | + $location = new Location(); |
|
282 | + $serialized = Json::encode($result); |
|
283 | + $location->fromString($serialized); |
|
284 | 284 | |
285 | - $locations = $job->getLocations(); |
|
286 | - if(count($locations)){ |
|
287 | - $locations->clear(); |
|
288 | - } |
|
289 | - $job->getLocations()->add($location); |
|
290 | - } |
|
285 | + $locations = $job->getLocations(); |
|
286 | + if(count($locations)){ |
|
287 | + $locations->clear(); |
|
288 | + } |
|
289 | + $job->getLocations()->add($location); |
|
290 | + } |
|
291 | 291 | |
292 | - private function addProfessions(Job &$job,$terms) |
|
293 | - { |
|
294 | - $professions = $this->getCategories($terms); |
|
295 | - foreach($professions as $profession){ |
|
296 | - $values = $job->getClassifications()->getProfessions()->getValues(); |
|
297 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
298 | - $job->getClassifications()->getProfessions()->getItems()->add($profession); |
|
299 | - } |
|
300 | - } |
|
301 | - } |
|
292 | + private function addProfessions(Job &$job,$terms) |
|
293 | + { |
|
294 | + $professions = $this->getCategories($terms); |
|
295 | + foreach($professions as $profession){ |
|
296 | + $values = $job->getClassifications()->getProfessions()->getValues(); |
|
297 | + if(!is_array($values) || !in_array($profession,$values)){ |
|
298 | + $job->getClassifications()->getProfessions()->getItems()->add($profession); |
|
299 | + } |
|
300 | + } |
|
301 | + } |
|
302 | 302 | |
303 | - private function addIndustries(Job &$job, $terms) |
|
304 | - { |
|
305 | - $industries = $this->getCategories($terms); |
|
306 | - foreach($industries as $industry){ |
|
307 | - $values = $job->getClassifications()->getIndustries()->getValues(); |
|
308 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
309 | - $job->getClassifications()->getIndustries()->getItems()->add($industry); |
|
310 | - } |
|
311 | - } |
|
312 | - } |
|
303 | + private function addIndustries(Job &$job, $terms) |
|
304 | + { |
|
305 | + $industries = $this->getCategories($terms); |
|
306 | + foreach($industries as $industry){ |
|
307 | + $values = $job->getClassifications()->getIndustries()->getValues(); |
|
308 | + if(!is_array($values) || !in_array($industry,$values)){ |
|
309 | + $job->getClassifications()->getIndustries()->getItems()->add($industry); |
|
310 | + } |
|
311 | + } |
|
312 | + } |
|
313 | 313 | |
314 | - /** |
|
315 | - * @param array $categories |
|
316 | - * |
|
317 | - * @return mixed |
|
318 | - */ |
|
319 | - private function getCategories(array $categories) |
|
320 | - { |
|
321 | - $catRepo = $this->getCategoriesRepository(); |
|
314 | + /** |
|
315 | + * @param array $categories |
|
316 | + * |
|
317 | + * @return mixed |
|
318 | + */ |
|
319 | + private function getCategories(array $categories) |
|
320 | + { |
|
321 | + $catRepo = $this->getCategoriesRepository(); |
|
322 | 322 | |
323 | - // get a professions |
|
324 | - $qb = $catRepo->createQueryBuilder() |
|
325 | - ->field('name')->in($categories) |
|
326 | - ->getQuery() |
|
327 | - ; |
|
328 | - $results = $qb->execute(); |
|
329 | - return $results->toArray(); |
|
330 | - } |
|
323 | + // get a professions |
|
324 | + $qb = $catRepo->createQueryBuilder() |
|
325 | + ->field('name')->in($categories) |
|
326 | + ->getQuery() |
|
327 | + ; |
|
328 | + $results = $qb->execute(); |
|
329 | + return $results->toArray(); |
|
330 | + } |
|
331 | 331 | |
332 | 332 | |
333 | - /** |
|
334 | - * @return Job |
|
335 | - */ |
|
336 | - private function getCurrentUserJobDraft($jobTitle) |
|
337 | - { |
|
338 | - $repo = $this->getJobRepository(); |
|
339 | - $user = $this->getCurrentUser(); |
|
333 | + /** |
|
334 | + * @return Job |
|
335 | + */ |
|
336 | + private function getCurrentUserJobDraft($jobTitle) |
|
337 | + { |
|
338 | + $repo = $this->getJobRepository(); |
|
339 | + $user = $this->getCurrentUser(); |
|
340 | 340 | |
341 | - $job = $repo->findDraft($user); |
|
341 | + $job = $repo->findDraft($user); |
|
342 | 342 | |
343 | - if(is_null($job)){ |
|
344 | - $job = new Job(); |
|
345 | - $job |
|
346 | - ->setUser($user) |
|
347 | - ->setOrganization($user->getOrganization()->getOrganization()) |
|
348 | - ->setStatus(StatusInterface::CREATED) |
|
349 | - ; |
|
350 | - $job->setIsDraft(true); |
|
351 | - } |
|
352 | - $job->setTitle($jobTitle); |
|
353 | - $repo->store($job); |
|
354 | - return $job; |
|
355 | - } |
|
343 | + if(is_null($job)){ |
|
344 | + $job = new Job(); |
|
345 | + $job |
|
346 | + ->setUser($user) |
|
347 | + ->setOrganization($user->getOrganization()->getOrganization()) |
|
348 | + ->setStatus(StatusInterface::CREATED) |
|
349 | + ; |
|
350 | + $job->setIsDraft(true); |
|
351 | + } |
|
352 | + $job->setTitle($jobTitle); |
|
353 | + $repo->store($job); |
|
354 | + return $job; |
|
355 | + } |
|
356 | 356 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | { |
58 | 58 | $repo = static::$jobRepo; |
59 | 59 | $results = $repo->findBy(['user' => $user]); |
60 | - foreach($results as $result){ |
|
61 | - $repo->remove($result,true); |
|
60 | + foreach ($results as $result) { |
|
61 | + $repo->remove($result, true); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public function beforeScenario(BeforeScenarioScope $scope) |
71 | 71 | { |
72 | 72 | $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
73 | - if(is_null(static::$jobRepo)){ |
|
73 | + if (is_null(static::$jobRepo)) { |
|
74 | 74 | $this->gatherContexts($scope); |
75 | 75 | static::$jobRepo = $this->getJobRepository(); |
76 | 76 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function iGoToCreateJob() |
91 | 91 | { |
92 | - $url = $this->generateUrl('lang/jobs/manage',['action' => 'edit']); |
|
92 | + $url = $this->generateUrl('lang/jobs/manage', ['action' => 'edit']); |
|
93 | 93 | $this->visit($url); |
94 | 94 | } |
95 | 95 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | public function iGoToEditJobWithTitle($jobTitle) |
110 | 110 | { |
111 | 111 | $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
112 | - if(!$job instanceof Job){ |
|
113 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
112 | + if (!$job instanceof Job) { |
|
113 | + throw new \Exception(sprintf('Job with title "%s" is not found', $jobTitle)); |
|
114 | 114 | } |
115 | 115 | $this->currentJob = $job; |
116 | - $url = $this->generateUrl('lang/jobs/manage',[ |
|
116 | + $url = $this->generateUrl('lang/jobs/manage', [ |
|
117 | 117 | 'id' => $job->getId() |
118 | 118 | ]); |
119 | 119 | $this->visit($url); |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | $jobRepository = $this->getJobRepository(); |
141 | 141 | $results = $jobRepository->getUserJobs($user->getId()); |
142 | - foreach($results as $job){ |
|
143 | - $jobRepository->remove($job,true); |
|
142 | + foreach ($results as $job) { |
|
143 | + $jobRepository->remove($job, true); |
|
144 | 144 | } |
145 | 145 | $this->currentJob = null; |
146 | 146 | } |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | * @When I fill job location search with :search and choose :choice |
150 | 150 | * |
151 | 151 | */ |
152 | - public function iFillJobLocationAndChoose($search,$choice) |
|
152 | + public function iFillJobLocationAndChoose($search, $choice) |
|
153 | 153 | { |
154 | 154 | $select2 = $this->select2Context; |
155 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
155 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]', $search, $choice); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * @When I choose :value from :field |
160 | 160 | */ |
161 | - public function iJobClassificationSelect($value,$field) |
|
161 | + public function iJobClassificationSelect($value, $field) |
|
162 | 162 | { |
163 | 163 | $field = Inflector::camelize($field); |
164 | 164 | |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | 'employmentTypes' => "select#classifications-employmentTypes", |
175 | 175 | ]; |
176 | 176 | |
177 | - if(!isset($mapSelect2[$field])){ |
|
177 | + if (!isset($mapSelect2[$field])) { |
|
178 | 178 | throw new \Exception('Undefined field selection value "'.$field.'"'); |
179 | 179 | } |
180 | 180 | |
181 | 181 | $multipleField = $mapMultiple[$field]; |
182 | 182 | $page = $this->minkContext->getSession()->getPage(); |
183 | - $element = $page->find('css',$mapMultiple[$field]); |
|
184 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
185 | - $this->minkContext->selectOption($value,$multipleField); |
|
186 | - }else{ |
|
183 | + $element = $page->find('css', $mapMultiple[$field]); |
|
184 | + if (!is_null($element) && $element->getAttribute('multiple') == 'multiple') { |
|
185 | + $this->minkContext->selectOption($value, $multipleField); |
|
186 | + } else { |
|
187 | 187 | $locator = $mapSelect2[$field]; |
188 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
188 | + $this->select2Context->iFillInSelect2Field($locator, $value); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -209,62 +209,62 @@ discard block |
||
209 | 209 | * @When I have a :status job with the following: |
210 | 210 | * @param TableNode $fields |
211 | 211 | */ |
212 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
212 | + public function iHaveAJobWithTheFollowing($status, TableNode $fields) |
|
213 | 213 | { |
214 | 214 | $normalizedField = [ |
215 | 215 | 'template' => 'modern', |
216 | 216 | ]; |
217 | - foreach($fields->getRowsHash() as $field => $value){ |
|
217 | + foreach ($fields->getRowsHash() as $field => $value) { |
|
218 | 218 | $field = Inflector::camelize($field); |
219 | - if($field == 'professions' || $field == 'industries'){ |
|
220 | - $value = explode(',',$value); |
|
219 | + if ($field == 'professions' || $field == 'industries') { |
|
220 | + $value = explode(',', $value); |
|
221 | 221 | } |
222 | 222 | $normalizedField[$field] = $value; |
223 | 223 | } |
224 | 224 | $jobRepo = $this->getJobRepository(); |
225 | 225 | $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]); |
226 | - if(!$job instanceof Job){ |
|
226 | + if (!$job instanceof Job) { |
|
227 | 227 | $job = new Job(); |
228 | 228 | $job->setTitle($normalizedField['title']); |
229 | 229 | } |
230 | - if(isset($normalizedField['user'])){ |
|
230 | + if (isset($normalizedField['user'])) { |
|
231 | 231 | /* @var $userRepo UserRepository */ |
232 | 232 | $userRepo = $this->getRepository('Auth\Entity\User'); |
233 | 233 | $user = $userRepo->findOneBy(['login' => $normalizedField['user']]); |
234 | - if($user instanceof User){ |
|
234 | + if ($user instanceof User) { |
|
235 | 235 | $job->setUser($user); |
236 | 236 | $job->setOrganization($user->getOrganization()->getOrganization()); |
237 | - }else{ |
|
237 | + } else { |
|
238 | 238 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | - if($status == 'draft'){ |
|
242 | + if ($status == 'draft') { |
|
243 | 243 | $job->setIsDraft(true); |
244 | - }elseif($status == 'published'){ |
|
244 | + }elseif ($status == 'published') { |
|
245 | 245 | $job->setIsDraft(false); |
246 | 246 | $job->setDatePublishStart(new \DateTime()); |
247 | 247 | } |
248 | 248 | $job->setStatus(Status::ACTIVE); |
249 | 249 | |
250 | - if(isset($normalizedField['location'])){ |
|
251 | - $this->setLocation($job,$normalizedField['location']); |
|
250 | + if (isset($normalizedField['location'])) { |
|
251 | + $this->setLocation($job, $normalizedField['location']); |
|
252 | 252 | } |
253 | - if(isset($normalizedField['companyName'])){ |
|
253 | + if (isset($normalizedField['companyName'])) { |
|
254 | 254 | //$job->setCompany($normalizedField['companyName']); |
255 | 255 | } |
256 | - if(isset($normalizedField['professions'])){ |
|
257 | - $this->addProfessions($job,$normalizedField['professions']); |
|
256 | + if (isset($normalizedField['professions'])) { |
|
257 | + $this->addProfessions($job, $normalizedField['professions']); |
|
258 | 258 | } |
259 | 259 | |
260 | - if(isset($normalizedField['industries'])){ |
|
261 | - $this->addIndustries($job,$normalizedField['industries']); |
|
260 | + if (isset($normalizedField['industries'])) { |
|
261 | + $this->addIndustries($job, $normalizedField['industries']); |
|
262 | 262 | } |
263 | - if(isset($normalizedField['employmentTypes'])){ |
|
263 | + if (isset($normalizedField['employmentTypes'])) { |
|
264 | 264 | $types = $this->getCategories([$normalizedField['employmentTypes']]); |
265 | 265 | $type = array_shift($types); |
266 | 266 | $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
267 | - if(!is_array($values) || !in_array($type,$values)){ |
|
267 | + if (!is_array($values) || !in_array($type, $values)) { |
|
268 | 268 | $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
269 | 269 | } |
270 | 270 | } |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | $location->fromString($serialized); |
284 | 284 | |
285 | 285 | $locations = $job->getLocations(); |
286 | - if(count($locations)){ |
|
286 | + if (count($locations)) { |
|
287 | 287 | $locations->clear(); |
288 | 288 | } |
289 | 289 | $job->getLocations()->add($location); |
290 | 290 | } |
291 | 291 | |
292 | - private function addProfessions(Job &$job,$terms) |
|
292 | + private function addProfessions(Job &$job, $terms) |
|
293 | 293 | { |
294 | 294 | $professions = $this->getCategories($terms); |
295 | - foreach($professions as $profession){ |
|
295 | + foreach ($professions as $profession) { |
|
296 | 296 | $values = $job->getClassifications()->getProfessions()->getValues(); |
297 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
297 | + if (!is_array($values) || !in_array($profession, $values)) { |
|
298 | 298 | $job->getClassifications()->getProfessions()->getItems()->add($profession); |
299 | 299 | } |
300 | 300 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | private function addIndustries(Job &$job, $terms) |
304 | 304 | { |
305 | 305 | $industries = $this->getCategories($terms); |
306 | - foreach($industries as $industry){ |
|
306 | + foreach ($industries as $industry) { |
|
307 | 307 | $values = $job->getClassifications()->getIndustries()->getValues(); |
308 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
308 | + if (!is_array($values) || !in_array($industry, $values)) { |
|
309 | 309 | $job->getClassifications()->getIndustries()->getItems()->add($industry); |
310 | 310 | } |
311 | 311 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | |
341 | 341 | $job = $repo->findDraft($user); |
342 | 342 | |
343 | - if(is_null($job)){ |
|
343 | + if (is_null($job)) { |
|
344 | 344 | $job = new Job(); |
345 | 345 | $job |
346 | 346 | ->setUser($user) |
@@ -171,13 +171,13 @@ |
||
171 | 171 | $response_externalIdUpdate = $decodedBody->applyIdUpdate; |
172 | 172 | |
173 | 173 | if ($publisher->externalId != $response_externalIdUpdate || $publisher->reference != $response_referenceUpdate) { |
174 | - $logInfo = 'RestCall changed externalID [' |
|
175 | - . var_export($publisher->externalId, true) |
|
176 | - . ' => ' |
|
177 | - . var_export($response_externalIdUpdate, true) . '], reference [' |
|
178 | - . var_export($publisher->reference, true) |
|
179 | - . ' => ' |
|
180 | - . var_export($response_referenceUpdate, true) . ']'; |
|
174 | + $logInfo = 'RestCall changed externalID [' |
|
175 | + . var_export($publisher->externalId, true) |
|
176 | + . ' => ' |
|
177 | + . var_export($response_externalIdUpdate, true) . '], reference [' |
|
178 | + . var_export($publisher->reference, true) |
|
179 | + . ' => ' |
|
180 | + . var_export($response_referenceUpdate, true) . ']'; |
|
181 | 181 | $log->info($logInfo); |
182 | 182 | $publisher->reference = $response_referenceUpdate; |
183 | 183 | $publisher->externalId = $response_externalIdUpdate; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param EventManagerInterface $events |
47 | 47 | * @return $this |
48 | 48 | */ |
49 | - public function attach(EventManagerInterface $events, $priority=1) |
|
49 | + public function attach(EventManagerInterface $events, $priority = 1) |
|
50 | 50 | { |
51 | 51 | return $this; |
52 | 52 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $jsonLastError = json_last_error(); |
165 | 165 | if (json_last_error() != JSON_ERROR_NONE) { |
166 | 166 | // not able to decode json |
167 | - $log->info('RestCall Response not Json [errorCode: ' . $jsonLastError . ']: ' . var_export($body, true)); |
|
167 | + $log->info('RestCall Response not Json [errorCode: '.$jsonLastError.']: '.var_export($body, true)); |
|
168 | 168 | } else { |
169 | 169 | // does the provider want to have an own ID for Identification ? |
170 | 170 | $response_referenceUpdate = $decodedBody->referenceUpdate; |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $logInfo = 'RestCall changed externalID [' |
175 | 175 | . var_export($publisher->externalId, true) |
176 | 176 | . ' => ' |
177 | - . var_export($response_externalIdUpdate, true) . '], reference [' |
|
177 | + . var_export($response_externalIdUpdate, true).'], reference [' |
|
178 | 178 | . var_export($publisher->reference, true) |
179 | 179 | . ' => ' |
180 | - . var_export($response_referenceUpdate, true) . ']'; |
|
180 | + . var_export($response_referenceUpdate, true).']'; |
|
181 | 181 | $log->info($logInfo); |
182 | 182 | $publisher->reference = $response_referenceUpdate; |
183 | 183 | $publisher->externalId = $response_externalIdUpdate; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function onJobAccepted(JobEvent $e) |
108 | 108 | { |
109 | - $target = $e->getTarget(); |
|
109 | + $target = $e->getTarget(); |
|
110 | 110 | |
111 | 111 | $this->sendMail( |
112 | 112 | $target->getJobEntity(), |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | { |
142 | 142 | $mail = $this->mailer->get('htmltemplate'); |
143 | 143 | $mail->setTemplate($template) |
144 | - ->setSubject($subject) |
|
145 | - ->setVariables( |
|
146 | - array( |
|
144 | + ->setSubject($subject) |
|
145 | + ->setVariables( |
|
146 | + array( |
|
147 | 147 | 'job' => $job, |
148 | 148 | 'siteName' => $this->options['siteName'], |
149 | 149 | ) |
150 | - ); |
|
150 | + ); |
|
151 | 151 | |
152 | 152 | if ($adminMail) { |
153 | 153 | $mail->setTo($this->options['adminEmail']); |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $this->options = array_merge($this->options, $options); |
63 | 63 | } |
64 | 64 | |
65 | - public function attach(EventManagerInterface $events, $priority=1) |
|
65 | + public function attach(EventManagerInterface $events, $priority = 1) |
|
66 | 66 | { |
67 | 67 | $this->listeners[] = $events->attach(JobEvent::EVENT_JOB_CREATED, array($this, 'onJobCreated')); |
68 | 68 | $this->listeners[] = $events->attach(JobEvent::EVENT_JOB_ACCEPTED, array($this, 'onJobAccepted')); |
@@ -31,54 +31,54 @@ |
||
31 | 31 | */ |
32 | 32 | class ViewModelTemplateFilterFactory implements FactoryInterface |
33 | 33 | { |
34 | - /** |
|
35 | - * @var ServiceLocatorInterface |
|
36 | - */ |
|
37 | - protected $service; |
|
34 | + /** |
|
35 | + * @var ServiceLocatorInterface |
|
36 | + */ |
|
37 | + protected $service; |
|
38 | 38 | |
39 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
40 | - { |
|
41 | - $this->service = $container; |
|
42 | - return $this; |
|
43 | - } |
|
39 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
40 | + { |
|
41 | + $this->service = $container; |
|
42 | + return $this; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param $element |
|
47 | - * @return \Zend\View\Model\ViewModel |
|
48 | - * @throws \InvalidArgumentException |
|
49 | - * @TODO: [ZF3] renamed this method into getModel because conflict with FactoryInterface::__invoke() method |
|
50 | - */ |
|
51 | - public function getModel($element) |
|
52 | - { |
|
53 | - $filter = null; |
|
54 | - if ($element instanceof EntityInterface) { |
|
55 | - $filter = new ViewModelTemplateFilterJob; |
|
56 | - } |
|
57 | - if ($element instanceof Element) { |
|
58 | - $filter = new ViewModelTemplateFilterForm; |
|
59 | - $viewHelperManager = $this->service->get('ViewHelperManager'); |
|
60 | - $viewHelperForm = $viewHelperManager->get('formSimple'); |
|
61 | - $filter->setViewHelperForm($viewHelperForm); |
|
62 | - } |
|
63 | - if (!isset($filter)) { |
|
64 | - throw new \InvalidArgumentException(get_class($element) . ' cannot be used to initialize a template'); |
|
65 | - } |
|
66 | - $viewManager = $this->service->get('ViewHelperManager'); |
|
67 | - $basePathHelper = $viewManager->get('basePath'); |
|
68 | - $serverUrlHelper = $viewManager->get('serverUrl'); |
|
69 | - $imageFileCacheHelper = $this->service->get('Organizations\ImageFileCache\Manager'); |
|
70 | - $filter->setBasePathHelper($basePathHelper); |
|
71 | - $filter->setImageFileCacheHelper($imageFileCacheHelper); |
|
72 | - $filter->setServerUrlHelper($serverUrlHelper); |
|
45 | + /** |
|
46 | + * @param $element |
|
47 | + * @return \Zend\View\Model\ViewModel |
|
48 | + * @throws \InvalidArgumentException |
|
49 | + * @TODO: [ZF3] renamed this method into getModel because conflict with FactoryInterface::__invoke() method |
|
50 | + */ |
|
51 | + public function getModel($element) |
|
52 | + { |
|
53 | + $filter = null; |
|
54 | + if ($element instanceof EntityInterface) { |
|
55 | + $filter = new ViewModelTemplateFilterJob; |
|
56 | + } |
|
57 | + if ($element instanceof Element) { |
|
58 | + $filter = new ViewModelTemplateFilterForm; |
|
59 | + $viewHelperManager = $this->service->get('ViewHelperManager'); |
|
60 | + $viewHelperForm = $viewHelperManager->get('formSimple'); |
|
61 | + $filter->setViewHelperForm($viewHelperForm); |
|
62 | + } |
|
63 | + if (!isset($filter)) { |
|
64 | + throw new \InvalidArgumentException(get_class($element) . ' cannot be used to initialize a template'); |
|
65 | + } |
|
66 | + $viewManager = $this->service->get('ViewHelperManager'); |
|
67 | + $basePathHelper = $viewManager->get('basePath'); |
|
68 | + $serverUrlHelper = $viewManager->get('serverUrl'); |
|
69 | + $imageFileCacheHelper = $this->service->get('Organizations\ImageFileCache\Manager'); |
|
70 | + $filter->setBasePathHelper($basePathHelper); |
|
71 | + $filter->setImageFileCacheHelper($imageFileCacheHelper); |
|
72 | + $filter->setServerUrlHelper($serverUrlHelper); |
|
73 | 73 | |
74 | - if($filter instanceof ViewModelTemplateFilterJob || method_exists($filter,'setJsonLdHelper')){ |
|
75 | - $jsonLdHelper = $viewManager->get(JsonLd::class); |
|
76 | - $filter->setJsonLdHelper($jsonLdHelper); |
|
77 | - } |
|
78 | - $urlPlugin = $this->service->get('ControllerPluginManager')->get('url'); |
|
79 | - $filter->setUrlPlugin($urlPlugin); |
|
80 | - $options = $this->service->get('Jobs/Options'); |
|
81 | - $filter->setConfig($options); |
|
82 | - return $filter->filter($element); |
|
83 | - } |
|
74 | + if($filter instanceof ViewModelTemplateFilterJob || method_exists($filter,'setJsonLdHelper')){ |
|
75 | + $jsonLdHelper = $viewManager->get(JsonLd::class); |
|
76 | + $filter->setJsonLdHelper($jsonLdHelper); |
|
77 | + } |
|
78 | + $urlPlugin = $this->service->get('ControllerPluginManager')->get('url'); |
|
79 | + $filter->setUrlPlugin($urlPlugin); |
|
80 | + $options = $this->service->get('Jobs/Options'); |
|
81 | + $filter->setConfig($options); |
|
82 | + return $filter->filter($element); |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | \ No newline at end of file |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $service; |
38 | 38 | |
39 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
39 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
40 | 40 | { |
41 | 41 | $this->service = $container; |
42 | 42 | return $this; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $filter->setViewHelperForm($viewHelperForm); |
62 | 62 | } |
63 | 63 | if (!isset($filter)) { |
64 | - throw new \InvalidArgumentException(get_class($element) . ' cannot be used to initialize a template'); |
|
64 | + throw new \InvalidArgumentException(get_class($element).' cannot be used to initialize a template'); |
|
65 | 65 | } |
66 | 66 | $viewManager = $this->service->get('ViewHelperManager'); |
67 | 67 | $basePathHelper = $viewManager->get('basePath'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $filter->setImageFileCacheHelper($imageFileCacheHelper); |
72 | 72 | $filter->setServerUrlHelper($serverUrlHelper); |
73 | 73 | |
74 | - if($filter instanceof ViewModelTemplateFilterJob || method_exists($filter,'setJsonLdHelper')){ |
|
74 | + if ($filter instanceof ViewModelTemplateFilterJob || method_exists($filter, 'setJsonLdHelper')) { |
|
75 | 75 | $jsonLdHelper = $viewManager->get(JsonLd::class); |
76 | 76 | $filter->setJsonLdHelper($jsonLdHelper); |
77 | 77 | } |
@@ -47,10 +47,10 @@ |
||
47 | 47 | $params = $viewHelper->get('params'); |
48 | 48 | $serverUrl = $viewHelper->get('serverUrl'); |
49 | 49 | |
50 | - $helper = new JobUrl(); |
|
50 | + $helper = new JobUrl(); |
|
51 | 51 | $helper->setUrlHelper($url) |
52 | - ->setParamsHelper($params) |
|
53 | - ->setServerUrlHelper($serverUrl); |
|
52 | + ->setParamsHelper($params) |
|
53 | + ->setServerUrlHelper($serverUrl); |
|
54 | 54 | return $helper; |
55 | 55 | } |
56 | 56 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $params = $viewHelper->get('params'); |
48 | 48 | $serverUrl = $viewHelper->get('serverUrl'); |
49 | 49 | |
50 | - $helper = new JobUrl(); |
|
50 | + $helper = new JobUrl(); |
|
51 | 51 | $helper->setUrlHelper($url) |
52 | 52 | ->setParamsHelper($params) |
53 | 53 | ->setServerUrlHelper($serverUrl); |
@@ -44,11 +44,11 @@ |
||
44 | 44 | $params = $viewHelper->get('params'); |
45 | 45 | $serverUrl = $viewHelper->get('serverUrl'); |
46 | 46 | |
47 | - $helper = new ApplyUrl(); |
|
47 | + $helper = new ApplyUrl(); |
|
48 | 48 | $helper->setUrlHelper($url) |
49 | - ->setTranslateHelper($translate) |
|
50 | - ->setParamsHelper($params) |
|
51 | - ->setServerUrlHelper($serverUrl); |
|
49 | + ->setTranslateHelper($translate) |
|
50 | + ->setParamsHelper($params) |
|
51 | + ->setServerUrlHelper($serverUrl); |
|
52 | 52 | return $helper; |
53 | 53 | } |
54 | 54 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $params = $viewHelper->get('params'); |
45 | 45 | $serverUrl = $viewHelper->get('serverUrl'); |
46 | 46 | |
47 | - $helper = new ApplyUrl(); |
|
47 | + $helper = new ApplyUrl(); |
|
48 | 48 | $helper->setUrlHelper($url) |
49 | 49 | ->setTranslateHelper($translate) |
50 | 50 | ->setParamsHelper($params) |
@@ -33,17 +33,17 @@ |
||
33 | 33 | */ |
34 | 34 | $jobRepository = $container->get('repositories')->get('Jobs/Job'); |
35 | 35 | $options = $container->get('Jobs/Options'); |
36 | - $viewModelTemplateFilter = $container->get('Jobs/ViewModelTemplateFilter'); |
|
37 | - $translator = $container->get('translator'); |
|
38 | - $viewHelper = $container->get('ViewHelperManager'); |
|
39 | - $formManager = $container->get('FormElementManager'); |
|
36 | + $viewModelTemplateFilter = $container->get('Jobs/ViewModelTemplateFilter'); |
|
37 | + $translator = $container->get('translator'); |
|
38 | + $viewHelper = $container->get('ViewHelperManager'); |
|
39 | + $formManager = $container->get('FormElementManager'); |
|
40 | 40 | return new TemplateController( |
41 | - $jobRepository, |
|
42 | - $viewModelTemplateFilter, |
|
43 | - $translator, |
|
44 | - $options, |
|
45 | - $viewHelper, |
|
46 | - $formManager |
|
41 | + $jobRepository, |
|
42 | + $viewModelTemplateFilter, |
|
43 | + $translator, |
|
44 | + $options, |
|
45 | + $viewHelper, |
|
46 | + $formManager |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | } |