@@ -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)) { |
@@ -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; |
@@ -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)) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function setName($name) |
| 83 | 83 | { |
| 84 | 84 | if (!$this->isTSimpleIdentifierValid($name)) { |
| 85 | - $msg = "Name(" . $name . ") must be a valid TSimpleIdentifier"; |
|
| 85 | + $msg = "Name(".$name.") must be a valid TSimpleIdentifier"; |
|
| 86 | 86 | throw new \InvalidArgumentException($msg); |
| 87 | 87 | } |
| 88 | 88 | $this->name = $name; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | public function isOK(&$msg = null) |
| 398 | 398 | { |
| 399 | 399 | if (!$this->isTSimpleIdentifierValid($this->name)) { |
| 400 | - $msg = "Name(" . $this->name . ") must be a valid TSimpleIdentifier " . __FILE__ . ":" . __LINE__; |
|
| 400 | + $msg = "Name(".$this->name.") must be a valid TSimpleIdentifier ".__FILE__.":".__LINE__; |
|
| 401 | 401 | return false; |
| 402 | 402 | } |
| 403 | 403 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | foreach ($this->associationSet as $assocationSet) { |
| 452 | 452 | if (!in_array($assocationSet->getEnd()[0]->getEntitySet(), $entityNames)) { |
| 453 | - $msg = "The entitysets for assocations must have a valid entity set. " . $assocationSet->getName() . " Does not"; |
|
| 453 | + $msg = "The entitysets for assocations must have a valid entity set. ".$assocationSet->getName()." Does not"; |
|
| 454 | 454 | return false; |
| 455 | 455 | } |
| 456 | 456 | } |
@@ -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 | $this->startEdmxTransaction(); |
@@ -126,6 +129,11 @@ discard block |
||
| 126 | 129 | //$this->oldEdmx = null; |
| 127 | 130 | } |
| 128 | 131 | |
| 132 | + /** |
|
| 133 | + * @param string $name |
|
| 134 | + * @param string $type |
|
| 135 | + * @param string $storeGeneratedPattern |
|
| 136 | + */ |
|
| 129 | 137 | public function addPropertyToEntityType( |
| 130 | 138 | $entityType, |
| 131 | 139 | $name, |
@@ -166,6 +174,11 @@ discard block |
||
| 166 | 174 | return $NewProperty; |
| 167 | 175 | } |
| 168 | 176 | |
| 177 | + /** |
|
| 178 | + * @param string $principalMultiplicity |
|
| 179 | + * @param string $principalProperty |
|
| 180 | + * @param string $dependentMultiplicity |
|
| 181 | + */ |
|
| 169 | 182 | public function addNavigationPropertyToEntityType( |
| 170 | 183 | TEntityTypeType $principalType, |
| 171 | 184 | $principalMultiplicity, |
@@ -344,6 +357,10 @@ discard block |
||
| 344 | 357 | return $association; |
| 345 | 358 | } |
| 346 | 359 | |
| 360 | + /** |
|
| 361 | + * @param string $principalEntitySetName |
|
| 362 | + * @param string $dependentEntitySetName |
|
| 363 | + */ |
|
| 347 | 364 | protected function createAssocationSetForAssocation( |
| 348 | 365 | TAssociationType $association, |
| 349 | 366 | $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); |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | $last_letter = strtolower($singular[strlen($singular) - 1]); |
| 106 | 106 | switch ($last_letter) { |
| 107 | 107 | case 'y': |
| 108 | - return substr($singular, 0, -1) . 'ies'; |
|
| 108 | + return substr($singular, 0, -1).'ies'; |
|
| 109 | 109 | case 's': |
| 110 | - return $singular . 'es'; |
|
| 110 | + return $singular.'es'; |
|
| 111 | 111 | default: |
| 112 | - return $singular . 's'; |
|
| 112 | + return $singular.'s'; |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
@@ -184,21 +184,21 @@ discard block |
||
| 184 | 184 | $this->startEdmxTransaction(); |
| 185 | 185 | $principalEntitySetName = Str::plural($principalType->getName(), 2); |
| 186 | 186 | $dependentEntitySetName = Str::plural($dependentType->getName(), 2); |
| 187 | - $relationName = $principalType->getName() . "_" . $principalProperty . "_" |
|
| 188 | - . $dependentType->getName() . "_" . $dependentProperty; |
|
| 187 | + $relationName = $principalType->getName()."_".$principalProperty."_" |
|
| 188 | + . $dependentType->getName()."_".$dependentProperty; |
|
| 189 | 189 | $relationName = trim($relationName, "_"); |
| 190 | 190 | |
| 191 | 191 | $namespace = $this->V3Edmx->getDataServiceType()->getSchema()[0]->getNamespace(); |
| 192 | 192 | if (0 == strlen(trim($namespace))) { |
| 193 | 193 | $relationFQName = $relationName; |
| 194 | 194 | } else { |
| 195 | - $relationFQName = $namespace . "." . $relationName; |
|
| 195 | + $relationFQName = $namespace.".".$relationName; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | $principalNavigationProperty = new TNavigationPropertyType(); |
| 199 | 199 | $principalNavigationProperty->setName($principalProperty); |
| 200 | - $principalNavigationProperty->setToRole(trim($dependentEntitySetName . "_" . $dependentProperty, "_")); |
|
| 201 | - $principalNavigationProperty->setFromRole($principalEntitySetName . "_" . $principalProperty); |
|
| 200 | + $principalNavigationProperty->setToRole(trim($dependentEntitySetName."_".$dependentProperty, "_")); |
|
| 201 | + $principalNavigationProperty->setFromRole($principalEntitySetName."_".$principalProperty); |
|
| 202 | 202 | $principalNavigationProperty->setRelationship($relationFQName); |
| 203 | 203 | $principalNavigationProperty->setGetterAccess($principalGetterAccess); |
| 204 | 204 | $principalNavigationProperty->setSetterAccess($principalSetterAccess); |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | if (!empty($dependentProperty)) { |
| 214 | 214 | $dependentNavigationProperty = new TNavigationPropertyType(); |
| 215 | 215 | $dependentNavigationProperty->setName($dependentProperty); |
| 216 | - $dependentNavigationProperty->setToRole($principalEntitySetName . "_" . $principalProperty); |
|
| 217 | - $dependentNavigationProperty->setFromRole($dependentEntitySetName . "_" . $dependentProperty); |
|
| 216 | + $dependentNavigationProperty->setToRole($principalEntitySetName."_".$principalProperty); |
|
| 217 | + $dependentNavigationProperty->setFromRole($dependentEntitySetName."_".$dependentProperty); |
|
| 218 | 218 | $dependentNavigationProperty->setRelationship($relationFQName); |
| 219 | 219 | $dependentNavigationProperty->setGetterAccess($dependentGetterAccess); |
| 220 | 220 | $dependentNavigationProperty->setSetterAccess($dependentSetterAccess); |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | $principalTypeFQName = $principalType->getName(); |
| 286 | 286 | $dependentTypeFQName = $dependentType->getName(); |
| 287 | 287 | } else { |
| 288 | - $principalTypeFQName = $namespace . "." . $principalType->getName(); |
|
| 289 | - $dependentTypeFQName = $namespace . "." . $dependentType->getName(); |
|
| 288 | + $principalTypeFQName = $namespace.".".$principalType->getName(); |
|
| 289 | + $dependentTypeFQName = $namespace.".".$dependentType->getName(); |
|
| 290 | 290 | } |
| 291 | 291 | $association = new TAssociationType(); |
| 292 | 292 | $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(); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | private function initSerialiser() |
| 377 | 377 | { |
| 378 | - $ymlDir = __DIR__ . DIRECTORY_SEPARATOR . "MetadataV3" . DIRECTORY_SEPARATOR . "JMSmetadata"; |
|
| 378 | + $ymlDir = __DIR__.DIRECTORY_SEPARATOR."MetadataV3".DIRECTORY_SEPARATOR."JMSmetadata"; |
|
| 379 | 379 | $this->serializer = |
| 380 | 380 | SerializerBuilder::create() |
| 381 | 381 | ->addMetadataDir($ymlDir) |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | die($this->getNamespace()); |
| 150 | 150 | return false; |
| 151 | 151 | }*/ |
| 152 | - $eSetType = str_replace($this->getNamespace() . ".", "", $eSetType); |
|
| 152 | + $eSetType = str_replace($this->getNamespace().".", "", $eSetType); |
|
| 153 | 153 | if (!in_array($eSetType, $entityTypeNames)) { |
| 154 | 154 | $msg = "entitySet Types should have a matching type name in entity Types"; |
| 155 | 155 | return false; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | // Check Associations to associationSets |
| 160 | 160 | if (count($associationSets) != count($associationNames)) { |
| 161 | - $msg = "we have " . count($associationSets) . "association sets and " . count($associationNames) |
|
| 161 | + $msg = "we have ".count($associationSets)."association sets and ".count($associationNames) |
|
| 162 | 162 | . " associations, they should be the same"; |
| 163 | 163 | } |
| 164 | 164 | if (count($associationNames) * 2 < count($navigationProperties)) { |
@@ -167,33 +167,33 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | foreach ($associationNames as $associationName => $associationEnds) { |
| 169 | 169 | if (!array_key_exists($associationName, $associationSets)) { |
| 170 | - $msg = "association " . $associationName . " exists without matching associationSet"; |
|
| 170 | + $msg = "association ".$associationName." exists without matching associationSet"; |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if (!array_key_exists($associationName, $navigationProperties)) { |
| 175 | - $msg = "association " . $associationName . " exists without matching Natvigation Property"; |
|
| 175 | + $msg = "association ".$associationName." exists without matching Natvigation Property"; |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | $roles = [$associationEnds[0]->getRole(), $associationEnds[1]->getRole()]; |
| 179 | 179 | if (!in_array($associationSets[$associationName][0]->getRole(), $roles)) { |
| 180 | - $msg = "association Set role " . $associationSets[$associationName][0]->getRole() |
|
| 180 | + $msg = "association Set role ".$associationSets[$associationName][0]->getRole() |
|
| 181 | 181 | . "lacks a matching property in the attached association"; |
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | 184 | if (!in_array($associationSets[$associationName][1]->getRole(), $roles)) { |
| 185 | - $msg = "association Set role " . $associationSets[$associationName][1]->getRole() |
|
| 185 | + $msg = "association Set role ".$associationSets[$associationName][1]->getRole() |
|
| 186 | 186 | . "lacks a matching property in the attached association"; |
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | foreach ($navigationProperties[$associationName] as $navProp) { |
| 190 | 190 | if (!in_array($navProp->getToRole(), $roles)) { |
| 191 | - $msg = "Navigation Property Role " . $navProp->getToRole() |
|
| 191 | + $msg = "Navigation Property Role ".$navProp->getToRole() |
|
| 192 | 192 | . " lacks a matching Property in the assocation"; |
| 193 | 193 | return false; |
| 194 | 194 | } |
| 195 | 195 | if (!in_array($navProp->getFromRole(), $roles)) { |
| 196 | - $msg = "Navigation Property Role " .$navProp->getToRole() |
|
| 196 | + $msg = "Navigation Property Role ".$navProp->getToRole() |
|
| 197 | 197 | . " lacks a matching Property in the assocation"; |
| 198 | 198 | return false; |
| 199 | 199 | } |