|
@@ 538-563 (lines=26) @@
|
| 535 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 536 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 537 |
|
*/ |
| 538 |
|
public function addResourceReferencePropertyBidirectional( |
| 539 |
|
ResourceEntityType $sourceResourceType, |
| 540 |
|
ResourceEntityType $targetResourceType, |
| 541 |
|
$sourceProperty, |
| 542 |
|
$targetProperty |
| 543 |
|
) { |
| 544 |
|
$this->_addReferencePropertyInternalBidirectional( |
| 545 |
|
$sourceResourceType, |
| 546 |
|
$targetResourceType, |
| 547 |
|
$sourceProperty, |
| 548 |
|
$targetProperty, |
| 549 |
|
'1', |
| 550 |
|
'*' |
| 551 |
|
); |
| 552 |
|
// verify resource property types are what we expect them to be |
| 553 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 554 |
|
assert( |
| 555 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind, |
| 556 |
|
"1 side of 1:N relationship not pointing to resource reference" |
| 557 |
|
); |
| 558 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 559 |
|
assert( |
| 560 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind, |
| 561 |
|
"N side of 1:N relationship not pointing to resource set reference" |
| 562 |
|
); |
| 563 |
|
} |
| 564 |
|
|
| 565 |
|
/** |
| 566 |
|
* To add a navigation property (resource set or resource reference) |
|
@@ 778-803 (lines=26) @@
|
| 775 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 776 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 777 |
|
*/ |
| 778 |
|
public function addResourceSetReferencePropertyBidirectional( |
| 779 |
|
ResourceEntityType $sourceResourceType, |
| 780 |
|
ResourceEntityType $targetResourceType, |
| 781 |
|
$sourceProperty, |
| 782 |
|
$targetProperty |
| 783 |
|
) { |
| 784 |
|
$this->_addReferencePropertyInternalBidirectional( |
| 785 |
|
$sourceResourceType, |
| 786 |
|
$targetResourceType, |
| 787 |
|
$sourceProperty, |
| 788 |
|
$targetProperty, |
| 789 |
|
'*', |
| 790 |
|
'*' |
| 791 |
|
); |
| 792 |
|
// verify resource property types are what we expect them to be |
| 793 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 794 |
|
assert( |
| 795 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $sourceResourceKind, |
| 796 |
|
"M side of M:N relationship not pointing to resource set reference" |
| 797 |
|
); |
| 798 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 799 |
|
assert( |
| 800 |
|
ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind, |
| 801 |
|
"N side of M:N relationship not pointing to resource set reference" |
| 802 |
|
); |
| 803 |
|
} |
| 804 |
|
|
| 805 |
|
/** |
| 806 |
|
* To add a 1-1 resource reference. |
|
@@ 815-840 (lines=26) @@
|
| 812 |
|
* @param string $sourceProperty The name of the property to add, on source type |
| 813 |
|
* @param string $targetProperty The name of the property to add, on target type |
| 814 |
|
*/ |
| 815 |
|
public function addResourceReferenceSinglePropertyBidirectional( |
| 816 |
|
ResourceEntityType $sourceResourceType, |
| 817 |
|
ResourceEntityType $targetResourceType, |
| 818 |
|
$sourceProperty, |
| 819 |
|
$targetProperty |
| 820 |
|
) { |
| 821 |
|
$this->_addReferencePropertyInternalBidirectional( |
| 822 |
|
$sourceResourceType, |
| 823 |
|
$targetResourceType, |
| 824 |
|
$sourceProperty, |
| 825 |
|
$targetProperty, |
| 826 |
|
'1', |
| 827 |
|
'0..1' |
| 828 |
|
); |
| 829 |
|
// verify resource property types are what we expect them to be |
| 830 |
|
$sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind(); |
| 831 |
|
assert( |
| 832 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind, |
| 833 |
|
"1 side of 1:1 relationship not pointing to resource reference" |
| 834 |
|
); |
| 835 |
|
$targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind(); |
| 836 |
|
assert( |
| 837 |
|
ResourcePropertyKind::RESOURCE_REFERENCE == $targetResourceKind, |
| 838 |
|
"0..1 side of 1:1 relationship not pointing to resource reference" |
| 839 |
|
); |
| 840 |
|
} |
| 841 |
|
|
| 842 |
|
/** |
| 843 |
|
* To add a complex property to entity or complex type. |