module/Organizations/src/Organizations/Repository/OrganizationName.php 1 location
|
@@ 17-25 (lines=9) @@
|
| 14 |
|
|
| 15 |
|
class OrganizationName extends AbstractRepository |
| 16 |
|
{ |
| 17 |
|
public function findbyName($name, $create = true) |
| 18 |
|
{ |
| 19 |
|
$entity = $this->findOneBy(array('name' => $name)); |
| 20 |
|
if (empty($entity)) { |
| 21 |
|
$entity = $this->create(); |
| 22 |
|
$entity->setName($name); |
| 23 |
|
} |
| 24 |
|
return $entity; |
| 25 |
|
} |
| 26 |
|
} |
| 27 |
|
|
module/Organizations/src/Organizations/Repository/Organization.php 1 location
|
@@ 97-105 (lines=9) @@
|
| 94 |
|
return $organizations; |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
public function findbyRef($ref, $create = true) |
| 98 |
|
{ |
| 99 |
|
$entity = $this->findOneBy(array('externalId' => $ref)); |
| 100 |
|
if (empty($entity)) { |
| 101 |
|
$entity = $this->create(); |
| 102 |
|
$entity->setExternalId($ref); |
| 103 |
|
} |
| 104 |
|
return $entity; |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
/** |
| 108 |
|
* Finds the main organization of an user. |