Skip to content

Commit

Permalink
Generator fixes. All the model has been sync with version 16.0.19506.…
Browse files Browse the repository at this point in the history
…12022
  • Loading branch information
vgrem committed Nov 16, 2019
1 parent 9cf5177 commit e37301f
Show file tree
Hide file tree
Showing 40 changed files with 3,473 additions and 385 deletions.
7 changes: 5 additions & 2 deletions generator/GenerateModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function generateFiles(ODataModel $model){
$types = $model->getTypes();

$curIdx = 0;
$startIdx = 201;
$startIdx = 0;
$count = count($types);
foreach ($types as $typeName => $type){
$curIdx++;
Expand Down Expand Up @@ -107,7 +107,10 @@ function generateFiles(ODataModel $model){
"SP.WorkflowServices.*",
"SP.OAuth.*",
"SP.Directory.*",
"SP.CompliancePolicy.*")
"SP.CompliancePolicy.*"),
'ignoredProperties' => array(
'Id4a81de82eeb94d6080ea5bf63e27023a'
)
);

$reader = new ODataV3Reader($edmxContents,$generatorOptions);
Expand Down
6 changes: 3 additions & 3 deletions generator/builders/PropertyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public function build($template)
$commentBuilder = new DocCommentBuilder($this->options);
if (is_null($this->propertySchema['template'])) {
$factory = new BuilderFactory;
$node = $factory->property($this->propertySchema['name'])->makePublic();
$node->setDocComment($commentBuilder->createPropertyComment($this->propertySchema));
return array($node);
$property = $factory->property($this->propertySchema['name'])->makePublic();
$property->setDocComment($commentBuilder->createPropertyComment($this->propertySchema));
return array($property->getNode());
} else {
$traverser = new NodeTraverser();
$traverser->addVisitor($this);
Expand Down
2 changes: 1 addition & 1 deletion generator/builders/TypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function build()
}
else {
$this->buildFromTemplate($template);
$this->ast = $template;
}
$traverser = new NodeTraverser();
$traverser->addVisitor($this);
Expand Down Expand Up @@ -93,6 +92,7 @@ private function buildFromTemplate($template)
$classNode = $this->findNodeByType($template, Node\Stmt\Class_::class);
$classNode->name = $this->typeSchema['name'];
$classNode->stmts = $propertyNodes;
$this->ast = $template;
}

private function loadTemplate(){
Expand Down
16 changes: 13 additions & 3 deletions src/Runtime/OData/ODataModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ public function resolveType($typeName, $baseType)
}


private function isValidProperty(){
return true;
}


/**
* @param $propName
* @param string $propType
Expand All @@ -137,15 +142,20 @@ public function resolveProperty($propName, $propType, $baseType,$readOnly=false)
$propertyAlias = array_pop($parts);
$typeName = implode('.', $parts);

//ensure type exists
//verify if property is not marked as ignored
if (in_array($propertyAlias, $this->options['ignoredProperties'])) {
return false;
}

//ensure type exists for a property
if (!$this->resolveType($typeName, $baseType)) {
return false;
}

//skip properties for non existent types
$type = &$this->types[$typeName];
if ($type['state'] !== 'attached')
return false;
//if ($type['state'] !== 'attached')
// return false;

//exclude properties if unknown type
$typeInfo = $this->getTypeInfo($propType);
Expand Down
2 changes: 1 addition & 1 deletion src/SharePoint/AppLicense.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Updated By PHP Office365 Generator 2019-10-12T18:42:56+00:00 16.0.19402.12016
* Updated By PHP Office365 Generator 2019-11-16T20:50:27+00:00 16.0.19506.12022
*/
namespace Office365\PHP\Client\SharePoint;

Expand Down
36 changes: 33 additions & 3 deletions src/SharePoint/FieldChoice.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
<?php


/**
* Updated By PHP Office365 Generator 2019-11-16T20:01:10+00:00 16.0.19506.12022
*/
namespace Office365\PHP\Client\SharePoint;


/**
* Represents
* a choice field (2). To set
* properties on this class, call the Update method (section 3.2.5.40.2.1.5).The NoCrawl and SchemaXmlWithResourceTokens properties are
* not included in the default scalar property set
* for this type.
*/
class FieldChoice extends Field
{

/**
* Specifies
* whether to display the choice field (2) as radio
* buttons or as a drop-down list.
* @return integer
*/
public function getEditFormat()
{
if (!$this->isPropertyAvailable("EditFormat")) {
return null;
}
return $this->getProperty("EditFormat");
}
/**
* Specifies
* whether to display the choice field (2) as radio
* buttons or as a drop-down list.
* @var integer
*/
public function setEditFormat($value)
{
$this->setProperty("EditFormat", $value, true);
}
}
37 changes: 34 additions & 3 deletions src/SharePoint/FieldComputed.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
<?php


/**
* Updated By PHP Office365 Generator 2019-11-16T20:01:10+00:00 16.0.19506.12022
*/
namespace Office365\PHP\Client\SharePoint;


/**
* Specifies
* a computed
* field. To set the properties of this class, call the Update
* method (section 3.2.5.42.2.1.5).The NoCrawl and SchemaXmlWithResourceTokens properties are
* not included in the default scalar property set
* for this type.
*/
class FieldComputed extends Field
{

/**
* Specifies
* whether a lookup field can
* reference the field (2).
* @return bool
*/
public function getEnableLookup()
{
if (!$this->isPropertyAvailable("EnableLookup")) {
return null;
}
return $this->getProperty("EnableLookup");
}
/**
* Specifies
* whether a lookup field can
* reference the field (2).
* @var bool
*/
public function setEnableLookup($value)
{
$this->setProperty("EnableLookup", $value, true);
}
}
80 changes: 78 additions & 2 deletions src/SharePoint/FieldDateTime.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,85 @@
<?php


/**
* Updated By PHP Office365 Generator 2019-11-16T20:01:10+00:00 16.0.19506.12022
*/
namespace Office365\PHP\Client\SharePoint;

/**
* Specifies
* a field
* (2) that contains date and time values. To set properties, call the Update
* method (section 3.2.5.44.2.1.5).The NoCrawl and SchemaXmlWithResourceTokens properties are
* not included in the default scalar property set
* for this type.
*/
class FieldDateTime extends Field
{

/**
* Specifies
* the calendar
* type of the field (2).It MUST be
* None if the field (2) is in an external list.
* @return integer
*/
public function getDateTimeCalendarType()
{
if (!$this->isPropertyAvailable("DateTimeCalendarType")) {
return null;
}
return $this->getProperty("DateTimeCalendarType");
}
/**
* Specifies
* the calendar
* type of the field (2).It MUST be
* None if the field (2) is in an external list.
* @var integer
*/
public function setDateTimeCalendarType($value)
{
$this->setProperty("DateTimeCalendarType", $value, true);
}
/**
* Specifies
* the type of date and time format that is used in the field (2).
* @return integer
*/
public function getDisplayFormat()
{
if (!$this->isPropertyAvailable("DisplayFormat")) {
return null;
}
return $this->getProperty("DisplayFormat");
}
/**
* Specifies
* the type of date and time format that is used in the field (2).
* @var integer
*/
public function setDisplayFormat($value)
{
$this->setProperty("DisplayFormat", $value, true);
}
/**
* Gets or
* sets the type of friendly display format that is used in the field.<16>
* @return integer
*/
public function getFriendlyDisplayFormat()
{
if (!$this->isPropertyAvailable("FriendlyDisplayFormat")) {
return null;
}
return $this->getProperty("FriendlyDisplayFormat");
}
/**
* Gets or
* sets the type of friendly display format that is used in the field.<16>
* @var integer
*/
public function setFriendlyDisplayFormat($value)
{
$this->setProperty("FriendlyDisplayFormat", $value, true);
}
}
Loading

0 comments on commit e37301f

Please sign in to comment.