Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like User often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use User, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 81 | class User extends ExtendUser implements |
||
| 82 | EmailOwnerInterface, |
||
| 83 | EmailHolderInterface, |
||
| 84 | FullNameInterface, |
||
| 85 | NotificationEmailInterface, |
||
| 86 | AdvancedApiUserInterface |
||
| 87 | { |
||
| 88 | const ROLE_DEFAULT = 'ROLE_USER'; |
||
| 89 | const ROLE_ADMINISTRATOR = 'ROLE_ADMINISTRATOR'; |
||
| 90 | const ROLE_ANONYMOUS = 'IS_AUTHENTICATED_ANONYMOUSLY'; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @ORM\Id |
||
| 94 | * @ORM\Column(type="integer") |
||
| 95 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 96 | * @JMS\Type("integer") |
||
| 97 | * @JMS\Expose |
||
| 98 | */ |
||
| 99 | protected $id; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @var string |
||
| 103 | * |
||
| 104 | * @ORM\Column(type="string", length=255, unique=true) |
||
| 105 | * @JMS\Type("string") |
||
| 106 | * @JMS\Expose |
||
| 107 | * @Oro\Versioned |
||
| 108 | * @ConfigField( |
||
| 109 | * defaultValues={ |
||
| 110 | * "dataaudit"={ |
||
| 111 | * "auditable"=true |
||
| 112 | * }, |
||
| 113 | * "importexport"={ |
||
| 114 | * "identity"=true |
||
| 115 | * } |
||
| 116 | * } |
||
| 117 | * ) |
||
| 118 | */ |
||
| 119 | protected $username; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @var string |
||
| 123 | * |
||
| 124 | * @ORM\Column(type="string", length=255, unique=true) |
||
| 125 | * @JMS\Type("string") |
||
| 126 | * @JMS\Expose |
||
| 127 | * @Oro\Versioned |
||
| 128 | * @ConfigField( |
||
| 129 | * defaultValues={ |
||
| 130 | * "dataaudit"={ |
||
| 131 | * "auditable"=true |
||
| 132 | * } |
||
| 133 | * } |
||
| 134 | * ) |
||
| 135 | */ |
||
| 136 | protected $email; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * Name prefix |
||
| 140 | * |
||
| 141 | * @var string |
||
| 142 | * |
||
| 143 | * @ORM\Column(name="name_prefix", type="string", length=255, nullable=true) |
||
| 144 | * @JMS\Type("string") |
||
| 145 | * @JMS\Expose |
||
| 146 | * @Oro\Versioned |
||
| 147 | * @ConfigField( |
||
| 148 | * defaultValues={ |
||
| 149 | * "dataaudit"={ |
||
| 150 | * "auditable"=true |
||
| 151 | * } |
||
| 152 | * } |
||
| 153 | * ) |
||
| 154 | */ |
||
| 155 | protected $namePrefix; |
||
| 156 | |||
| 157 | /** |
||
| 158 | * First name |
||
| 159 | * |
||
| 160 | * @var string |
||
| 161 | * |
||
| 162 | * @ORM\Column(name="first_name", type="string", length=255, nullable=true) |
||
| 163 | * @JMS\Type("string") |
||
| 164 | * @JMS\Expose |
||
| 165 | * @Oro\Versioned |
||
| 166 | * @ConfigField( |
||
| 167 | * defaultValues={ |
||
| 168 | * "dataaudit"={ |
||
| 169 | * "auditable"=true |
||
| 170 | * } |
||
| 171 | * } |
||
| 172 | * ) |
||
| 173 | */ |
||
| 174 | protected $firstName; |
||
| 175 | |||
| 176 | /** |
||
| 177 | * Middle name |
||
| 178 | * |
||
| 179 | * @var string |
||
| 180 | * |
||
| 181 | * @ORM\Column(name="middle_name", type="string", length=255, nullable=true) |
||
| 182 | * @JMS\Type("string") |
||
| 183 | * @JMS\Expose |
||
| 184 | * @Oro\Versioned |
||
| 185 | * @ConfigField( |
||
| 186 | * defaultValues={ |
||
| 187 | * "dataaudit"={ |
||
| 188 | * "auditable"=true |
||
| 189 | * } |
||
| 190 | * } |
||
| 191 | * ) |
||
| 192 | */ |
||
| 193 | protected $middleName; |
||
| 194 | |||
| 195 | /** |
||
| 196 | * Last name |
||
| 197 | * |
||
| 198 | * @var string |
||
| 199 | * |
||
| 200 | * @ORM\Column(name="last_name", type="string", length=255, nullable=true) |
||
| 201 | * @JMS\Type("string") |
||
| 202 | * @JMS\Expose |
||
| 203 | * @Oro\Versioned |
||
| 204 | * @ConfigField( |
||
| 205 | * defaultValues={ |
||
| 206 | * "dataaudit"={ |
||
| 207 | * "auditable"=true |
||
| 208 | * } |
||
| 209 | * } |
||
| 210 | * ) |
||
| 211 | */ |
||
| 212 | protected $lastName; |
||
| 213 | |||
| 214 | /** |
||
| 215 | * Name suffix |
||
| 216 | * |
||
| 217 | * @var string |
||
| 218 | * |
||
| 219 | * @ORM\Column(name="name_suffix", type="string", length=255, nullable=true) |
||
| 220 | * @JMS\Type("string") |
||
| 221 | * @JMS\Expose |
||
| 222 | * @Oro\Versioned |
||
| 223 | * @ConfigField( |
||
| 224 | * defaultValues={ |
||
| 225 | * "dataaudit"={ |
||
| 226 | * "auditable"=true |
||
| 227 | * } |
||
| 228 | * } |
||
| 229 | * ) |
||
| 230 | */ |
||
| 231 | protected $nameSuffix; |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @var Group[]|Collection |
||
| 235 | * |
||
| 236 | * @ORM\ManyToMany(targetEntity="Oro\Bundle\UserBundle\Entity\Group") |
||
| 237 | * @ORM\JoinTable(name="oro_user_access_group", |
||
| 238 | * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")}, |
||
| 239 | * inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id", onDelete="CASCADE")} |
||
| 240 | * ) |
||
| 241 | * @Oro\Versioned("getName") |
||
| 242 | * @ConfigField( |
||
| 243 | * defaultValues={ |
||
| 244 | * "dataaudit"={ |
||
| 245 | * "auditable"=true |
||
| 246 | * } |
||
| 247 | * } |
||
| 248 | * ) |
||
| 249 | */ |
||
| 250 | protected $groups; |
||
| 251 | |||
| 252 | /** |
||
| 253 | * @var \DateTime |
||
| 254 | * |
||
| 255 | * @ORM\Column(name="birthday", type="date", nullable=true) |
||
| 256 | * @JMS\Type("DateTime") |
||
| 257 | * @JMS\Expose |
||
| 258 | * @Oro\Versioned |
||
| 259 | * @ConfigField( |
||
| 260 | * defaultValues={ |
||
| 261 | * "dataaudit"={ |
||
| 262 | * "auditable"=true |
||
| 263 | * } |
||
| 264 | * } |
||
| 265 | * ) |
||
| 266 | */ |
||
| 267 | protected $birthday; |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @var bool |
||
| 271 | * |
||
| 272 | * @ORM\Column(type="boolean") |
||
| 273 | * @JMS\Type("boolean") |
||
| 274 | * @JMS\Expose |
||
| 275 | * @Oro\Versioned |
||
| 276 | * @ConfigField( |
||
| 277 | * defaultValues={ |
||
| 278 | * "dataaudit"={ |
||
| 279 | * "auditable"=true |
||
| 280 | * } |
||
| 281 | * } |
||
| 282 | * ) |
||
| 283 | */ |
||
| 284 | protected $enabled = true; |
||
| 285 | |||
| 286 | /** |
||
| 287 | * @var \DateTime |
||
| 288 | * |
||
| 289 | * @ORM\Column(name="last_login", type="datetime", nullable=true) |
||
| 290 | * @JMS\Type("DateTime") |
||
| 291 | * @JMS\Expose |
||
| 292 | * @ConfigField( |
||
| 293 | * defaultValues={ |
||
| 294 | * "importexport"={ |
||
| 295 | * "excluded"=true |
||
| 296 | * } |
||
| 297 | * } |
||
| 298 | * ) |
||
| 299 | */ |
||
| 300 | protected $lastLogin; |
||
| 301 | |||
| 302 | /** |
||
| 303 | * @var BusinessUnit |
||
| 304 | * @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\BusinessUnit", cascade={"persist"}) |
||
| 305 | * @ORM\JoinColumn(name="business_unit_owner_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 306 | * @ConfigField( |
||
| 307 | * defaultValues={ |
||
| 308 | * "importexport"={ |
||
| 309 | * "excluded"=true |
||
| 310 | * } |
||
| 311 | * } |
||
| 312 | * ) |
||
| 313 | */ |
||
| 314 | protected $owner; |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @var UserApi[]|Collection |
||
| 318 | * |
||
| 319 | * @ORM\OneToMany( |
||
| 320 | * targetEntity="UserApi", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EXTRA_LAZY" |
||
| 321 | * ) |
||
| 322 | * @ConfigField( |
||
| 323 | * defaultValues={ |
||
| 324 | * "importexport"={ |
||
| 325 | * "excluded"=true |
||
| 326 | * }, |
||
| 327 | * "email"={ |
||
| 328 | * "available_in_template"=false |
||
| 329 | * } |
||
| 330 | * } |
||
| 331 | * ) |
||
| 332 | */ |
||
| 333 | protected $apiKeys; |
||
| 334 | |||
| 335 | /** |
||
| 336 | * @var Status[]|Collection |
||
| 337 | * |
||
| 338 | * @ORM\OneToMany(targetEntity="Status", mappedBy="user") |
||
| 339 | * @ORM\OrderBy({"createdAt" = "DESC"}) |
||
| 340 | */ |
||
| 341 | protected $statuses; |
||
| 342 | |||
| 343 | /** |
||
| 344 | * @var Status |
||
| 345 | * |
||
| 346 | * @ORM\OneToOne(targetEntity="Status") |
||
| 347 | * @ORM\JoinColumn(name="status_id", referencedColumnName="id", nullable=true) |
||
| 348 | */ |
||
| 349 | protected $currentStatus; |
||
| 350 | |||
| 351 | /** |
||
| 352 | * @var Email[]|Collection |
||
| 353 | * |
||
| 354 | * @ORM\OneToMany(targetEntity="Email", mappedBy="user", orphanRemoval=true, cascade={"persist"}) |
||
| 355 | * @ConfigField( |
||
| 356 | * defaultValues={ |
||
| 357 | * "dataaudit"={ |
||
| 358 | * "auditable"=true |
||
| 359 | * } |
||
| 360 | * } |
||
| 361 | * ) |
||
| 362 | */ |
||
| 363 | protected $emails; |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @var BusinessUnit[]|Collection |
||
| 367 | * |
||
| 368 | * @ORM\ManyToMany(targetEntity="Oro\Bundle\OrganizationBundle\Entity\BusinessUnit", inversedBy="users") |
||
| 369 | * @ORM\JoinTable(name="oro_user_business_unit", |
||
| 370 | * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")}, |
||
| 371 | * inverseJoinColumns={@ORM\JoinColumn(name="business_unit_id", referencedColumnName="id", onDelete="CASCADE")} |
||
| 372 | * ) |
||
| 373 | * @Oro\Versioned("getName") |
||
| 374 | * @ConfigField( |
||
| 375 | * defaultValues={ |
||
| 376 | * "dataaudit"={ |
||
| 377 | * "auditable"=true |
||
| 378 | * } |
||
| 379 | * } |
||
| 380 | * ) |
||
| 381 | */ |
||
| 382 | protected $businessUnits; |
||
| 383 | |||
| 384 | /** |
||
| 385 | * @var EmailOrigin[]|Collection |
||
| 386 | * |
||
| 387 | * @ORM\OneToMany( |
||
| 388 | * targetEntity="Oro\Bundle\EmailBundle\Entity\EmailOrigin", mappedBy="owner", cascade={"persist", "remove"} |
||
| 389 | * ) |
||
| 390 | */ |
||
| 391 | protected $emailOrigins; |
||
| 392 | |||
| 393 | /** |
||
| 394 | * @var \DateTime $createdAt |
||
| 395 | * |
||
| 396 | * @ORM\Column(type="datetime") |
||
| 397 | * @ConfigField( |
||
| 398 | * defaultValues={ |
||
| 399 | * "entity"={ |
||
| 400 | * "label"="oro.ui.created_at" |
||
| 401 | * } |
||
| 402 | * } |
||
| 403 | * ) |
||
| 404 | */ |
||
| 405 | protected $createdAt; |
||
| 406 | |||
| 407 | /** |
||
| 408 | * @var AccountTypeModel |
||
| 409 | */ |
||
| 410 | protected $imapAccountType; |
||
| 411 | |||
| 412 | /** |
||
| 413 | * @var \DateTime $updatedAt |
||
| 414 | * |
||
| 415 | * @ORM\Column(type="datetime") |
||
| 416 | * @ConfigField( |
||
| 417 | * defaultValues={ |
||
| 418 | * "entity"={ |
||
| 419 | * "label"="oro.ui.updated_at" |
||
| 420 | * } |
||
| 421 | * } |
||
| 422 | * ) |
||
| 423 | */ |
||
| 424 | protected $updatedAt; |
||
| 425 | |||
| 426 | /** |
||
| 427 | * @var OrganizationInterface |
||
| 428 | * |
||
| 429 | * Organization that user logged in |
||
| 430 | */ |
||
| 431 | protected $currentOrganization; |
||
| 432 | |||
| 433 | public function __construct() |
||
| 444 | |||
| 445 | /** |
||
| 446 | * {@inheritdoc} |
||
| 447 | */ |
||
| 448 | public function getClass() |
||
| 452 | |||
| 453 | /** |
||
| 454 | * {@inheritdoc} |
||
| 455 | */ |
||
| 456 | public function getEmailFields() |
||
| 460 | |||
| 461 | /** |
||
| 462 | * {@inheritdoc} |
||
| 463 | */ |
||
| 464 | public function getFirstName() |
||
| 468 | |||
| 469 | /** |
||
| 470 | * @param string $firstName [optional] New first name value. Null by default. |
||
| 471 | * |
||
| 472 | * @return User |
||
| 473 | */ |
||
| 474 | public function setFirstName($firstName = null) |
||
| 480 | |||
| 481 | /** |
||
| 482 | * {@inheritdoc} |
||
| 483 | */ |
||
| 484 | public function getLastName() |
||
| 488 | |||
| 489 | /** |
||
| 490 | * @param string $lastName [optional] New last name value. Null by default. |
||
| 491 | * |
||
| 492 | * @return User |
||
| 493 | */ |
||
| 494 | public function setLastName($lastName = null) |
||
| 500 | |||
| 501 | /** |
||
| 502 | * {@inheritdoc} |
||
| 503 | */ |
||
| 504 | public function getMiddleName() |
||
| 508 | |||
| 509 | /** |
||
| 510 | * Set middle name |
||
| 511 | * |
||
| 512 | * @param string $middleName |
||
| 513 | * |
||
| 514 | * @return User |
||
| 515 | */ |
||
| 516 | public function setMiddleName($middleName) |
||
| 522 | |||
| 523 | /** |
||
| 524 | * {@inheritdoc} |
||
| 525 | */ |
||
| 526 | public function getNamePrefix() |
||
| 530 | |||
| 531 | /** |
||
| 532 | * Set name prefix |
||
| 533 | * |
||
| 534 | * @param string $namePrefix |
||
| 535 | * |
||
| 536 | * @return User |
||
| 537 | */ |
||
| 538 | public function setNamePrefix($namePrefix) |
||
| 544 | |||
| 545 | /** |
||
| 546 | * {@inheritdoc} |
||
| 547 | */ |
||
| 548 | public function getNameSuffix() |
||
| 552 | |||
| 553 | /** |
||
| 554 | * Set name suffix |
||
| 555 | * |
||
| 556 | * @param string $nameSuffix |
||
| 557 | * |
||
| 558 | * @return User |
||
| 559 | */ |
||
| 560 | public function setNameSuffix($nameSuffix) |
||
| 566 | |||
| 567 | /** |
||
| 568 | * Return birthday |
||
| 569 | * |
||
| 570 | * @return \DateTime |
||
| 571 | */ |
||
| 572 | public function getBirthday() |
||
| 576 | |||
| 577 | /** |
||
| 578 | * |
||
| 579 | * @param \DateTime $birthday [optional] New birthday value. Null by default. |
||
| 580 | * |
||
| 581 | * @return User |
||
| 582 | */ |
||
| 583 | public function setBirthday(\DateTime $birthday = null) |
||
| 589 | |||
| 590 | /** |
||
| 591 | * Get user created date/time |
||
| 592 | * |
||
| 593 | * @return \DateTime |
||
| 594 | */ |
||
| 595 | public function getCreatedAt() |
||
| 599 | |||
| 600 | /** |
||
| 601 | * @param \DateTime $createdAt |
||
| 602 | * |
||
| 603 | * @return User |
||
| 604 | */ |
||
| 605 | public function setCreatedAt(\DateTime $createdAt) |
||
| 611 | |||
| 612 | /** |
||
| 613 | * Get user last update date/time |
||
| 614 | * |
||
| 615 | * @return \DateTime |
||
| 616 | */ |
||
| 617 | public function getUpdatedAt() |
||
| 621 | |||
| 622 | /** |
||
| 623 | * @param \DateTime $updatedAt |
||
| 624 | * |
||
| 625 | * @return User |
||
| 626 | */ |
||
| 627 | public function setUpdatedAt(\DateTime $updatedAt) |
||
| 633 | |||
| 634 | /** |
||
| 635 | * {@inheritdoc} |
||
| 636 | */ |
||
| 637 | public function getApiKeys() |
||
| 641 | |||
| 642 | /** |
||
| 643 | * Add UserApi to User |
||
| 644 | * |
||
| 645 | * @param UserApi $api |
||
| 646 | * |
||
| 647 | * @return User |
||
| 648 | */ |
||
| 649 | public function addApiKey(UserApi $api) |
||
| 658 | |||
| 659 | /** |
||
| 660 | * Delete UserApi from User |
||
| 661 | * |
||
| 662 | * @param UserApi $api |
||
| 663 | * |
||
| 664 | * @return User |
||
| 665 | */ |
||
| 666 | public function removeApiKey(UserApi $api) |
||
| 674 | |||
| 675 | /** |
||
| 676 | * Returns the true Collection of Roles. |
||
| 677 | * |
||
| 678 | * @deprecated since 1.8 |
||
| 679 | * |
||
| 680 | * @return Collection |
||
| 681 | */ |
||
| 682 | public function getRolesCollection() |
||
| 686 | |||
| 687 | /** |
||
| 688 | * Directly set the Collection of Roles. |
||
| 689 | * |
||
| 690 | * @deprecated since 1.8 |
||
| 691 | * |
||
| 692 | * @param Collection $collection |
||
| 693 | * |
||
| 694 | * @return User |
||
| 695 | * @throws \InvalidArgumentException |
||
| 696 | */ |
||
| 697 | public function setRolesCollection($collection) |
||
| 708 | |||
| 709 | /** |
||
| 710 | * Pre persist event listener |
||
| 711 | * |
||
| 712 | * @ORM\PrePersist |
||
| 713 | */ |
||
| 714 | public function beforeSave() |
||
| 720 | |||
| 721 | /** |
||
| 722 | * Invoked before the entity is updated. |
||
| 723 | * |
||
| 724 | * @ORM\PreUpdate |
||
| 725 | * |
||
| 726 | * @param PreUpdateEventArgs $event |
||
| 727 | */ |
||
| 728 | public function preUpdate(PreUpdateEventArgs $event) |
||
| 736 | |||
| 737 | /** |
||
| 738 | * Get User Statuses |
||
| 739 | * |
||
| 740 | * @return Status[]|Collection |
||
| 741 | */ |
||
| 742 | public function getStatuses() |
||
| 746 | |||
| 747 | /** |
||
| 748 | * Add Status to User |
||
| 749 | * |
||
| 750 | * @param Status $status |
||
| 751 | * |
||
| 752 | * @return User |
||
| 753 | */ |
||
| 754 | public function addStatus(Status $status) |
||
| 762 | |||
| 763 | /** |
||
| 764 | * Get Current Status |
||
| 765 | * |
||
| 766 | * @return Status |
||
| 767 | */ |
||
| 768 | public function getCurrentStatus() |
||
| 772 | |||
| 773 | /** |
||
| 774 | * Set User Current Status |
||
| 775 | * |
||
| 776 | * @param Status $status |
||
| 777 | * |
||
| 778 | * @return User |
||
| 779 | */ |
||
| 780 | public function setCurrentStatus(Status $status = null) |
||
| 786 | |||
| 787 | /** |
||
| 788 | * Get User Emails |
||
| 789 | * |
||
| 790 | * @return Email[]|Collection |
||
| 791 | */ |
||
| 792 | public function getEmails() |
||
| 796 | |||
| 797 | /** |
||
| 798 | * Add Email to User |
||
| 799 | * |
||
| 800 | * @param Email $email |
||
| 801 | * |
||
| 802 | * @return User |
||
| 803 | */ |
||
| 804 | public function addEmail(Email $email) |
||
| 813 | |||
| 814 | /** |
||
| 815 | * Delete Email from User |
||
| 816 | * |
||
| 817 | * @param Email $email |
||
| 818 | * |
||
| 819 | * @return User |
||
| 820 | */ |
||
| 821 | public function removeEmail(Email $email) |
||
| 829 | |||
| 830 | /** |
||
| 831 | * {@inheritdoc} |
||
| 832 | */ |
||
| 833 | public function getId() |
||
| 837 | |||
| 838 | /** |
||
| 839 | * @param int $id |
||
| 840 | * |
||
| 841 | * @return User |
||
| 842 | */ |
||
| 843 | public function setId($id) |
||
| 849 | |||
| 850 | /** |
||
| 851 | * @param BusinessUnit $businessUnit |
||
| 852 | * |
||
| 853 | * @return User |
||
| 854 | */ |
||
| 855 | public function addBusinessUnit(BusinessUnit $businessUnit) |
||
| 863 | |||
| 864 | /** |
||
| 865 | * @return Collection |
||
| 866 | */ |
||
| 867 | public function getBusinessUnits() |
||
| 873 | |||
| 874 | /** |
||
| 875 | * @param Collection $businessUnits |
||
| 876 | * |
||
| 877 | * @return User |
||
| 878 | */ |
||
| 879 | public function setBusinessUnits(Collection $businessUnits) |
||
| 885 | |||
| 886 | /** |
||
| 887 | * @param BusinessUnit $businessUnit |
||
| 888 | * |
||
| 889 | * @return User |
||
| 890 | */ |
||
| 891 | public function removeBusinessUnit(BusinessUnit $businessUnit) |
||
| 899 | |||
| 900 | /** |
||
| 901 | * @return BusinessUnit |
||
| 902 | */ |
||
| 903 | public function getOwner() |
||
| 907 | |||
| 908 | /** |
||
| 909 | * @param BusinessUnit $owningBusinessUnit |
||
| 910 | * |
||
| 911 | * @return User |
||
| 912 | */ |
||
| 913 | public function setOwner($owningBusinessUnit) |
||
| 919 | |||
| 920 | /** |
||
| 921 | * {@inheritdoc} |
||
| 922 | */ |
||
| 923 | public function getNotificationEmails() |
||
| 927 | |||
| 928 | /** |
||
| 929 | * {@inheritDoc} |
||
| 930 | */ |
||
| 931 | public function getEmail() |
||
| 935 | |||
| 936 | /** |
||
| 937 | * @param string $email New email value |
||
| 938 | * |
||
| 939 | * @return User |
||
| 940 | */ |
||
| 941 | public function setEmail($email) |
||
| 947 | |||
| 948 | /** |
||
| 949 | * Set IMAP configuration |
||
| 950 | * |
||
| 951 | * @param UserEmailOrigin $imapConfiguration |
||
| 952 | * |
||
| 953 | * @return User |
||
| 954 | */ |
||
| 955 | public function setImapConfiguration($imapConfiguration = null) |
||
| 971 | |||
| 972 | /** |
||
| 973 | * Get IMAP configuration |
||
| 974 | * |
||
| 975 | * @return UserEmailOrigin |
||
| 976 | */ |
||
| 977 | public function getImapConfiguration() |
||
| 993 | |||
| 994 | /** |
||
| 995 | * @param AccountTypeModel|null $accountTypeModel |
||
| 996 | */ |
||
| 997 | public function setImapAccountType(AccountTypeModel $accountTypeModel = null) |
||
| 1004 | |||
| 1005 | /** |
||
| 1006 | * @return AccountTypeModel |
||
| 1007 | */ |
||
| 1008 | View Code Duplication | public function getImapAccountType() |
|
| 1032 | |||
| 1033 | /** |
||
| 1034 | * Delete email origin |
||
| 1035 | * |
||
| 1036 | * @param EmailOrigin $emailOrigin |
||
| 1037 | * |
||
| 1038 | * @return User |
||
| 1039 | */ |
||
| 1040 | public function removeEmailOrigin(EmailOrigin $emailOrigin) |
||
| 1046 | |||
| 1047 | /** |
||
| 1048 | * Add email origin |
||
| 1049 | * |
||
| 1050 | * @param EmailOrigin $emailOrigin |
||
| 1051 | * |
||
| 1052 | * @return User |
||
| 1053 | */ |
||
| 1054 | public function addEmailOrigin(EmailOrigin $emailOrigin) |
||
| 1062 | |||
| 1063 | /** |
||
| 1064 | * Get email origins assigned to user |
||
| 1065 | * |
||
| 1066 | * @return EmailOrigin[]|ArrayCollection |
||
| 1067 | */ |
||
| 1068 | public function getEmailOrigins() |
||
| 1072 | |||
| 1073 | /** |
||
| 1074 | * Gets the groups granted to the user |
||
| 1075 | * |
||
| 1076 | * @return Collection |
||
| 1077 | */ |
||
| 1078 | public function getGroups() |
||
| 1082 | |||
| 1083 | /** |
||
| 1084 | * @param string $name |
||
| 1085 | * |
||
| 1086 | * @return bool |
||
| 1087 | */ |
||
| 1088 | public function hasGroup($name) |
||
| 1099 | |||
| 1100 | /** |
||
| 1101 | * @return array |
||
| 1102 | */ |
||
| 1103 | public function getGroupNames() |
||
| 1114 | |||
| 1115 | /** |
||
| 1116 | * @param Group $group |
||
| 1117 | * |
||
| 1118 | * @return User |
||
| 1119 | */ |
||
| 1120 | public function addGroup(Group $group) |
||
| 1128 | |||
| 1129 | /** |
||
| 1130 | * @param Group $group |
||
| 1131 | * |
||
| 1132 | * @return User |
||
| 1133 | */ |
||
| 1134 | public function removeGroup(Group $group) |
||
| 1142 | |||
| 1143 | /** |
||
| 1144 | * {@inheritdoc} |
||
| 1145 | */ |
||
| 1146 | public function getRoles() |
||
| 1157 | |||
| 1158 | /** |
||
| 1159 | * @param OrganizationInterface $organization |
||
| 1160 | * |
||
| 1161 | * @return $this |
||
| 1162 | */ |
||
| 1163 | public function setCurrentOrganization(OrganizationInterface $organization) |
||
| 1169 | |||
| 1170 | /** |
||
| 1171 | * @return OrganizationInterface |
||
| 1172 | */ |
||
| 1173 | public function getCurrentOrganization() |
||
| 1177 | |||
| 1178 | /** |
||
| 1179 | * Get user full name |
||
| 1180 | * |
||
| 1181 | * @return string |
||
| 1182 | */ |
||
| 1183 | public function getFullName() |
||
| 1187 | } |
||
| 1188 |