Code Duplication    Length = 44-44 lines in 2 locations

src/Frontend/presenters/BusinessmanPresenter.php 1 location

@@ 18-61 (lines=44) @@
15
 *
16
 * @author Jakub Sanda <[email protected]>
17
 */
18
class BusinessmanPresenter extends BasePresenter
19
{
20
	private $id;
21
22
	private $businessman;
23
24
	/* \Nette\Http\Session */
25
	public $businessmanSession;
26
	
27
	protected function startup() 
28
    {
29
		parent::startup();
30
	}
31
32
	protected function beforeRender()
33
    {
34
		parent::beforeRender();	
35
	}
36
37
	public function actionDefault($id)
38
    {	
39
		if (isset($_GET['bcode'])) {
40
			
41
			$this->businessman = $this->em->getRepository('\WebCMS\InvestformModule\Entity\Businessman')->findOneBy(array(
42
                'businessUrl' => $_GET['bcode']
43
            ));
44
45
			if ($this->businessman) {
46
	            $this->businessmanSession = $this->getSession('businessman');
47
				$this->businessmanSession->id = $this->businessman->getId();
48
49
				$this->flashMessage('Your business code has been saved.', 'success');
50
			} else {
51
				$this->flashMessage('Wrong business code.', 'error');
52
			}
53
54
		}
55
56
57
58
		$this->redirect(':Frontend:Homepage:');
59
	}
60
61
}
62

src/Frontend/presenters/CompanyPresenter.php 1 location

@@ 18-61 (lines=44) @@
15
 *
16
 * @author Jakub Sanda <[email protected]>
17
 */
18
class CompanyPresenter extends BasePresenter
19
{
20
	private $id;
21
22
	private $businessman;
23
24
	/* \Nette\Http\Session */
25
	public $businessmanSession;
26
	
27
	protected function startup() 
28
    {
29
		parent::startup();
30
	}
31
32
	protected function beforeRender()
33
    {
34
		parent::beforeRender();	
35
	}
36
37
	public function actionDefault($id)
38
    {	
39
		if (isset($_GET['bcode'])) {
40
			
41
			$this->businessman = $this->em->getRepository('\WebCMS\InvestformModule\Entity\Businessman')->findOneBy(array(
42
                'businessUrl' => $_GET['bcode']
43
            ));
44
45
			if ($this->businessman) {
46
	            $this->businessmanSession = $this->getSession('businessman');
47
				$this->businessmanSession->id = $this->businessman->getId();
48
49
				$this->flashMessage('Your business code has been saved.', 'success');
50
			} else {
51
				$this->flashMessage('Wrong business code.', 'error');
52
			}
53
54
		}
55
56
57
58
		$this->redirect(':Frontend:Homepage:');
59
	}
60
61
}
62