-
-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathContentTypeCollection.php
53 lines (45 loc) · 1.5 KB
/
ContentTypeCollection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Office365\SharePoint;
use Office365\Runtime\Actions\InvokePostMethodQuery;
use Office365\Runtime\ClientObject;
use Office365\Runtime\ClientRuntimeContext;
use Office365\Runtime\Paths\ServiceOperationPath;
use Office365\Runtime\ResourcePath;
class ContentTypeCollection extends BaseEntityCollection
{
/**
* @param ClientRuntimeContext $ctx
* @param ResourcePath|null $resourcePath
* @param ClientObject|null $parent
*/
public function __construct(ClientRuntimeContext $ctx, ?ResourcePath $resourcePath = null, ?ClientObject $parent = null)
{
parent::__construct($ctx, $resourcePath, ContentType::class, $parent);
}
/**
* @param string $id
* @return ContentType
*/
public function getById($id)
{
$contentType = new ContentType(
$this->getContext(),
new ServiceOperationPath("GetById",array($id),$this->getResourcePath())
);
$this->addChild($contentType);
return $contentType;
}
/**
* Creates a ContentType resource
* @param ContentTypeCreationInformation $information
* @return ContentType
*/
public function add(ContentTypeCreationInformation $information)
{
$contentType = new ContentType($this->getContext());
$qry = new InvokePostMethodQuery($this,null,null,null,$information);
$this->getContext()->addQueryAndResultObject($qry,$contentType);
$this->addChild($contentType);
return $contentType;
}
}