1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

Worker $relatedCollection

This commit is contained in:
fogelito 2023-03-13 11:46:03 +02:00
parent 5fc3f5bc3a
commit f5f51c4fc9
2 changed files with 3 additions and 3 deletions

View file

@ -99,7 +99,6 @@ function createAttribute(string $databaseId, string $collectionId, Document $att
if ($type === Database::VAR_RELATIONSHIP) {
$relatedCollection = $dbForProject->getDocument('database_' . $db->getInternalId(), $options['relatedCollectionId']);
$options['relatedCollectionInternalId'] = $relatedCollection->getInternalId();
if ($relatedCollection->isEmpty()) {
throw new Exception(Exception::COLLECTION_NOT_FOUND);
}

View file

@ -95,10 +95,11 @@ class DatabaseV1 extends Worker
try {
if ($type === Database::VAR_RELATIONSHIP) {
$relatedCollection = $dbForProject->getDocument('database_' . $database->getInternalId(), $options['relatedCollectionId']);
if (
!$dbForProject->createRelationship(
collection: 'make',
relatedCollection: 'model',
collection: 'database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(),
relatedCollection: 'database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId(),
type: $options['type'],
twoWay: $options['twoWay'],
id: $options['id'],