|
@@ 623-648 (lines=26) @@
|
| 620 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 621 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 622 |
|
*/ |
| 623 |
|
public function addResourceReferencePropertyBidirectional( |
| 624 |
|
ResourceEntityType $sourceResourceType, |
| 625 |
|
ResourceEntityType $targetResourceType, |
| 626 |
|
$sourceProperty, |
| 627 |
|
$targetProperty |
| 628 |
|
) { |
| 629 |
|
$this->addReferencePropertyInternalBidirectional( |
| 630 |
|
$sourceResourceType, |
| 631 |
|
$targetResourceType, |
| 632 |
|
$sourceProperty, |
| 633 |
|
$targetProperty, |
| 634 |
|
'*', |
| 635 |
|
'1' |
| 636 |
|
); |
| 637 |
|
// verify resource property types are what we expect them to be |
| 638 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 639 |
|
assert( |
| 640 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind, |
| 641 |
|
'1 side of 1:N relationship not pointing to resource reference' |
| 642 |
|
); |
| 643 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 644 |
|
assert( |
| 645 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind, |
| 646 |
|
'N side of 1:N relationship not pointing to resource set reference' |
| 647 |
|
); |
| 648 |
|
} |
| 649 |
|
|
| 650 |
|
/** |
| 651 |
|
* To add a navigation property (resource set or resource reference) |
|
@@ 880-905 (lines=26) @@
|
| 877 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 878 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 879 |
|
*/ |
| 880 |
|
public function addResourceSetReferencePropertyBidirectional( |
| 881 |
|
ResourceEntityType $sourceResourceType, |
| 882 |
|
ResourceEntityType $targetResourceType, |
| 883 |
|
$sourceProperty, |
| 884 |
|
$targetProperty |
| 885 |
|
) { |
| 886 |
|
$this->addReferencePropertyInternalBidirectional( |
| 887 |
|
$sourceResourceType, |
| 888 |
|
$targetResourceType, |
| 889 |
|
$sourceProperty, |
| 890 |
|
$targetProperty, |
| 891 |
|
'*', |
| 892 |
|
'*' |
| 893 |
|
); |
| 894 |
|
// verify resource property types are what we expect them to be |
| 895 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 896 |
|
assert( |
| 897 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $sourceResourceKind, |
| 898 |
|
'M side of M:N relationship not pointing to resource set reference' |
| 899 |
|
); |
| 900 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 901 |
|
assert( |
| 902 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind, |
| 903 |
|
'N side of M:N relationship not pointing to resource set reference' |
| 904 |
|
); |
| 905 |
|
} |
| 906 |
|
|
| 907 |
|
/** |
| 908 |
|
* To add a 1-1 resource reference. |
|
@@ 917-942 (lines=26) @@
|
| 914 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 915 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 916 |
|
*/ |
| 917 |
|
public function addResourceReferenceSinglePropertyBidirectional( |
| 918 |
|
ResourceEntityType $sourceResourceType, |
| 919 |
|
ResourceEntityType $targetResourceType, |
| 920 |
|
$sourceProperty, |
| 921 |
|
$targetProperty |
| 922 |
|
) { |
| 923 |
|
$this->addReferencePropertyInternalBidirectional( |
| 924 |
|
$sourceResourceType, |
| 925 |
|
$targetResourceType, |
| 926 |
|
$sourceProperty, |
| 927 |
|
$targetProperty, |
| 928 |
|
'1', |
| 929 |
|
'0..1' |
| 930 |
|
); |
| 931 |
|
// verify resource property types are what we expect them to be |
| 932 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 933 |
|
assert( |
| 934 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind, |
| 935 |
|
'1 side of 1:1 relationship not pointing to resource reference' |
| 936 |
|
); |
| 937 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 938 |
|
assert( |
| 939 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $targetResourceKind, |
| 940 |
|
'0..1 side of 1:1 relationship not pointing to resource reference' |
| 941 |
|
); |
| 942 |
|
} |
| 943 |
|
|
| 944 |
|
/** |
| 945 |
|
* To add a complex property to entity or complex type. |