Completed
Push — develop ( 83694e...386ced )
by
unknown
17:24 queued 08:59
created

Organization::setUser()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 9
Ratio 90 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 9
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
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 Core\Entity\DraftableEntityInterface;
15
use Core\Entity\EntityInterface;
16
use Core\Entity\Hydrator\EntityHydrator;
17
use Core\Entity\Permissions;
18
use Core\Entity\PermissionsInterface;
19
use Doctrine\Common\Collections\Collection;
20
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
21
use Zend\Hydrator\HydratorInterface;
22
use Zend\Permissions\Acl\Resource\ResourceInterface;
23
24
/**
25
 * The organization.
26
 *
27
 * @ODM\Document(collection="organizations", repositoryClass="Organizations\Repository\Organization")
28
 * @ODM\HasLifecycleCallbacks
29
 * @ODM\Indexes({
30
 *      @ODM\Index(keys={
31
 *          "_organizationName"="text"
32
 *      }, name="fulltext")
33
 * })
34
 *
35
 * @todo   write test
36
 * @author Mathias Weitz <[email protected]>
37
 * @author Mathias Gelhausen <[email protected]>
38
 */
39
class Organization extends BaseEntity implements
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...
40
    OrganizationInterface,
41
    DraftableEntityInterface,
42
    ResourceInterface
43
{
44
    /**
45
     * Event name of post construct event.
46
     *
47
     * @var string
48
     */
49
    const postConstruct = 'postRepositoryConstruct';
0 ignored issues
show
Coding Style introduced by
This class constant is not uppercase (expected POSTCONSTRUCT).
Loading history...
50
51
    /**
52
     * externalId. Allows external applications to reference their primary key.
53
     *
54
     * @var string
55
     * @ODM\Field(type="string")
56
     * @ODM\Index
57
     */
58
    protected $externalId;
59
60
    /**
61
     * The actual name of the organization.
62
     *
63
     * @var \Organizations\Entity\OrganizationName
64
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\OrganizationName", simple=true, cascade="persist")
65
     */
66
    protected $organizationName;
67
68
    /**
69
     * Only for sorting/searching purposes
70
     *
71
     * @var string
72
     * @ODM\Field(type="string")
73
     */
74
    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...
75
76
    /**
77
     * Assigned permissions.
78
     *
79
     * @var PermissionsInterface
80
     * @ODM\EmbedOne(targetDocument="\Core\Entity\Permissions")
81
     */
82
    protected $permissions;
83
84
    /**
85
     * primary logo of an organization
86
     *
87
     * @var \Organizations\Entity\OrganizationImage
88
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\OrganizationImage", inversedBy="organization", simple=true, nullable="true", cascade={"all"})
89
     */
90
    protected $image;
91
92
    /**
93
     * Flag indicating draft state of this job.
94
     *
95
     * @var bool
96
     * @ODM\Boolean
97
     */
98
    protected $isDraft = false;
99
100
    /**
101
     * Organization contact data.
102
     *
103
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\OrganizationContact")
104
     */
105
    protected $contact;
106
107
    /**
108
     * The organizations' description.
109
     *
110
     * @var string
111
     * @ODM\Field(type="string")
112
     */
113
    protected $description;
114
115
    /**
116
     * The parent of this organization.
117
     *
118
     * @see   setParent()
119
     * @var OrganizationInterface | null
120
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\Organization", simple=true, nullable=true)
121
     * @since 0.18
122
     */
123
    protected $parent;
124
125
    /**
126
     * The hiring organizations of this organization.
127
     *
128
     * @var Collection
129
     * @ODM\ReferenceMany(
130
     *      targetDocument="Organizations\Entity\Organization",
131
     *      repositoryMethod="getHiringOrganizationsCursor"
132
     * )
133
     * @since 0.18
134
     */
135
    protected $hiringOrganizations;
136
137
    /**
138
     * The associated employees (users)
139
     *
140
     * @ODM\EmbedMany(targetDocument="\Organizations\Entity\Employee")
141
     * @var Collection
142
     */
143
    protected $employees;
144
145
    /**
146
     * Jobs of this organization.
147
     *
148
     * @var Collection
149
     * @ODM\ReferenceMany(targetDocument="\Jobs\Entity\Job", simple=true, mappedBy="organization")
150
     * @since 0.18
151
     */
152
    protected $jobs;
153
154
    /**
155
     * the owner of a Organization
156
     *
157
     * @var UserInterface $user
158
     * @ODM\ReferenceOne(targetDocument="\Auth\Entity\User", simple=true)
159
     * @ODM\Index
160
     */
161
    protected $user;
162
163
    /**
164
     * Default values of an organizations job template
165
     *
166
     * @var TemplateInterface;
167
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\Template")
168
     */
169
    protected $template;
170
171
    /**
172
     * Default values Workflow
173
     *
174
     * @var WorkflowSettingsInterface $workflowSettings ;
175
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\WorkflowSettings")
176
     */
177
    protected $workflowSettings;
178
179
    /**
180
     * Returns the string identifier of the Resource
181
     *
182
     * @return string
183
     */
184
    public function getResourceId()
185
    {
186
        return 'Entity/Organization';
187
    }
188
189
190
    /**
191
     * Gets the organization name
192
     *
193
     * @return string
194
     */
195
    public function getName()
196
    {
197
        if (empty($this->organizationName)) {
198
            return '';
199
        }
200
201
        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...
202
    }
203
204
    /**
205
     * Sets the parent of an organization
206
     *
207
     * @param OrganizationInterface $parent
208
     *
209
     * @return $this
210
     */
211
    public function setParent(OrganizationInterface $parent)
212
    {
213
        $this->parent = $parent;
214
215
        return $this;
216
    }
217
218
    /**
219
     * @deprecated
220
     * @return array
221
     */
222
    public function getSearchableProperties()
223
    {
224
        return array();
225
    }
226
227
    /**
228
     * Gets the parent of an organization
229
     *
230
     * @param bool $returnSelf returns itself, if this organization does not have a parent?
231
     *
232
     * @return null|OrganizationInterface
233
     */
234
    public function getParent($returnSelf = false)
235
    {
236
        return $this->parent ? : ($returnSelf ? $this : null);
237
    }
238
239
    /**
240
     * Gets the Draft flag
241
     *
242
     * @return bool
243
     */
244
    public function isDraft()
245
    {
246
        return $this->isDraft;
247
    }
248
249
    /**
250
     * Gets linked organizations
251
     *
252
     * @return Collection
253
     */
254
    public function getHiringOrganizations()
255
    {
256
        return $this->hiringOrganizations;
257
    }
258
259
    /**
260
     * Sets the draft flag
261
     *
262
     * @param bool $flag
263
     *
264
     * @return $this
265
     */
266
    public function setIsDraft($flag)
267
    {
268
        $this->isDraft = (bool) $flag;
269
270
        return $this;
271
    }
272
273
    /**
274
     * @return bool
275
     */
276
    public function isHiringOrganization()
277
    {
278
        return null !== $this->parent;
279
    }
280
281
    /**
282
     * Returns true, if the user belongs to the organization.
283
     *
284
     * @param UserInterface $user
285
     *
286
     * @return bool
287
     */
288
    public function isAssociated(UserInterface $user)
289
    {
290
        return $this->isOwner($user) || $this->isEmployee($user);
291
    }
292
293
    /**
294
     * Sets the external id.
295
     *
296
     * @param $externalId
297
     *
298
     * @return self
299
     */
300
    public function setExternalId($externalId)
301
    {
302
        $this->externalId = $externalId;
303
304
        return $this;
305
    }
306
307
    /**
308
     * Checks, if a User is the owner of an organization
309
     *
310
     * @param UserInterface $user
311
     *
312
     * @return bool
313
     */
314
    public function isOwner(UserInterface $user)
315
    {
316
        return $this->getUser()->getId() == $user->getId();
317
    }
318
319
    /**
320
     * Gets the internal id.
321
     *
322
     * @return string
323
     */
324
    public function getExternalId()
325
    {
326
        return $this->externalId;
327
    }
328
329
    /**
330
     * Returns true, if a User is an employee of the organization
331
     *
332
     * @param UserInterface $user
333
     *
334
     * @return bool
335
     */
336
    public function isEmployee(UserInterface $user)
337
    {
338
        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...
339
    }
340
341
    /**
342
     * @todo review this
343
     *
344
     * @param HydratorInterface $hydrator
345
     *
346
     * @return $this
347
     */
348
    public function setHydrator(HydratorInterface $hydrator)
349
    {
350
        return $this;
351
    }
352
353
    /**
354
     * Updates the organizationsPermissions to allow all employees to view this organization.
355
     *
356
     * In case of a HiringOrganization Permissions are granted to all employees of the parent
357
     * organization.
358
     *
359
     * @ODM\PreUpdate
360
     * @ODM\PrePersist
361
     * @since 0.18
362
     */
363
    public function updatePermissions()
364
    {
365
        if ($this->isHiringOrganization()) {
366
            $organization = $this->getParent();
367
            $owner        = $organization->getUser();
368
369
            $this->setUser($owner);
370
        } else {
371
            $organization = $this;
372
        }
373
374
        /* @var $employees null | ArrayCollection | \Doctrine\ODM\MongoDB\PersistentCollection */
375
        $employees = $organization->getEmployees();
376
377
        $perms = $this->getPermissions();
378
379
        foreach ($employees as $emp) {
0 ignored issues
show
Bug introduced by
The expression $employees of type null is not traversable.
Loading history...
380
            /* @var $emp \Organizations\Entity\Employee */
381
            $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...
382
        }
383
        $perms->build();
384
    }
385
386
    /**
387
     * * @todo review this
388
     * @return EntityHydrator
389
     */
390
    public function getHydrator()
391
    {
392
        return new EntityHydrator();
393
    }
394
395
    /**
396
     * Sets the name of an organization
397
     *
398
     * @param OrganizationName $organizationName
399
     *
400
     * @return $this
401
     */
402
    public function setOrganizationName(OrganizationName $organizationName)
403
    {
404
        if (isset($this->organizationName)) {
405
            $this->organizationName->refCounterDec()->refCompanyCounterDec();
406
        }
407
        $this->organizationName = $organizationName;
408
        $this->organizationName->refCounterInc()->refCompanyCounterInc();
409
        $this->_organizationName = $organizationName->getName();
410
411
        return $this;
412
    }
413
414
    /**
415
     * Gets the organization name entity of an organisation
416
     *
417
     * @return OrganizationName
418
     */
419
    public function getOrganizationName()
420
    {
421
        return $this->organizationName;
422
    }
423
424
425
    /**
426
     * Gets the Permissions of an organization
427
     *
428
     * @return PermissionsInterface
429
     */
430
    public function getPermissions()
431
    {
432
        if (!$this->permissions) {
433
            $permissions = new Permissions();
434
            if ($this->user) {
435
                $permissions->grant($this->user, Permissions::PERMISSION_ALL);
436
            }
437
            $this->setPermissions($permissions);
438
        }
439
440
        return $this->permissions;
441
    }
442
443
    /**
444
     * Sets the Permissions of an Organization
445
     *
446
     * @param PermissionsInterface $permissions
447
     *
448
     * @return $this
449
     */
450 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...
451
    {
452
        // Assure the user has always all rights.
453
        if ($this->user) {
454
            $permissions->grant($this->user, Permissions::PERMISSION_ALL);
455
        }
456
        $this->permissions = $permissions;
457
458
        return $this;
459
    }
460
461
    /**
462
     * Gets the Permissions Resource ID
463
     *
464
     * @return string
465
     */
466
    public function getPermissionsResourceId()
467
    {
468
        return 'organization:' . $this->getId();
469
    }
470
471
    /**
472
     * @param null $type
473
     *
474
     * @return array
475
     */
476
    public function getPermissionsUserIds($type = null)
477
    {
478
        // if we have a user, grant him full access to all associated permissions.
479
        $user = $this->getUser();
480
        $spec = $user
481
            ? $spec = array(PermissionsInterface::PERMISSION_ALL => array($this->getUser()->getId()))
482
            : array();
483
484
        if (null === $type || ('Job/Permissions' != $type && 'Application' != $type)) {
485
            return $spec;
486
        }
487
488
        if ('Job/Permissions' == $type) {
489
            $change = EmployeePermissionsInterface::JOBS_CHANGE;
490
            $view   = EmployeePermissionsInterface::JOBS_VIEW;
491
        } else {
492
            $change = EmployeePermissionsInterface::APPLICATIONS_CHANGE;
493
            $view   = EmployeePermissionsInterface::APPLICATIONS_VIEW;
494
        }
495
496
        $employees = $this->isHiringOrganization()
497
            ? $this->getParent()->getEmployees()
498
            : $this->getEmployees();
499
500
        foreach ($employees as $emp) {
501
            /* @var $emp EmployeeInterface */
502
            if ($emp->isUnassigned()) {
503
                continue;
504
            }
505
506
            $perm = $emp->getPermissions();
507
            if ($perm->isAllowed($change)) {
508
                $spec[PermissionsInterface::PERMISSION_CHANGE][] = $emp->getUser()->getId();
509
            } elseif ($perm->isAllowed($view)) {
510
                $spec[PermissionsInterface::PERMISSION_VIEW][] = $emp->getUser()->getId();
511
            }
512
        }
513
514
        return $spec;
515
    }
516
517
    /**
518
     * Sets the logo of an organization
519
     *
520
     * @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...
521
     *
522
     * @return self
523
     */
524
    public function setImage(OrganizationImage $image = null)
525
    {
526
        $this->image = $image;
527
528
        return $this;
529
    }
530
531
    /**
532
     * Gets the Logo of an organization
533
     *
534
     * @return OrganizationImage
535
     */
536
    public function getImage()
537
    {
538
        return $this->image;
539
    }
540
541
    /**
542
     * Sets the Contact Data of an organization
543
     *
544
     * @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...
545
     *
546
     * @return $this
547
     */
548
    public function setContact(EntityInterface $contact = null)
549
    {
550
        if (!$contact instanceof OrganizationContact) {
551
            $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...
552
        }
553
        $this->contact = $contact;
554
555
        return $this;
556
    }
557
558
    /**
559
     * Gets the contact Data of an organization
560
     *
561
     * @return OrganizationContact
562
     */
563
    public function getContact()
564
    {
565
        if (!$this->contact instanceof OrganizationContact) {
566
            $this->contact = new OrganizationContact();
567
        }
568
569
        return $this->contact;
570
    }
571
572
573
    /**
574
     * Gets the default description of an organization.
575
     *
576
     * This description is used as the default of the company_description
577
     * used in a job template
578
     *
579
     * @return string
580
     */
581
    public function getDescription()
582
    {
583
        return $this->description;
584
    }
585
586
    /**
587
     * Set the default description af an organization
588
     *
589
     * @param string $description
590
     *
591
     * @return $this
592
     */
593
    public function setDescription($description)
594
    {
595
        $this->description = $description;
596
597
        return $this;
598
    }
599
600
    /**
601
     * Sets the the list of employees
602
     *
603
     * @param Collection $employees
604
     *
605
     * @return $this
606
     */
607
    public function setEmployees(Collection $employees)
608
    {
609
        /* todo: Throw exception or at least log incidents, where employees are added to "hiring orgs" */
610
        if (!$this->isHiringOrganization()) {
611
            $this->employees = $employees;
612
        }
613
614
        return $this;
615
    }
616
617
    /**
618
     * Gets the list of employees
619
     *
620
     * @return ArrayCollection|Collection
621
     */
622
    public function getEmployees()
623
    {
624
        if ($this->isHiringOrganization()) {
625
            // Always return empty list, as we never have employees in this case.
626
            return new ArrayCollection();
627
        }
628
629
        if (!$this->employees) {
630
            $this->setEmployees(new ArrayCollection());
631
        }
632
633
        return $this->employees;
634
    }
635
636
    /**
637
     * Gets an employee by User or ID.
638
     *
639
     * @param UserInterface|string $userOrId
640
     *
641
     * @return mixed|null
642
     */
643
    public function getEmployee($userOrId)
644
    {
645
        $employees = $this->getEmployees();
646
        $userId    = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;
647
648
        foreach ($employees as $employee) {
649
            if ($employee->getUser()->getId() == $userId) {
650
                return $employee;
651
            }
652
        }
653
654
        return null;
655
    }
656
657
    /**
658
     * Gets a list of Employees by a user role
659
     *
660
     * @param string $role
661
     *
662
     * @return ArrayCollection
663
     */
664
    public function getEmployeesByRole($role)
665
    {
666
        $employees = new ArrayCollection();
667
668
        /* @var \Organizations\Entity\Employee $employee */
669
        foreach ($this->getEmployees() as $employee) {
670
            if ($role === $employee->getRole()) {
671
                $employees->add($employee);
672
            }
673
        }
674
675
        return $employees;
676
    }
677
678
679 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...
680
    {
681
        if ($this->user) {
682
            $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...
683
        }
684
        $this->user = $user;
685
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
686
687
        return $this;
688
    }
689
690
    /**
691
     * Gets the owner of the organization
692
     *
693
     * @return UserInterface
694
     */
695
    public function getUser()
696
    {
697
        return $this->user;
698
    }
699
700
    /**
701
     * Gets the Jobs of an organization
702
     *
703
     * @return Collection
704
     */
705
    public function getJobs()
706
    {
707
        return $this->jobs;
708
    }
709
710
    /**
711
     * Gets default values of an organizations job template
712
     *
713
     * @return TemplateInterface
714
     */
715
    public function getTemplate()
716
    {
717
        if (null === $this->template) {
718
            $this->template = new Template();
719
        }
720
721
        return $this->template;
722
    }
723
724
    /**
725
     * Sets default values of an organizations job template
726
     *
727
     * @return self
728
     */
729
    public function setTemplate(TemplateInterface $template)
730
    {
731
        $this->template = $template;
732
733
        return $this;
734
    }
735
736
    /**
737
     * Gets Workflow Settings
738
     *
739
     * @return WorkflowSettings|WorkflowSettingsInterface
740
     */
741
    public function getWorkflowSettings()
742
    {
743
        if (null == $this->workflowSettings) {
744
            $this->workflowSettings = new WorkflowSettings();
745
        }
746
747
        return $this->workflowSettings;
748
    }
749
750
    /**
751
     * Sets Workflow Settings
752
     *
753
     * @param $workflowSettings
754
     *
755
     * @return self
756
     */
757
    public function setWorkflowSettings($workflowSettings)
758
    {
759
        $this->workflowSettings = $workflowSettings;
760
761
        return $this;
762
    }
763
}