Completed
Push — develop ( b559a4...dfd31d )
by
unknown
18:18 queued 10:06
created

Organization::getName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
6
 * @license   MIT
7
 */
8
9
namespace Organizations\Entity;
10
11
use Auth\Entity\UserInterface;
12
use Core\Entity\AbstractIdentifiableModificationDateAwareEntity as BaseEntity;
13
use Core\Entity\Collection\ArrayCollection;
14
use Doctrine\Common\Collections\Collection;
15
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
16
use Core\Entity\Permissions;
17
use Core\Entity\PermissionsInterface;
18
use Core\Entity\EntityInterface;
19
use Zend\Hydrator\HydratorInterface;
20
use Core\Entity\Hydrator\EntityHydrator;
21
use Core\Entity\DraftableEntityInterface;
22
23
/**
24
 * The organization.
25
 *
26
 * @ODM\Document(collection="organizations", repositoryClass="Organizations\Repository\Organization")
27
 * @ODM\HasLifecycleCallbacks
28
 * @ODM\Indexes({
29
 *      @ODM\Index(keys={
30
 *          "_organizationName"="text"
31
 *      }, name="fulltext")
32
 * })
33
 *
34
 * @todo write test
35
 * @author Mathias Weitz <[email protected]>
36
 * @author Mathias Gelhausen <[email protected]>
37
 */
38
class Organization extends BaseEntity implements OrganizationInterface, DraftableEntityInterface
0 ignored issues
show
Coding Style introduced by
The property $_organizationName is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
39
{
40
    /**
41
     * Event name of post construct event.
42
     *
43
     * @var string
44
     */
45
    const postConstruct = 'postRepositoryConstruct';
0 ignored issues
show
Coding Style introduced by
This class constant is not uppercase (expected POSTCONSTRUCT).
Loading history...
46
47
    /**
48
     * externalId. Allows external applications to reference their primary key.
49
     *
50
     * @var string
51
     * @ODM\Field(type="string")
52
     * @ODM\Index
53
     */
54
    protected $externalId;
55
    
56
    /**
57
     * The actual name of the organization.
58
     *
59
     * @var \Organizations\Entity\OrganizationName
60
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\OrganizationName", simple=true, cascade="persist")
61
     */
62
    protected $organizationName;
63
    
64
    /**
65
     * Only for sorting/searching purposes
66
     *
67
     * @var string
68
     * @ODM\Field(type="string")
69
     */
70
    protected $_organizationName;
0 ignored issues
show
Coding Style introduced by
$_organizationName does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
71
72
    /**
73
     * Assigned permissions.
74
     *
75
     * @var PermissionsInterface
76
     * @ODM\EmbedOne(targetDocument="\Core\Entity\Permissions")
77
     */
78
    protected $permissions;
79
    
80
    /**
81
     * primary logo of an organization
82
     *
83
     * @var \Organizations\Entity\OrganizationImage
84
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\OrganizationImage", inversedBy="organization", simple=true, nullable="true", cascade={"all"})
85
     */
86
    protected $image;
87
88
    /**
89
     * Flag indicating draft state of this job.
90
     *
91
     * @var bool
92
     * @ODM\Boolean
93
     */
94
    protected $isDraft = false;
95
    
96
    /**
97
     * Organization contact data.
98
     *
99
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\OrganizationContact") */
100
    protected $contact;
101
102
    /**
103
     * The organizations' description.
104
     *
105
     * @var string
106
     * @ODM\Field(type="string")
107
     */
108
    protected $description;
109
110
    /**
111
     * The parent of this organization.
112
     *
113
     * @see setParent()
114
     * @var OrganizationInterface | null
115
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\Organization", simple=true, nullable=true)
116
     * @since 0.18
117
     */
118
    protected $parent;
119
120
    /**
121
     * The hiring organizations of this organization.
122
     *
123
     * @var Collection
124
     * @ODM\ReferenceMany(
125
     *      targetDocument="Organizations\Entity\Organization",
126
     *      repositoryMethod="getHiringOrganizationsCursor"
127
     * )
128
     * @since 0.18
129
     */
130
    protected $hiringOrganizations;
131
132
    /**
133
     * The associated employees (users)
134
     *
135
     * @ODM\EmbedMany(targetDocument="\Organizations\Entity\Employee")
136
     * @var Collection
137
     */
138
    protected $employees;
139
140
    /**
141
     * Jobs of this organization.
142
     *
143
     * @var Collection
144
     * @ODM\ReferenceMany(targetDocument="\Jobs\Entity\Job", simple=true, mappedBy="organization")
145
     * @since 0.18
146
     */
147
    protected $jobs;
148
149
    /**
150
     * the owner of a Organization
151
     *
152
     * @var UserInterface $user
153
     * @ODM\ReferenceOne(targetDocument="\Auth\Entity\User", simple=true)
154
     * @ODM\Index
155
     */
156
    protected $user;
157
158
    /**
159
     * Default values of an organizations job template
160
     *
161
     * @var TemplateInterface;
162
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\Template")
163
     */
164
    protected $template;
165
166
    /**
167
     * Default values Workflow
168
     *
169
     * @var WorkflowSettingsInterface $workflowSettings;
170
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\WorkflowSettings")
171
     */
172
    protected $workflowSettings;
173
174
    /**
175
     * Sets the parent of an organization
176
     *
177
     * @param OrganizationInterface $parent
178
     *
179
     * @return $this
180
     */
181
    public function setParent(OrganizationInterface $parent)
182
    {
183
        $this->parent = $parent;
184
185
        return $this;
186
    }
187
188
    /**
189
     * Gets the parent of an organization
190
     *
191
     * @param bool $returnSelf returns itself, if this organization does not have a parent?
192
     *
193
     * @return null|OrganizationInterface
194
     */
195
    public function getParent($returnSelf = false)
196
    {
197
        return $this->parent ?: ($returnSelf ? $this : null);
198
    }
199
200
    /**
201
     * Gets linked organizations
202
     *
203
     * @return Collection
204
     */
205
    public function getHiringOrganizations()
206
    {
207
        return $this->hiringOrganizations;
208
    }
209
210
    /**
211
     * @return bool
212
     */
213
    public function isHiringOrganization()
214
    {
215
        return null !== $this->parent;
216
    }
217
218
    /**
219
     * Sets the external id.
220
     *
221
     * @param $externalId
222
     *
223
     * @return self
224
     */
225
    public function setExternalId($externalId)
226
    {
227
        $this->externalId = $externalId;
228
        return  $this;
229
    }
230
231
    /**
232
     * Gets the internal id.
233
     *
234
     * @return string
235
     */
236
    public function getExternalId()
237
    {
238
        return $this->externalId;
239
    }
240
241
    /**
242
     * @todo review this
243
     * @param HydratorInterface $hydrator
244
     *
245
     * @return $this
246
     */
247
    public function setHydrator(HydratorInterface $hydrator)
248
    {
249
        return $this;
250
    }
251
252
    /**
253
     * * @todo review this
254
     * @return EntityHydrator
255
     */
256
    public function getHydrator()
257
    {
258
        return new EntityHydrator();
259
    }
260
261
    /**
262
     * Sets the name of an organization
263
     *
264
     * @param OrganizationName $organizationName
265
     *
266
     * @return $this
267
     */
268
    public function setOrganizationName(OrganizationName $organizationName)
269
    {
270
        if (isset($this->organizationName)) {
271
            $this->organizationName->refCounterDec()->refCompanyCounterDec();
272
        }
273
        $this->organizationName = $organizationName;
274
        $this->organizationName->refCounterInc()->refCompanyCounterInc();
275
        $this->_organizationName = $organizationName->getName();
276
        return $this;
277
    }
278
279
    /**
280
     * Gets the organization name entity of an organisation
281
     *
282
     * @return OrganizationName
283
     */
284
    public function getOrganizationName()
285
    {
286
        return $this->organizationName;
287
    }
288
289
290
    /**
291
     * Gets the organization name
292
     *
293
     * @return string
294
     */
295
    public function getName()
296
    {
297
        if (empty($this->organizationName)) {
298
            return '';
299
        }
300
        return $this->organizationName->name;
0 ignored issues
show
Documentation introduced by
The property $name is declared protected in Organizations\Entity\OrganizationName. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
301
    }
302
303
    /**
304
     * @deprecated
305
     * @return array
306
     */
307
    public function getSearchableProperties()
308
    {
309
        return array();
310
    }
311
312
    /**
313
     * Gets the Permissions of an organization
314
     *
315
     * @return PermissionsInterface
316
     */
317
    public function getPermissions()
318
    {
319
        if (!$this->permissions) {
320
            $permissions = new Permissions();
321
            if ($this->user) {
322
                $permissions->grant($this->user, Permissions::PERMISSION_ALL);
0 ignored issues
show
Documentation introduced by
$this->user is of type object<Auth\Entity\UserInterface>, but the function expects a string|object<Core\Entit...sionsResourceInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
323
            }
324
            $this->setPermissions($permissions);
325
        }
326
        return $this->permissions;
327
    }
328
329
    /**
330
     * Sets the Permissions of an Organization
331
     *
332
     * @param PermissionsInterface $permissions
333
     *
334
     * @return $this
335
     */
336 View Code Duplication
    public function setPermissions(PermissionsInterface $permissions)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
337
    {
338
        // Assure the user has always all rights.
339
        if ($this->user) {
340
            $permissions->grant($this->user, Permissions::PERMISSION_ALL);
341
        }
342
        $this->permissions = $permissions;
343
        return $this;
344
    }
345
346
    /**
347
     * Gets the Permissions Resource ID
348
     *
349
     * @return string
350
     */
351
    public function getPermissionsResourceId()
352
    {
353
        return 'organization:' . $this->getId();
354
    }
355
356
    /**
357
     * @param null $type
358
     *
359
     * @return array
360
     */
361
    public function getPermissionsUserIds($type = null)
362
    {
363
        // if we have a user, grant him full access to all associated permissions.
364
        $user = $this->getUser();
365
        $spec = $user
366
              ? $spec = array(PermissionsInterface::PERMISSION_ALL => array($this->getUser()->getId()))
367
              : array();
368
369
        if (null === $type || ('Job/Permissions' != $type && 'Application' != $type)) {
370
            return $spec;
371
        }
372
373
        if ('Job/Permissions' == $type) {
374
            $change = EmployeePermissionsInterface::JOBS_CHANGE;
375
            $view = EmployeePermissionsInterface::JOBS_VIEW;
376
        } else {
377
            $change = EmployeePermissionsInterface::APPLICATIONS_CHANGE;
378
            $view = EmployeePermissionsInterface::APPLICATIONS_VIEW;
379
        }
380
381
        $employees = $this->isHiringOrganization()
382
            ? $this->getParent()->getEmployees()
383
            : $this->getEmployees();
384
385
        foreach ($employees as $emp) {
386
            /* @var $emp EmployeeInterface */
387
            if ($emp->isUnassigned()) {
388
                continue;
389
            }
390
391
            $perm = $emp->getPermissions();
392
            if ($perm->isAllowed($change)) {
393
                $spec[PermissionsInterface::PERMISSION_CHANGE][] = $emp->getUser()->getId();
394
            } elseif ($perm->isAllowed($view)) {
395
                $spec[PermissionsInterface::PERMISSION_VIEW][] = $emp->getUser()->getId();
396
            }
397
        }
398
399
        return $spec;
400
    }
401
402
    /**
403
     * Sets the logo of an organization
404
     *
405
     * @param OrganizationImage $image
0 ignored issues
show
Documentation introduced by
Should the type for parameter $image not be null|OrganizationImage?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
406
     *
407
     * @return self
408
     */
409
    public function setImage(OrganizationImage $image = null)
410
    {
411
        $this->image = $image;
412
        return $this;
413
    }
414
415
    /**
416
     * Gets the Logo of an organization
417
     *
418
     * @return OrganizationImage
419
     */
420
    public function getImage()
421
    {
422
        return $this->image;
423
    }
424
425
    /**
426
     * Sets the Contact Data of an organization
427
     *
428
     * @param EntityInterface $contact
0 ignored issues
show
Documentation introduced by
Should the type for parameter $contact not be null|EntityInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
429
     *
430
     * @return $this
431
     */
432
    public function setContact(EntityInterface $contact = null)
433
    {
434
        if (!$contact instanceof OrganizationContact) {
435
            $contact = new OrganizationContact($contact);
0 ignored issues
show
Unused Code introduced by
The call to OrganizationContact::__construct() has too many arguments starting with $contact.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
436
        }
437
        $this->contact = $contact;
438
        return $this;
439
    }
440
441
    /**
442
     * Gets the contact Data of an organization
443
     *
444
     * @return OrganizationContact
445
     */
446
    public function getContact()
447
    {
448
        if (!$this->contact instanceof OrganizationContact) {
449
            $this->contact = new OrganizationContact();
450
        }
451
        return $this->contact;
452
    }
453
454
    /**
455
     * Gets the Draft flag
456
     *
457
     * @return bool
458
     */
459
    public function isDraft()
460
    {
461
        return $this->isDraft;
462
    }
463
464
    /**
465
     * Sets the draft flag
466
     *
467
     * @param bool $flag
468
     *
469
     * @return $this
470
     */
471
    public function setIsDraft($flag)
472
    {
473
        $this->isDraft = (bool) $flag;
474
        return $this;
475
    }
476
477
    /**
478
     * Gets the default description of an organization.
479
     *
480
     * This description is used as the default of the company_description
481
     * used in a job template
482
     *
483
     * @return string
484
     */
485
    public function getDescription()
486
    {
487
        return $this->description;
488
    }
489
490
    /**
491
     * Set the default description af an organization
492
     *
493
     * @param string $description
494
     *
495
     * @return $this
496
     */
497
    public function setDescription($description)
498
    {
499
        $this->description = $description;
500
501
        return $this;
502
    }
503
504
    /**
505
     * Sets the the list of employees
506
     *
507
     * @param Collection $employees
508
     *
509
     * @return $this
510
     */
511
    public function setEmployees(Collection $employees)
512
    {
513
        /* todo: Throw exception or at least log incidents, where employees are added to "hiring orgs" */
514
        if (!$this->isHiringOrganization()) {
515
            $this->employees = $employees;
516
        }
517
518
        return $this;
519
    }
520
521
    /**
522
     * Gets the list of employees
523
     *
524
     * @return ArrayCollection|Collection
525
     */
526
    public function getEmployees()
527
    {
528
        if ($this->isHiringOrganization()) {
529
            // Always return empty list, as we never have employees in this case.
530
            return new ArrayCollection();
531
        }
532
533
        if (!$this->employees) {
534
            $this->setEmployees(new ArrayCollection());
535
        }
536
537
        return $this->employees;
538
    }
539
540
    /**
541
     * Gets an employee by User or ID.
542
     *
543
     * @param UserInterface|string $userOrId
544
     *
545
     * @return mixed|null
546
     */
547
    public function getEmployee($userOrId)
548
    {
549
        $employees = $this->getEmployees();
550
        $userId    = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;
551
552
        foreach ($employees as $employee) {
553
            if ($employee->getUser()->getId() == $userId) {
554
                return $employee;
555
            }
556
        }
557
558
        return null;
559
    }
560
561
    /**
562
     * Gets a list of Employees by a user role
563
     *
564
     * @param string $role
565
     * @return ArrayCollection
566
     */
567
    public function getEmployeesByRole($role){
568
        $employees = new ArrayCollection();
569
570
        /* @var \Organizations\Entity\Employee $employee */
571
        foreach ($this->getEmployees() as $employee) {
572
            if ($role === $employee->getRole()) {
573
                $employees->add($employee);
574
            }
575
        }
576
        return $employees;
577
    }
578
579
    /**
580
     * Checks, if a User is the owner of an organization
581
     *
582
     * @param UserInterface $user
583
     *
584
     * @return bool
585
     */
586
    public function isOwner(UserInterface $user)
587
    {
588
        return $this->getUser()->getId() == $user->getId();
589
    }
590
591
    /**
592
     * Returns true, if a User is an employee of the organization
593
     *
594
     * @param UserInterface $user
595
     *
596
     * @return bool
597
     */
598
    public function isEmployee(UserInterface $user)
599
    {
600
        return $this->refs && in_array($user->getId(), $this->refs->getEmployeeIds());
0 ignored issues
show
Documentation introduced by
The property refs does not exist on object<Organizations\Entity\Organization>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
601
    }
602
603
    /**
604
     * Returns true, if the user belongs to the organization.
605
     *
606
     * @param UserInterface $user
607
     *
608
     * @return bool
609
     */
610
    public function isAssociated(UserInterface $user)
611
    {
612
        return $this->isOwner($user) || $this->isEmployee($user);
613
    }
614
615
    /**
616
     * Updates the organizationsPermissions to allow all employees to view this organization.
617
     *
618
     * In case of a HiringOrganization Permissions are granted to all employees of the parent
619
     * organization.
620
     *
621
     * @ODM\PreUpdate
622
     * @ODM\PrePersist
623
     * @since 0.18
624
     */
625
    public function updatePermissions()
626
    {
627
        if ($this->isHiringOrganization()) {
628
            $organization = $this->getParent();
629
            $owner        = $organization->getUser();
630
631
            $this->setUser($owner);
632
        } else {
633
            $organization = $this;
634
        }
635
636
        /* @var $employees null | ArrayCollection | \Doctrine\ODM\MongoDB\PersistentCollection */
637
        $employees = $organization->getEmployees();
638
639
        $perms = $this->getPermissions();
640
641
        foreach ($employees as $emp) {
0 ignored issues
show
Bug introduced by
The expression $employees of type null is not traversable.
Loading history...
642
            /* @var $emp \Organizations\Entity\Employee */
643
            $perms->grant($emp->getUser(), PermissionsInterface::PERMISSION_CHANGE, false);
0 ignored issues
show
Unused Code introduced by
The call to PermissionsInterface::grant() has too many arguments starting with false.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
644
        }
645
        $perms->build();
646
    }
647
648 View Code Duplication
    public function setUser(UserInterface $user)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
649
    {
650
        if ($this->user) {
651
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
0 ignored issues
show
Unused Code introduced by
The call to PermissionsInterface::revoke() has too many arguments starting with false.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
652
        }
653
        $this->user = $user;
654
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
655
        return $this;
656
    }
657
658
    /**
659
     * Gets the owner of the organization
660
     *
661
     * @return UserInterface
662
     */
663
    public function getUser()
664
    {
665
        return $this->user;
666
    }
667
668
    /**
669
     * Gets the Jobs of an organization
670
     *
671
     * @return Collection
672
     */
673
    public function getJobs()
674
    {
675
        return $this->jobs;
676
    }
677
678
    /**
679
     * Gets default values of an organizations job template
680
     *
681
     * @return TemplateInterface
682
     */
683
    public function getTemplate()
684
    {
685
        if (null === $this->template){
686
            $this->template = new Template();
687
        }
688
        return $this->template;
689
    }
690
691
    /**
692
     * Sets default values of an organizations job template
693
     *
694
     * @return self
695
     */
696
    public function setTemplate(TemplateInterface $template)
697
    {
698
        $this->template=$template;
699
        return $this;
700
    }
701
702
    /**
703
     * Gets Workflow Settings
704
     *
705
     * @return WorkflowSettings|WorkflowSettingsInterface
706
     */
707
    public function getWorkflowSettings(){
708
        if (null == $this->workflowSettings) {
709
            $this->workflowSettings = new WorkflowSettings();
710
        }
711
        return $this->workflowSettings;
712
    }
713
714
    /**
715
     * Sets Workflow Settings
716
     *
717
     * @param $workflowSettings
718
     *
719
     * @return self
720
     */
721
    public function setWorkflowSettings($workflowSettings){
722
        $this->workflowSettings=$workflowSettings;
723
        return $this;
724
    }
725
}