@@ -8,6 +8,9 @@ |
||
| 8 | 8 | { |
| 9 | 9 | use xsdRestrictions; |
| 10 | 10 | |
| 11 | + /** |
|
| 12 | + * @param string $TSimpleIdentifier |
|
| 13 | + */ |
|
| 11 | 14 | protected function isTSimpleIdentifierValid($TSimpleIdentifier) |
| 12 | 15 | { |
| 13 | 16 | if (!$this->isNCName($TSimpleIdentifier)) { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $edmx = new Edmx(); |
| 21 | 21 | $this->assertTrue($edmx->isOK($msg), $msg); |
| 22 | 22 | $this->assertNull($msg); |
| 23 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 23 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 24 | 24 | $serializer = |
| 25 | 25 | \JMS\Serializer\SerializerBuilder::create() |
| 26 | 26 | ->addMetadataDir($ymlDir) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $ds = DIRECTORY_SEPARATOR; |
| 35 | 35 | $xml = new \DOMDocument(); |
| 36 | 36 | $xml->loadXML($data); |
| 37 | - $xml->schemaValidate(dirname(__DIR__) . $ds . "xsd" . $ds . "/Microsoft.Data.Entity.Design.Edmx_3.xsd"); |
|
| 37 | + $xml->schemaValidate(dirname(__DIR__).$ds."xsd".$ds."/Microsoft.Data.Entity.Design.Edmx_3.xsd"); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function testWithSingleEntitySerializeOk() |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->assertNull($msg); |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 54 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 55 | 55 | $serializer = |
| 56 | 56 | \JMS\Serializer\SerializerBuilder::create() |
| 57 | 57 | ->addMetadataDir($ymlDir) |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->assertNull($msg); |
| 89 | 89 | |
| 90 | 90 | |
| 91 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 91 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 92 | 92 | $serializer = |
| 93 | 93 | \JMS\Serializer\SerializerBuilder::create() |
| 94 | 94 | ->addMetadataDir($ymlDir) |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | $last_letter = strtolower($singular[strlen($singular) - 1]); |
| 115 | 115 | switch ($last_letter) { |
| 116 | 116 | case 'y': |
| 117 | - return substr($singular, 0, -1) . 'ies'; |
|
| 117 | + return substr($singular, 0, -1).'ies'; |
|
| 118 | 118 | case 's': |
| 119 | - return $singular . 'es'; |
|
| 119 | + return $singular.'es'; |
|
| 120 | 120 | default: |
| 121 | - return $singular . 's'; |
|
| 121 | + return $singular.'s'; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -467,20 +467,20 @@ |
||
| 467 | 467 | $pArray = []; |
| 468 | 468 | foreach ($this->getProperty() as $prop) { |
| 469 | 469 | if (in_array($prop->getName(), $pArray)) { |
| 470 | - $msg = "Property Names, and Navigation Property Must Be Unique " . __CLASS__; |
|
| 470 | + $msg = "Property Names, and Navigation Property Must Be Unique ".__CLASS__; |
|
| 471 | 471 | return false; |
| 472 | 472 | } |
| 473 | 473 | $pArray[] = $prop->getName(); |
| 474 | 474 | } |
| 475 | 475 | foreach ($this->getNavigationProperty() as $prop) { |
| 476 | 476 | if (in_array($prop->getName(), $pArray)) { |
| 477 | - $msg = "Property Names, and Navigation Property Must Be Unique " . __CLASS__; |
|
| 477 | + $msg = "Property Names, and Navigation Property Must Be Unique ".__CLASS__; |
|
| 478 | 478 | return false; |
| 479 | 479 | } |
| 480 | 480 | $pArray[] = $prop->getName(); |
| 481 | 481 | } |
| 482 | 482 | if (in_array($this->getName(), $pArray)) { |
| 483 | - $msg = "entity types can not contain a property with the same name " . __CLASS__; |
|
| 483 | + $msg = "entity types can not contain a property with the same name ".__CLASS__; |
|
| 484 | 484 | return false; |
| 485 | 485 | } |
| 486 | 486 | return true; |
@@ -29,6 +29,9 @@ |
||
| 29 | 29 | $this->v3MetadataAgainstXSD($d); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + /** |
|
| 33 | + * @param string $data |
|
| 34 | + */ |
|
| 32 | 35 | public function v3MetadataAgainstXSD($data) |
| 33 | 36 | { |
| 34 | 37 | $ds = DIRECTORY_SEPARATOR; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $ds = DIRECTORY_SEPARATOR; |
| 31 | 31 | $xml = new \DOMDocument(); |
| 32 | 32 | $xml->loadXML($data); |
| 33 | - $xml->schemaValidate(dirname(__DIR__) . $ds . "xsd" . $ds . "/Microsoft.Data.Entity.Design.Edmx_3.xsd"); |
|
| 33 | + $xml->schemaValidate(dirname(__DIR__).$ds."xsd".$ds."/Microsoft.Data.Entity.Design.Edmx_3.xsd"); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function testEntitysAndProperties() |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $metadataManager = new MetadataManager(); |
| 39 | 39 | |
| 40 | 40 | $eType = $metadataManager->addEntityType("Category"); |
| 41 | - $this->assertNotFalse($eType, "Etype is false not type " . $metadataManager->getLastError()); |
|
| 41 | + $this->assertNotFalse($eType, "Etype is false not type ".$metadataManager->getLastError()); |
|
| 42 | 42 | $metadataManager->addPropertyToEntityType($eType, "CategoryID", "Int32", null, false, true, "Identity"); |
| 43 | 43 | $metadataManager->addPropertyToEntityType($eType, "CategoryName", "String"); |
| 44 | 44 | $metadataManager->addPropertyToEntityType($eType, "Description", "String"); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $metadataManager = new MetadataManager(); |
| 64 | 64 | |
| 65 | 65 | $CategoryType = $metadataManager->addEntityType("Category"); |
| 66 | - $this->assertNotFalse($CategoryType, "Etype is false not type " . $metadataManager->getLastError()); |
|
| 66 | + $this->assertNotFalse($CategoryType, "Etype is false not type ".$metadataManager->getLastError()); |
|
| 67 | 67 | $metadataManager->addPropertyToEntityType($CategoryType, "CategoryID", "Int32", null, false, true, "Identity"); |
| 68 | 68 | $metadataManager->addPropertyToEntityType($CategoryType, "CategoryName", "String"); |
| 69 | 69 | $metadataManager->addPropertyToEntityType($CategoryType, "Description", "String"); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $regex = "/[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}/"; |
| 14 | 14 | |
| 15 | 15 | if (!is_string($string)) { |
| 16 | - $msg = "Input must be a string: ". get_class($this); |
|
| 16 | + $msg = "Input must be a string: ".get_class($this); |
|
| 17 | 17 | throw new \InvalidArgumentException($msg); |
| 18 | 18 | } |
| 19 | 19 | if ($this->isEDMSimpleTypeValid($string)) { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $regex = "/Collection\([^ \t]{1,}(\.[^ \t]{1,}){0,}\)/"; |
| 18 | 18 | |
| 19 | 19 | if (!is_string($string)) { |
| 20 | - $msg = "Input must be a string: ". get_class($this); |
|
| 20 | + $msg = "Input must be a string: ".get_class($this); |
|
| 21 | 21 | throw new \InvalidArgumentException($msg); |
| 22 | 22 | } |
| 23 | 23 | if ($this->isEDMSimpleTypeValid($string)) { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $regex = '/[^ \t]{1,}(\.[^ \t]{1,}){0,}/'; |
| 18 | 18 | |
| 19 | 19 | if (!is_string($string)) { |
| 20 | - $msg = "Input must be a string: ". get_class($this); |
|
| 20 | + $msg = "Input must be a string: ".get_class($this); |
|
| 21 | 21 | throw new \InvalidArgumentException($msg); |
| 22 | 22 | } |
| 23 | 23 | if ($this->isTQualifiedNameValid($string)) { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $regex = '/(Collection|Ref)\([^ \t]{1,}(\.[^ \t]{1,}){0,}\/)'; |
| 18 | 18 | |
| 19 | 19 | if (!is_string($string)) { |
| 20 | - $msg = "Input must be a string: ". get_class($this); |
|
| 20 | + $msg = "Input must be a string: ".get_class($this); |
|
| 21 | 21 | throw new \InvalidArgumentException($msg); |
| 22 | 22 | } |
| 23 | 23 | if ($this->isTQualifiedNameValid($string)) { |
@@ -47,6 +47,9 @@ discard block |
||
| 47 | 47 | return $this->serializer->serialize($this->V3Edmx, "xml"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $name |
|
| 52 | + */ |
|
| 50 | 53 | public function addEntityType($name, $accessType = "Public", $summary = null, $longDescription = null) |
| 51 | 54 | { |
| 52 | 55 | $this->startEdmxTransaction(); |
@@ -124,6 +127,11 @@ discard block |
||
| 124 | 127 | $this->oldEdmx = null; |
| 125 | 128 | } |
| 126 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $name |
|
| 132 | + * @param string $type |
|
| 133 | + * @param string $storeGeneratedPattern |
|
| 134 | + */ |
|
| 127 | 135 | public function addPropertyToEntityType( |
| 128 | 136 | $entityType, |
| 129 | 137 | $name, |
@@ -164,6 +172,11 @@ discard block |
||
| 164 | 172 | return $NewProperty; |
| 165 | 173 | } |
| 166 | 174 | |
| 175 | + /** |
|
| 176 | + * @param string $principalMultiplicity |
|
| 177 | + * @param string $principalProperty |
|
| 178 | + * @param string $dependentMultiplicity |
|
| 179 | + */ |
|
| 167 | 180 | public function addNavigationPropertyToEntityType( |
| 168 | 181 | TEntityTypeType $principalType, |
| 169 | 182 | $principalMultiplicity, |
@@ -331,6 +344,10 @@ discard block |
||
| 331 | 344 | return $association; |
| 332 | 345 | } |
| 333 | 346 | |
| 347 | + /** |
|
| 348 | + * @param string $principalEntitySetName |
|
| 349 | + * @param string $dependentEntitySetName |
|
| 350 | + */ |
|
| 334 | 351 | protected function createAssocationSetForAssocation( |
| 335 | 352 | TAssociationType $association, |
| 336 | 353 | $principalEntitySetName, |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | if (!$this->V3Edmx->isOK($msg)) { |
| 31 | 31 | throw new \Exception($msg); |
| 32 | 32 | } |
| 33 | - $ymlDir = __DIR__ . DIRECTORY_SEPARATOR . "MetadataV3" . DIRECTORY_SEPARATOR . "JMSmetadata"; |
|
| 33 | + $ymlDir = __DIR__.DIRECTORY_SEPARATOR."MetadataV3".DIRECTORY_SEPARATOR."JMSmetadata"; |
|
| 34 | 34 | $this->serializer = |
| 35 | 35 | SerializerBuilder::create() |
| 36 | 36 | ->addMetadataDir($ymlDir) |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (0 == strlen(trim($namespace))) { |
| 66 | 66 | $entityTypeName = $NewEntity->getName(); |
| 67 | 67 | } else { |
| 68 | - $entityTypeName = $namespace . "." . $NewEntity->getName(); |
|
| 68 | + $entityTypeName = $namespace.".".$NewEntity->getName(); |
|
| 69 | 69 | } |
| 70 | 70 | $entitySet->setEntityType($entityTypeName); |
| 71 | 71 | $entitySet->setGetterAccess($accessType); |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | $last_letter = strtolower($singular[strlen($singular) - 1]); |
| 107 | 107 | switch ($last_letter) { |
| 108 | 108 | case 'y': |
| 109 | - return substr($singular, 0, -1) . 'ies'; |
|
| 109 | + return substr($singular, 0, -1).'ies'; |
|
| 110 | 110 | case 's': |
| 111 | - return $singular . 'es'; |
|
| 111 | + return $singular.'es'; |
|
| 112 | 112 | default: |
| 113 | - return $singular . 's'; |
|
| 113 | + return $singular.'s'; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -185,21 +185,21 @@ discard block |
||
| 185 | 185 | $this->startEdmxTransaction(); |
| 186 | 186 | $principalEntitySetName = $this->pluralize(2, $principalType->getName()); |
| 187 | 187 | $dependentEntitySetName = $this->pluralize(2, $dependentType->getName()); |
| 188 | - $relationName = $principalType->getName() . "_" . $principalProperty . "_" |
|
| 189 | - . $dependentType->getName() . "_" . $dependentProperty; |
|
| 188 | + $relationName = $principalType->getName()."_".$principalProperty."_" |
|
| 189 | + . $dependentType->getName()."_".$dependentProperty; |
|
| 190 | 190 | $relationName = trim($relationName, "_"); |
| 191 | 191 | |
| 192 | 192 | $namespace = $this->V3Edmx->getDataServices()[0]->getNamespace(); |
| 193 | 193 | if (0 == strlen(trim($namespace))) { |
| 194 | 194 | $relationFQName = $relationName; |
| 195 | 195 | } else { |
| 196 | - $relationFQName = $namespace . "." . $relationName; |
|
| 196 | + $relationFQName = $namespace.".".$relationName; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | $principalNavigationProperty = new TNavigationPropertyType(); |
| 200 | 200 | $principalNavigationProperty->setName($principalProperty); |
| 201 | - $principalNavigationProperty->setToRole($dependentEntitySetName . "_" . $dependentProperty); |
|
| 202 | - $principalNavigationProperty->setFromRole($principalEntitySetName . "_" . $principalProperty); |
|
| 201 | + $principalNavigationProperty->setToRole($dependentEntitySetName."_".$dependentProperty); |
|
| 202 | + $principalNavigationProperty->setFromRole($principalEntitySetName."_".$principalProperty); |
|
| 203 | 203 | $principalNavigationProperty->setRelationship($relationFQName); |
| 204 | 204 | $principalNavigationProperty->setGetterAccess($principalGetterAccess); |
| 205 | 205 | $principalNavigationProperty->setSetterAccess($principalSetterAccess); |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | if (!empty($dependentProperty)) { |
| 216 | 216 | $dependentNavigationProperty = new TNavigationPropertyType(); |
| 217 | 217 | $dependentNavigationProperty->setName($dependentProperty); |
| 218 | - $dependentNavigationProperty->setToRole($principalEntitySetName . "_" . $principalProperty); |
|
| 219 | - $dependentNavigationProperty->setFromRole($dependentEntitySetName . "_" . $dependentProperty); |
|
| 218 | + $dependentNavigationProperty->setToRole($principalEntitySetName."_".$principalProperty); |
|
| 219 | + $dependentNavigationProperty->setFromRole($dependentEntitySetName."_".$dependentProperty); |
|
| 220 | 220 | $dependentNavigationProperty->setRelationship($relationFQName); |
| 221 | 221 | $dependentNavigationProperty->setGetterAccess($dependentGetterAccess); |
| 222 | 222 | $dependentNavigationProperty->setSetterAccess($dependentSetterAccess); |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | $principalTypeFQName = $principalType->getName(); |
| 288 | 288 | $dependentTypeFQName = $dependentType->getName(); |
| 289 | 289 | } else { |
| 290 | - $principalTypeFQName = $namespace . "." . $principalType->getName(); |
|
| 291 | - $dependentTypeFQName = $namespace . "." . $dependentType->getName(); |
|
| 290 | + $principalTypeFQName = $namespace.".".$principalType->getName(); |
|
| 291 | + $dependentTypeFQName = $namespace.".".$dependentType->getName(); |
|
| 292 | 292 | } |
| 293 | 293 | $association = new TAssociationType(); |
| 294 | 294 | $relationship = $principalNavigationProperty->getRelationship(); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | if (0 == strlen(trim($namespace))) { |
| 355 | 355 | $associationSetName = $association->getName(); |
| 356 | 356 | } else { |
| 357 | - $associationSetName = $namespace . "." . $association->getName(); |
|
| 357 | + $associationSetName = $namespace.".".$association->getName(); |
|
| 358 | 358 | } |
| 359 | 359 | $as->setAssociation($associationSetName); |
| 360 | 360 | $end1 = new EndAnonymousType(); |