|
@@ 592-617 (lines=26) @@
|
| 589 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 590 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 591 |
|
*/ |
| 592 |
|
public function addResourceReferencePropertyBidirectional( |
| 593 |
|
ResourceEntityType $sourceResourceType, |
| 594 |
|
ResourceEntityType $targetResourceType, |
| 595 |
|
$sourceProperty, |
| 596 |
|
$targetProperty |
| 597 |
|
) { |
| 598 |
|
$this->addReferencePropertyInternalBidirectional( |
| 599 |
|
$sourceResourceType, |
| 600 |
|
$targetResourceType, |
| 601 |
|
$sourceProperty, |
| 602 |
|
$targetProperty, |
| 603 |
|
'*', |
| 604 |
|
'1' |
| 605 |
|
); |
| 606 |
|
// verify resource property types are what we expect them to be |
| 607 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 608 |
|
assert( |
| 609 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind, |
| 610 |
|
'1 side of 1:N relationship not pointing to resource reference' |
| 611 |
|
); |
| 612 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 613 |
|
assert( |
| 614 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind, |
| 615 |
|
'N side of 1:N relationship not pointing to resource set reference' |
| 616 |
|
); |
| 617 |
|
} |
| 618 |
|
|
| 619 |
|
/** |
| 620 |
|
* To add a navigation property (resource set or resource reference) |
|
@@ 848-873 (lines=26) @@
|
| 845 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 846 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 847 |
|
*/ |
| 848 |
|
public function addResourceSetReferencePropertyBidirectional( |
| 849 |
|
ResourceEntityType $sourceResourceType, |
| 850 |
|
ResourceEntityType $targetResourceType, |
| 851 |
|
$sourceProperty, |
| 852 |
|
$targetProperty |
| 853 |
|
) { |
| 854 |
|
$this->addReferencePropertyInternalBidirectional( |
| 855 |
|
$sourceResourceType, |
| 856 |
|
$targetResourceType, |
| 857 |
|
$sourceProperty, |
| 858 |
|
$targetProperty, |
| 859 |
|
'*', |
| 860 |
|
'*' |
| 861 |
|
); |
| 862 |
|
// verify resource property types are what we expect them to be |
| 863 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 864 |
|
assert( |
| 865 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $sourceResourceKind, |
| 866 |
|
'M side of M:N relationship not pointing to resource set reference' |
| 867 |
|
); |
| 868 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 869 |
|
assert( |
| 870 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind, |
| 871 |
|
'N side of M:N relationship not pointing to resource set reference' |
| 872 |
|
); |
| 873 |
|
} |
| 874 |
|
|
| 875 |
|
/** |
| 876 |
|
* To add a 1-1 resource reference. |
|
@@ 885-910 (lines=26) @@
|
| 882 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 883 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 884 |
|
*/ |
| 885 |
|
public function addResourceReferenceSinglePropertyBidirectional( |
| 886 |
|
ResourceEntityType $sourceResourceType, |
| 887 |
|
ResourceEntityType $targetResourceType, |
| 888 |
|
$sourceProperty, |
| 889 |
|
$targetProperty |
| 890 |
|
) { |
| 891 |
|
$this->addReferencePropertyInternalBidirectional( |
| 892 |
|
$sourceResourceType, |
| 893 |
|
$targetResourceType, |
| 894 |
|
$sourceProperty, |
| 895 |
|
$targetProperty, |
| 896 |
|
'1', |
| 897 |
|
'0..1' |
| 898 |
|
); |
| 899 |
|
// verify resource property types are what we expect them to be |
| 900 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 901 |
|
assert( |
| 902 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind, |
| 903 |
|
'1 side of 1:1 relationship not pointing to resource reference' |
| 904 |
|
); |
| 905 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 906 |
|
assert( |
| 907 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $targetResourceKind, |
| 908 |
|
'0..1 side of 1:1 relationship not pointing to resource reference' |
| 909 |
|
); |
| 910 |
|
} |
| 911 |
|
|
| 912 |
|
/** |
| 913 |
|
* To add a complex property to entity or complex type. |