1<?php
2/**
3 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
4 * all the essential functionalities required for any enterprise.
5 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
6 *
7 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
8 * the GNU General Public License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along with this program;
16 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA  02110-1301, USA
18 */
19
20namespace Orangehrm\Rest\Api\Pim\Entity;
21
22use Orangehrm\Rest\Api\Entity\Serializable;
23
24class WorkExperience implements Serializable
25{
26    /**
27     * @var
28     */
29    private $company = '';
30
31    private $jobTitle = '';
32
33    private $from = '';
34
35    private $to = '';
36
37    private $comment = '';
38
39    private $id;
40
41
42    /**
43     * @return mixed
44     */
45    public function getCompany()
46    {
47        return $this->company;
48    }
49
50    /**
51     * @param mixed $company
52     */
53    public function setCompany($company)
54    {
55        $this->company = $company;
56    }
57
58    /**
59     * @return string
60     */
61    public function getJobTitle()
62    {
63        return $this->jobTitle;
64    }
65
66    /**
67     * @param string $jobTitle
68     */
69    public function setJobTitle($jobTitle)
70    {
71        $this->jobTitle = $jobTitle;
72    }
73
74    /**
75     * @return string
76     */
77    public function getFrom()
78    {
79        return $this->from;
80    }
81
82    /**
83     * @param string $from
84     */
85    public function setFrom($from)
86    {
87        $this->from = $from;
88    }
89
90    /**
91     * @return string
92     */
93    public function getTo()
94    {
95        return $this->to;
96    }
97
98    /**
99     * @param string $to
100     */
101    public function setTo($to)
102    {
103        $this->to = $to;
104    }
105
106    /**
107     * @return string
108     */
109    public function getComment()
110    {
111        return $this->comment;
112    }
113
114    /**
115     * @param string $comment
116     */
117    public function setComment($comment)
118    {
119        $this->comment = $comment;
120    }
121
122    /**
123     * @return mixed
124     */
125    public function getId()
126    {
127        return $this->id;
128    }
129
130    /**
131     * @param mixed $id
132     */
133    public function setId($id)
134    {
135        $this->id = $id;
136    }
137
138
139    public function toArray()
140    {
141        return array(
142            'id'      => $this->getId(),
143            'company' => $this->getCompany(),
144            'jobTitle' => $this->getJobTitle(),
145            'fromDate' => $this->getFrom(),
146            'toDate'=> $this->getTo(),
147            'comment'=> $this->getComment()
148        );
149    }
150
151    public function build(\EmpWorkExperience $experience){
152
153        $this->setId($experience->getSeqno());
154        $this->setCompany($experience->getEmployer());
155        $this->setJobTitle($experience->getJobtitle());
156        $this->setFrom(substr($experience->getFromDate(), 0, -9));
157        $this->setTo(substr($experience->getToDate(), 0, -9));
158        $this->setComment($experience->getComments());
159
160    }
161}