@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $ds = DIRECTORY_SEPARATOR; |
| 31 | 31 | |
| 32 | - $goodxsd = dirname(__DIR__) . $ds . "xsd" . $ds . "Microsoft.Data.Entity.Design.Edmx_3.Fixed.xsd"; |
|
| 32 | + $goodxsd = dirname(__DIR__).$ds."xsd".$ds."Microsoft.Data.Entity.Design.Edmx_3.Fixed.xsd"; |
|
| 33 | 33 | if (!file_exists($goodxsd)) { |
| 34 | 34 | return true; |
| 35 | 35 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $metadataManager = new MetadataManager(); |
| 44 | 44 | |
| 45 | 45 | $eType = $metadataManager->addEntityType("Category"); |
| 46 | - $this->assertNotFalse($eType, "Etype is false not type " . $metadataManager->getLastError()); |
|
| 46 | + $this->assertNotFalse($eType, "Etype is false not type ".$metadataManager->getLastError()); |
|
| 47 | 47 | $metadataManager->addPropertyToEntityType($eType, "CategoryID", "Int32", null, false, true, "Identity"); |
| 48 | 48 | $metadataManager->addPropertyToEntityType($eType, "CategoryName", "String"); |
| 49 | 49 | $metadataManager->addPropertyToEntityType($eType, "Description", "String"); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $metadataManager = new MetadataManager(); |
| 70 | 70 | |
| 71 | 71 | $CategoryType = $metadataManager->addEntityType("Category"); |
| 72 | - $this->assertNotFalse($CategoryType, "Etype is false not type " . $metadataManager->getLastError()); |
|
| 72 | + $this->assertNotFalse($CategoryType, "Etype is false not type ".$metadataManager->getLastError()); |
|
| 73 | 73 | $metadataManager->addPropertyToEntityType($CategoryType, "CategoryID", "Int32", null, false, true, "Identity"); |
| 74 | 74 | $metadataManager->addPropertyToEntityType($CategoryType, "CategoryName", "String"); |
| 75 | 75 | $metadataManager->addPropertyToEntityType($CategoryType, "Description", "String"); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | for ($i = 0; $i < 100; $i++) { |
| 32 | 32 | $actualMax = max($type->getRand(), $actualMax); |
| 33 | 33 | } |
| 34 | - $this->assertTrue($expectedMax >= $actualMax, $actualMax . " must be less than ".$expectedMax); |
|
| 34 | + $this->assertTrue($expectedMax >= $actualMax, $actualMax." must be less than ".$expectedMax); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function testGetRandMinimum() |
@@ -42,6 +42,6 @@ discard block |
||
| 42 | 42 | for ($i = 0; $i < 100; $i++) { |
| 43 | 43 | $actualMin = min($type->getRand(), $actualMin); |
| 44 | 44 | } |
| 45 | - $this->assertTrue($expectedMin <= $actualMin, $actualMin . " must be less than ".$expectedMin); |
|
| 45 | + $this->assertTrue($expectedMin <= $actualMin, $actualMin." must be less than ".$expectedMin); |
|
| 46 | 46 | } |
| 47 | 47 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $edmx = new Edmx(); |
| 27 | 27 | $this->assertTrue($edmx->isOK($msg), $msg); |
| 28 | 28 | $this->assertNull($msg); |
| 29 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 29 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 30 | 30 | $serializer = |
| 31 | 31 | \JMS\Serializer\SerializerBuilder::create() |
| 32 | 32 | ->addMetadataDir($ymlDir) |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $ds = DIRECTORY_SEPARATOR; |
| 41 | 41 | |
| 42 | - $goodxsd = dirname(__DIR__) . $ds . "xsd" . $ds . "Microsoft.Data.Entity.Design.Edmx_3.Fixed.xsd"; |
|
| 42 | + $goodxsd = dirname(__DIR__).$ds."xsd".$ds."Microsoft.Data.Entity.Design.Edmx_3.Fixed.xsd"; |
|
| 43 | 43 | if (!file_exists($goodxsd)) { |
| 44 | 44 | return true; |
| 45 | 45 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | private function checkEdmxSerialiseDeserialiseRoundTrip($ds, $edmx, $msg) |
| 67 | 67 | { |
| 68 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 68 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 69 | 69 | $serializer = |
| 70 | 70 | \JMS\Serializer\SerializerBuilder::create() |
| 71 | 71 | ->addMetadataDir($ymlDir) |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $this->assertNull($msg); |
| 113 | 113 | |
| 114 | 114 | |
| 115 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 115 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 116 | 116 | $serializer = |
| 117 | 117 | \JMS\Serializer\SerializerBuilder::create() |
| 118 | 118 | ->addMetadataDir($ymlDir) |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | $ds = DIRECTORY_SEPARATOR; |
| 145 | 145 | $msg = null; |
| 146 | 146 | |
| 147 | - $docLocation = dirname(__DIR__) . $ds . "tests" . $ds . "exampleV3ServiceDocument.xml"; |
|
| 147 | + $docLocation = dirname(__DIR__).$ds."tests".$ds."exampleV3ServiceDocument.xml"; |
|
| 148 | 148 | $document = file_get_contents($docLocation); |
| 149 | 149 | $type = 'AlgoWeb\ODataMetadata\MetadataV3\edmx\TDataServicesType'; |
| 150 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 150 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 151 | 151 | |
| 152 | 152 | $serializer = |
| 153 | 153 | \JMS\Serializer\SerializerBuilder::create() |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | $ds = DIRECTORY_SEPARATOR; |
| 165 | 165 | $msg = null; |
| 166 | 166 | |
| 167 | - $docLocation = dirname(__DIR__) . $ds . "tests" . $ds . "exampleV3ServiceMetadata.xml"; |
|
| 167 | + $docLocation = dirname(__DIR__).$ds."tests".$ds."exampleV3ServiceMetadata.xml"; |
|
| 168 | 168 | $document = file_get_contents($docLocation); |
| 169 | 169 | $type = 'AlgoWeb\ODataMetadata\MetadataV3\edmx\Edmx'; |
| 170 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 170 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 171 | 171 | |
| 172 | 172 | $serializer = |
| 173 | 173 | \JMS\Serializer\SerializerBuilder::create() |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | $ds = DIRECTORY_SEPARATOR; |
| 186 | 186 | $msg = null; |
| 187 | 187 | |
| 188 | - $docLocation = dirname(__DIR__) . $ds . "tests" . $ds . "exampleV3ServiceMetadata.xml"; |
|
| 188 | + $docLocation = dirname(__DIR__).$ds."tests".$ds."exampleV3ServiceMetadata.xml"; |
|
| 189 | 189 | $document = file_get_contents($docLocation); |
| 190 | 190 | $this->v3MetadataAgainstXSD($document); |
| 191 | 191 | $type = 'AlgoWeb\ODataMetadata\MetadataV3\edmx\Edmx'; |
| 192 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 192 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 193 | 193 | |
| 194 | 194 | $serializer = |
| 195 | 195 | \JMS\Serializer\SerializerBuilder::create() |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $this->assertNull($msg); |
| 231 | 231 | |
| 232 | 232 | |
| 233 | - $ymlDir = dirname(__DIR__) . $ds . "src" . $ds . "MetadataV3" . $ds . "JMSmetadata"; |
|
| 233 | + $ymlDir = dirname(__DIR__).$ds."src".$ds."MetadataV3".$ds."JMSmetadata"; |
|
| 234 | 234 | $serializer = |
| 235 | 235 | \JMS\Serializer\SerializerBuilder::create() |
| 236 | 236 | ->addMetadataDir($ymlDir) |
@@ -49,6 +49,9 @@ discard block |
||
| 49 | 49 | return $this->serializer->serialize($this->getEdmx(), "xml"); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $name |
|
| 54 | + */ |
|
| 52 | 55 | public function addEntityType($name, $accessType = "Public", $summary = null, $longDescription = null) |
| 53 | 56 | { |
| 54 | 57 | $NewEntity = new TEntityTypeType(); |
@@ -124,6 +127,11 @@ discard block |
||
| 124 | 127 | return $NewProperty; |
| 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, |
@@ -161,6 +169,11 @@ discard block |
||
| 161 | 169 | return $NewProperty; |
| 162 | 170 | } |
| 163 | 171 | |
| 172 | + /** |
|
| 173 | + * @param string $principalMultiplicity |
|
| 174 | + * @param string $principalProperty |
|
| 175 | + * @param string $dependentMultiplicity |
|
| 176 | + */ |
|
| 164 | 177 | public function addNavigationPropertyToEntityType( |
| 165 | 178 | TEntityTypeType $principalType, |
| 166 | 179 | $principalMultiplicity, |
@@ -337,6 +350,10 @@ discard block |
||
| 337 | 350 | return $association; |
| 338 | 351 | } |
| 339 | 352 | |
| 353 | + /** |
|
| 354 | + * @param string $principalEntitySetName |
|
| 355 | + * @param string $dependentEntitySetName |
|
| 356 | + */ |
|
| 340 | 357 | protected function createAssocationSetForAssocation( |
| 341 | 358 | TAssociationType $association, |
| 342 | 359 | $principalEntitySetName, |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if (0 == strlen(trim($namespace))) { |
| 65 | 65 | $entityTypeName = $NewEntity->getName(); |
| 66 | 66 | } else { |
| 67 | - $entityTypeName = $namespace . "." . $NewEntity->getName(); |
|
| 67 | + $entityTypeName = $namespace.".".$NewEntity->getName(); |
|
| 68 | 68 | } |
| 69 | 69 | $entitySet->setEntityType($entityTypeName); |
| 70 | 70 | $entitySet->setGetterAccess($accessType); |
@@ -181,21 +181,21 @@ discard block |
||
| 181 | 181 | ) { |
| 182 | 182 | $principalEntitySetName = Str::plural($principalType->getName(), 2); |
| 183 | 183 | $dependentEntitySetName = Str::plural($dependentType->getName(), 2); |
| 184 | - $relationName = $principalType->getName() . "_" . $principalProperty . "_" |
|
| 185 | - . $dependentType->getName() . "_" . $dependentProperty; |
|
| 184 | + $relationName = $principalType->getName()."_".$principalProperty."_" |
|
| 185 | + . $dependentType->getName()."_".$dependentProperty; |
|
| 186 | 186 | $relationName = trim($relationName, "_"); |
| 187 | 187 | |
| 188 | 188 | $namespace = $this->V3Edmx->getDataServiceType()->getSchema()[0]->getNamespace(); |
| 189 | 189 | if (0 == strlen(trim($namespace))) { |
| 190 | 190 | $relationFQName = $relationName; |
| 191 | 191 | } else { |
| 192 | - $relationFQName = $namespace . "." . $relationName; |
|
| 192 | + $relationFQName = $namespace.".".$relationName; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $principalNavigationProperty = new TNavigationPropertyType(); |
| 196 | 196 | $principalNavigationProperty->setName($principalProperty); |
| 197 | - $principalNavigationProperty->setToRole(trim($dependentEntitySetName . "_" . $dependentProperty, "_")); |
|
| 198 | - $principalNavigationProperty->setFromRole($principalEntitySetName . "_" . $principalProperty); |
|
| 197 | + $principalNavigationProperty->setToRole(trim($dependentEntitySetName."_".$dependentProperty, "_")); |
|
| 198 | + $principalNavigationProperty->setFromRole($principalEntitySetName."_".$principalProperty); |
|
| 199 | 199 | $principalNavigationProperty->setRelationship($relationFQName); |
| 200 | 200 | $principalNavigationProperty->setGetterAccess($principalGetterAccess); |
| 201 | 201 | $principalNavigationProperty->setSetterAccess($principalSetterAccess); |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | if (!empty($dependentProperty)) { |
| 211 | 211 | $dependentNavigationProperty = new TNavigationPropertyType(); |
| 212 | 212 | $dependentNavigationProperty->setName($dependentProperty); |
| 213 | - $dependentNavigationProperty->setToRole($principalEntitySetName . "_" . $principalProperty); |
|
| 214 | - $dependentNavigationProperty->setFromRole($dependentEntitySetName . "_" . $dependentProperty); |
|
| 213 | + $dependentNavigationProperty->setToRole($principalEntitySetName."_".$principalProperty); |
|
| 214 | + $dependentNavigationProperty->setFromRole($dependentEntitySetName."_".$dependentProperty); |
|
| 215 | 215 | $dependentNavigationProperty->setRelationship($relationFQName); |
| 216 | 216 | $dependentNavigationProperty->setGetterAccess($dependentGetterAccess); |
| 217 | 217 | $dependentNavigationProperty->setSetterAccess($dependentSetterAccess); |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | $principalTypeFQName = $principalType->getName(); |
| 281 | 281 | $dependentTypeFQName = $dependentType->getName(); |
| 282 | 282 | } else { |
| 283 | - $principalTypeFQName = $namespace . "." . $principalType->getName(); |
|
| 284 | - $dependentTypeFQName = $namespace . "." . $dependentType->getName(); |
|
| 283 | + $principalTypeFQName = $namespace.".".$principalType->getName(); |
|
| 284 | + $dependentTypeFQName = $namespace.".".$dependentType->getName(); |
|
| 285 | 285 | } |
| 286 | 286 | $association = new TAssociationType(); |
| 287 | 287 | $relationship = $principalNavigationProperty->getRelationship(); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | if (0 == strlen(trim($namespace))) { |
| 350 | 350 | $associationSetName = $association->getName(); |
| 351 | 351 | } else { |
| 352 | - $associationSetName = $namespace . "." . $association->getName(); |
|
| 352 | + $associationSetName = $namespace.".".$association->getName(); |
|
| 353 | 353 | } |
| 354 | 354 | $as->setAssociation($associationSetName); |
| 355 | 355 | $end1 = new EndAnonymousType(); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | private function initSerialiser() |
| 372 | 372 | { |
| 373 | - $ymlDir = __DIR__ . DIRECTORY_SEPARATOR . "MetadataV3" . DIRECTORY_SEPARATOR . "JMSmetadata"; |
|
| 373 | + $ymlDir = __DIR__.DIRECTORY_SEPARATOR."MetadataV3".DIRECTORY_SEPARATOR."JMSmetadata"; |
|
| 374 | 374 | $this->serializer = |
| 375 | 375 | SerializerBuilder::create() |
| 376 | 376 | ->addMetadataDir($ymlDir) |