employee = $employee; $this->start = new \DateTime('now'); $this->address = new Address(); } /** * Get media file by type * * @param int $type Media type * * @return Media * * @since 1.0.0 */ public function getFileByType(int $type) : Media { foreach ($this->files as $file) { if ($file->hasMediaTypeId($type)) { return $file; } } return new NullMedia(); } /** * Get all media files by type name * * @param string $type Media type * * @return Media * * @since 1.0.0 */ public function getFileByTypeName(string $type) : Media { foreach ($this->files as $file) { if ($file->hasMediaTypeName($type)) { return $file; } } return new NullMedia(); } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'employee' => \is_int($this->employee) ? $this->employee : $this->employee->id, 'educationTitle' => $this->educationTitle, 'passed' => $this->passed, 'score' => $this->score, 'start' => $this->start, 'end' => $this->end, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } use \Modules\Media\Models\MediaListTrait; }