-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SharePoint API: support for multi lookup field value
- Loading branch information
Showing
5 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,6 @@ public function __construct($LookupId) | |
*/ | ||
public $LookupValue; | ||
|
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Office365\SharePoint; | ||
|
||
use Office365\Runtime\ClientValueCollection; | ||
|
||
class FieldMultiLookupValue extends ClientValueCollection | ||
{ | ||
public function __construct($lookupIds) | ||
{ | ||
parent::__construct(FieldLookupValue::class); | ||
foreach ($lookupIds as $lookupId) { | ||
$this->addChild(new FieldLookupValue($lookupId)); | ||
} | ||
} | ||
|
||
|
||
public function toJson() | ||
{ | ||
$lookupIds = array_map(function (FieldLookupValue $value) { | ||
return $value->LookupId; | ||
}, $this->getData()); | ||
return array('results' => $lookupIds); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters