/
Handler.php
711 lines (643 loc) · 24.8 KB
/
Handler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
<?php
/**
* File containing the Content Handler class
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version 2014.07.0
*/
namespace eZ\Publish\Core\Persistence\Legacy\Content;
use eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway;
use eZ\Publish\SPI\Persistence\Content\Handler as BaseContentHandler;
use eZ\Publish\SPI\Persistence\Content\Type\Handler as ContentTypeHandler;
use eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter;
use eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway as UrlAliasGateway;
use eZ\Publish\SPI\Persistence\Content;
use eZ\Publish\SPI\Persistence\Content\CreateStruct;
use eZ\Publish\SPI\Persistence\Content\UpdateStruct;
use eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct;
use eZ\Publish\SPI\Persistence\Content\VersionInfo;
use eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct as RelationCreateStruct;
use eZ\Publish\Core\Base\Exceptions\NotFoundException as NotFound;
/**
* The Content Handler stores Content and ContentType objects.
*/
class Handler implements BaseContentHandler
{
/**
* Content gateway.
*
* @var \eZ\Publish\Core\Persistence\Legacy\Content\Gateway
*/
protected $contentGateway;
/**
* Location gateway.
*
* @var \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway
*/
protected $locationGateway;
/**
* Mapper.
*
* @var Mapper
*/
protected $mapper;
/**
* FieldHandler
*
* @var \eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler
*/
protected $fieldHandler;
/**
* URL slug converter.
*
* @var \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter
*/
protected $slugConverter;
/**
* UrlAlias gateway
*
* @var \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway
*/
protected $urlAliasGateway;
/**
* ContentType handler
*
* @var \eZ\Publish\SPI\Persistence\Content\Type\Handler
*/
protected $contentTypeHandler;
/**
* Tree handler
*
* @var \eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler
*/
protected $treeHandler;
/**
* Creates a new content handler.
*
* @param \eZ\Publish\Core\Persistence\Legacy\Content\Gateway $contentGateway
* @param \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway $locationGateway
* @param \eZ\Publish\Core\Persistence\Legacy\Content\Mapper $mapper
* @param \eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler $fieldHandler
* @param \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter $slugConverter
* @param \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway $urlAliasGateway
* @param \eZ\Publish\SPI\Persistence\Content\Type\Handler $contentTypeHandler
* @param \eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler $treeHandler
*/
public function __construct(
Gateway $contentGateway,
LocationGateway $locationGateway,
Mapper $mapper,
FieldHandler $fieldHandler,
SlugConverter $slugConverter,
UrlAliasGateway $urlAliasGateway,
ContentTypeHandler $contentTypeHandler,
TreeHandler $treeHandler
)
{
$this->contentGateway = $contentGateway;
$this->locationGateway = $locationGateway;
$this->mapper = $mapper;
$this->fieldHandler = $fieldHandler;
$this->slugConverter = $slugConverter;
$this->urlAliasGateway = $urlAliasGateway;
$this->contentTypeHandler = $contentTypeHandler;
$this->treeHandler = $treeHandler;
}
/**
* Creates a new Content entity in the storage engine.
*
* The values contained inside the $content will form the basis of stored
* entity.
*
* Will contain always a complete list of fields.
*
* @param \eZ\Publish\SPI\Persistence\Content\CreateStruct $struct Content creation struct.
*
* @return \eZ\Publish\SPI\Persistence\Content Content value object
*/
public function create( CreateStruct $struct )
{
return $this->internalCreate( $struct );
}
/**
* Creates a new Content entity in the storage engine.
*
* The values contained inside the $content will form the basis of stored
* entity.
*
* Will contain always a complete list of fields.
*
* @param \eZ\Publish\SPI\Persistence\Content\CreateStruct $struct Content creation struct.
* @param mixed $versionNo Used by self::copy() to maintain version numbers
*
* @return \eZ\Publish\SPI\Persistence\Content Content value object
*/
protected function internalCreate( CreateStruct $struct, $versionNo = 1 )
{
$content = new Content();
$content->fields = $struct->fields;
$content->versionInfo = $this->mapper->createVersionInfoFromCreateStruct( $struct, $versionNo );
$content->versionInfo->contentInfo->id = $this->contentGateway->insertContentObject( $struct, $versionNo );
$content->versionInfo->id = $this->contentGateway->insertVersion(
$content->versionInfo,
$struct->fields
);
$contentType = $this->contentTypeHandler->load( $struct->typeId );
$this->fieldHandler->createNewFields( $content, $contentType );
// Create node assignments
foreach ( $struct->locations as $location )
{
$location->contentId = $content->versionInfo->contentInfo->id;
$location->contentVersion = $content->versionInfo->versionNo;
$this->locationGateway->createNodeAssignment(
$location,
$location->parentId,
LocationGateway::NODE_ASSIGNMENT_OP_CODE_CREATE
);
}
// Create names
foreach ( $content->versionInfo->names as $language => $name )
{
$this->contentGateway->setName(
$content->versionInfo->contentInfo->id,
$content->versionInfo->versionNo,
$name,
$language
);
}
return $content;
}
/**
* Performs the publishing operations required to set the version identified by $updateStruct->versionNo and
* $updateStruct->id as the published one.
*
* The publish procedure will:
* - Create location nodes based on the node assignments
* - Update the content object using the provided metadata update struct
* - Update the node assignments
* - Update location nodes of the content with the new published version
* - Set content and version status to published
*
* @param int $contentId
* @param int $versionNo
* @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $metaDataUpdateStruct
*
* @return \eZ\Publish\SPI\Persistence\Content The published Content
*/
public function publish( $contentId, $versionNo, MetadataUpdateStruct $metaDataUpdateStruct )
{
// Archive currently published version
$versionInfo = $this->loadVersionInfo( $contentId, $versionNo );
if ( $versionInfo->contentInfo->currentVersionNo != $versionNo )
{
$this->setStatus(
$contentId,
VersionInfo::STATUS_ARCHIVED,
$versionInfo->contentInfo->currentVersionNo
);
}
// Set always available name for the content
$metaDataUpdateStruct->name = $versionInfo->names[$versionInfo->contentInfo->mainLanguageCode];
$this->contentGateway->updateContent( $contentId, $metaDataUpdateStruct, $versionInfo );
$this->locationGateway->createLocationsFromNodeAssignments(
$contentId,
$versionNo
);
$this->locationGateway->updateLocationsContentVersionNo( $contentId, $versionNo );
$this->setStatus( $contentId, VersionInfo::STATUS_PUBLISHED, $versionNo );
return $this->load( $contentId, $versionNo );
}
/**
* Creates a new draft version from $contentId in $version.
*
* Copies all fields from $contentId in $srcVersion and creates a new
* version of the referred Content from it.
*
* Note: When creating a new draft in the old admin interface there will
* also be an entry in the `eznode_assignment` created for the draft. This
* is ignored in this implementation.
*
* @param mixed $contentId
* @param mixed $srcVersion
* @param mixed $userId
*
* @return \eZ\Publish\SPI\Persistence\Content
*/
public function createDraftFromVersion( $contentId, $srcVersion, $userId )
{
$content = $this->load( $contentId, $srcVersion );
// Create new version
$content->versionInfo = $this->mapper->createVersionInfoForContent(
$content,
$this->contentGateway->getLastVersionNumber( $contentId ) + 1,
$userId
);
$content->versionInfo->id = $this->contentGateway->insertVersion(
$content->versionInfo,
$content->fields
);
// Clone fields from previous version and append them to the new one
$this->fieldHandler->createExistingFieldsInNewVersion( $content );
// Create relations for new version
$relations = $this->contentGateway->loadRelations( $contentId, $srcVersion );
foreach ( $relations as $relation )
{
$this->contentGateway->insertRelation(
new RelationCreateStruct(
array(
"sourceContentId" => $contentId,
"sourceContentVersionNo" => $content->versionInfo->versionNo,
"sourceFieldDefinitionId" => $relation["ezcontentobject_link_contentclassattribute_id"],
"destinationContentId" => $relation["ezcontentobject_link_to_contentobject_id"],
"type" => (int)$relation["ezcontentobject_link_relation_type"],
)
)
);
}
// Create content names for new version
foreach ( $content->versionInfo->names as $language => $name )
{
$this->contentGateway->setName(
$contentId,
$content->versionInfo->versionNo,
$name,
$language
);
}
return $content;
}
/**
* Returns the raw data of a content object identified by $id, in a struct.
*
* A version to load must be specified. If you want to load the current
* version of a content object use SearchHandler::findSingle() with the
* ContentId criterion.
*
* Optionally a translation filter may be specified. If specified only the
* translations with the listed language codes will be retrieved. If not,
* all translations will be retrieved.
*
* @param int|string $id
* @param int|string $version
* @param string[] $translations
*
* @return \eZ\Publish\SPI\Persistence\Content Content value object
*/
public function load( $id, $version, array $translations = null )
{
$rows = $this->contentGateway->load( $id, $version, $translations );
if ( empty( $rows ) )
{
throw new NotFound( 'content', "contentId: $id, versionNo: $version" );
}
$contentObjects = $this->mapper->extractContentFromRows( $rows );
$content = $contentObjects[0];
$this->fieldHandler->loadExternalFieldData( $content );
return $content;
}
/**
* Returns the metadata object for a content identified by $contentId.
*
* @param int|string $contentId
*
* @return \eZ\Publish\SPI\Persistence\Content\ContentInfo
*/
public function loadContentInfo( $contentId )
{
return $this->treeHandler->loadContentInfo( $contentId );
}
/**
* Returns the metadata object for a content identified by $remoteId.
*
* @param mixed $remoteId
*
* @return \eZ\Publish\SPI\Persistence\Content\ContentInfo
*/
public function loadContentInfoByRemoteId( $remoteId )
{
return $this->mapper->extractContentInfoFromRow(
$this->contentGateway->loadContentInfoByRemoteId( $remoteId )
);
}
/**
* Returns the version object for a content/version identified by $contentId and $versionNo
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If version is not found
*
* @param int|string $contentId
* @param int $versionNo Version number to load
*
* @return \eZ\Publish\SPI\Persistence\Content\VersionInfo
*/
public function loadVersionInfo( $contentId, $versionNo )
{
$rows = $this->contentGateway->loadVersionInfo( $contentId, $versionNo );
if ( empty( $rows ) )
{
throw new NotFound( 'content', $contentId );
}
$versionInfo = $this->mapper->extractVersionInfoListFromRows( $rows );
return reset( $versionInfo );
}
/**
* Returns all versions with draft status created by the given $userId
*
* @param int $userId
*
* @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
*/
public function loadDraftsForUser( $userId )
{
return $this->mapper->extractVersionInfoListFromRows(
$this->contentGateway->listVersionsForUser( $userId, VersionInfo::STATUS_DRAFT )
);
}
/**
* Sets the status of object identified by $contentId and $version to $status.
*
* The $status can be one of VersionInfo::STATUS_DRAFT, VersionInfo::STATUS_PUBLISHED, VersionInfo::STATUS_ARCHIVED
* When status is set to VersionInfo::STATUS_PUBLISHED content status is updated to ContentInfo::STATUS_PUBLISHED
*
* @param int $contentId
* @param int $status
* @param int $version
*
* @return boolean
*/
public function setStatus( $contentId, $status, $version )
{
return $this->contentGateway->setStatus( $contentId, $version, $status );
}
/**
* Updates a content object meta data, identified by $contentId.
*
* @param int $contentId
* @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $content
*
* @return \eZ\Publish\SPI\Persistence\Content\ContentInfo
*/
public function updateMetadata( $contentId, MetadataUpdateStruct $content )
{
$this->contentGateway->updateContent( $contentId, $content );
$this->updatePathIdentificationString( $contentId, $content );
return $this->loadContentInfo( $contentId );
}
/**
* Updates path identification string for locations of given $contentId if main language
* is set in update struct.
*
* This is specific to the Legacy storage engine, as path identification string is deprecated.
*
* @param int $contentId
* @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $content
*
* @return void
*/
protected function updatePathIdentificationString( $contentId, MetadataUpdateStruct $content )
{
if ( isset( $content->mainLanguageId ) )
{
$contentLocationsRows = $this->locationGateway->loadLocationDataByContent( $contentId );
foreach ( $contentLocationsRows as $row )
{
$locationName = "";
$urlAliasRows = $this->urlAliasGateway->loadLocationEntries(
$row["node_id"],
false,
$content->mainLanguageId
);
if ( !empty( $urlAliasRows ) )
{
$locationName = $urlAliasRows[0]["text"];
}
$this->locationGateway->updatePathIdentificationString(
$row["node_id"],
$row["parent_node_id"],
$this->slugConverter->convert(
$locationName,
"node_" . $row["node_id"],
"urlalias_compat"
)
);
}
}
}
/**
* Updates a content version, identified by $contentId and $versionNo
*
* @param int $contentId
* @param int $versionNo
* @param \eZ\Publish\SPI\Persistence\Content\UpdateStruct $updateStruct
*
* @return \eZ\Publish\SPI\Persistence\Content
*/
public function updateContent( $contentId, $versionNo, UpdateStruct $updateStruct )
{
$content = $this->load( $contentId, $versionNo );
$this->contentGateway->updateVersion( $contentId, $versionNo, $updateStruct );
$contentType = $this->contentTypeHandler->load( $content->versionInfo->contentInfo->contentTypeId );
$this->fieldHandler->updateFields( $content, $updateStruct, $contentType );
foreach ( $updateStruct->name as $language => $name )
{
$this->contentGateway->setName(
$contentId,
$versionNo,
$name,
$language
);
}
return $this->load( $contentId, $versionNo );
}
/**
* Deletes all versions and fields, all locations (subtree), and all relations.
*
* Removes the relations, but not the related objects. All subtrees of the
* assigned nodes of this content objects are removed (recursively).
*
* @param int $contentId
*
* @return boolean
*/
public function deleteContent( $contentId )
{
$contentLocations = $this->contentGateway->getAllLocationIds( $contentId );
if ( empty( $contentLocations ) )
{
$this->removeRawContent( $contentId );
}
else
{
foreach ( $contentLocations as $locationId )
{
$this->treeHandler->removeSubtree( $locationId );
}
}
}
/**
* Deletes raw content data
*
* @param int $contentId
*/
public function removeRawContent( $contentId )
{
$this->treeHandler->removeRawContent( $contentId );
}
/**
* Deletes given version, its fields, node assignment, relations and names.
*
* Removes the relations, but not the related objects.
*
* @param int $contentId
* @param int $versionNo
*
* @return boolean
*/
public function deleteVersion( $contentId, $versionNo )
{
$versionInfo = $this->loadVersionInfo( $contentId, $versionNo );
$this->locationGateway->deleteNodeAssignment( $contentId, $versionNo );
$this->fieldHandler->deleteFields( $contentId, $versionInfo );
$this->contentGateway->deleteRelations( $contentId, $versionNo );
$this->contentGateway->deleteVersions( $contentId, $versionNo );
$this->contentGateway->deleteNames( $contentId, $versionNo );
}
/**
* Returns the versions for $contentId
*
* @param int $contentId
*
* @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
*/
public function listVersions( $contentId )
{
return $this->treeHandler->listVersions( $contentId );
}
/**
* Copy Content with Fields and Versions from $contentId in $version.
*
* Copies all fields from $contentId in $versionNo (or all versions if null)
* to a new object which is returned. Version numbers are maintained.
*
* @todo Should relations be copied? Which ones?
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If content or version is not found
*
* @param mixed $contentId
* @param mixed|null $versionNo Copy all versions if left null
*
* @return \eZ\Publish\SPI\Persistence\Content
*/
public function copy( $contentId, $versionNo = null )
{
$currentVersionNo = isset( $versionNo ) ?
$versionNo :
$this->loadContentInfo( $contentId )->currentVersionNo;
// Copy content in given version or current version
$createStruct = $this->mapper->createCreateStructFromContent(
$this->load( $contentId, $currentVersionNo )
);
$content = $this->internalCreate( $createStruct, $currentVersionNo );
$contentType = $this->contentTypeHandler->load( $createStruct->typeId );
// If version was not passed also copy other versions
if ( !isset( $versionNo ) )
{
foreach ( $this->listVersions( $contentId ) as $versionInfo )
{
if ( $versionInfo->versionNo === $currentVersionNo )
{
continue;
}
$versionContent = $this->load( $contentId, $versionInfo->versionNo );
$versionContent->versionInfo->contentInfo->id = $content->versionInfo->contentInfo->id;
$versionContent->versionInfo->modificationDate = $createStruct->modified;
$versionContent->versionInfo->creationDate = $createStruct->modified;
$versionContent->versionInfo->id = $this->contentGateway->insertVersion(
$versionContent->versionInfo,
$versionContent->fields
);
$this->fieldHandler->createNewFields( $versionContent, $contentType );
// Create names
foreach ( $versionContent->versionInfo->names as $language => $name )
{
$this->contentGateway->setName(
$content->versionInfo->contentInfo->id,
$versionInfo->versionNo,
$name,
$language
);
}
}
}
return $content;
}
/**
* Creates a relation between $sourceContentId in $sourceContentVersionNo
* and $destinationContentId with a specific $type.
*
* @todo Should the existence verifications happen here or is this supposed to be handled at a higher level?
*
* @param \eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct
*
* @return \eZ\Publish\SPI\Persistence\Content\Relation
*/
public function addRelation( RelationCreateStruct $createStruct )
{
$relation = $this->mapper->createRelationFromCreateStruct( $createStruct );
$relation->id = $this->contentGateway->insertRelation( $createStruct );
return $relation;
}
/**
* Removes a relation by relation Id.
*
* @todo Should the existence verifications happen here or is this supposed to be handled at a higher level?
*
* @param mixed $relationId
* @param int $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
* \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
* \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
* \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
*
* @return void
*/
public function removeRelation( $relationId, $type )
{
$this->contentGateway->deleteRelation( $relationId, $type );
}
/**
* Loads relations from $sourceContentId. Optionally, loads only those with $type and $sourceContentVersionNo.
*
* @param mixed $sourceContentId Source Content ID
* @param mixed|null $sourceContentVersionNo Source Content Version, null if not specified
* @param int|null $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
* \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
* \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
* \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
*
* @return \eZ\Publish\SPI\Persistence\Content\Relation[]
*/
public function loadRelations( $sourceContentId, $sourceContentVersionNo = null, $type = null )
{
return $this->mapper->extractRelationsFromRows(
$this->contentGateway->loadRelations( $sourceContentId, $sourceContentVersionNo, $type )
);
}
/**
* Loads relations from $contentId. Optionally, loads only those with $type.
*
* Only loads relations against published versions.
*
* @param mixed $destinationContentId Destination Content ID
* @param int|null $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
* \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
* \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
* \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
* @return \eZ\Publish\SPI\Persistence\Content\Relation[]
*/
public function loadReverseRelations( $destinationContentId, $type = null )
{
return $this->mapper->extractRelationsFromRows(
$this->contentGateway->loadReverseRelations( $destinationContentId, $type )
);
}
}