Example #1
0
 public function testExecute()
 {
     $entityType = 'Type';
     $entity = new \stdClass();
     $action = $this->getMockBuilder(\stdClass::class)->disableOriginalConstructor()->setMethods(['execute'])->getMock();
     $this->relationActionPoolMock->expects($this->once())->method('getActions')->with($entityType, 'read')->willReturn([$action]);
     $action->expects($this->once())->method('execute')->with($entityType, $entity)->willReturn($entity);
     $this->assertEquals($entity, $this->readRelation->execute($entityType, $entity));
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function execute($entityType, $entity, $identifier)
 {
     $metadata = $this->metadataPool->getMetadata($entityType);
     $entity = $this->readMain->execute($entityType, $entity, $identifier);
     if (isset($entity[$metadata->getLinkField()])) {
         $entity = $this->readExtension->execute($entityType, $entity);
         $entity = $this->readRelation->execute($entityType, $entity);
     }
     return $entity;
 }