/**
  * @inheritdoc
  */
 public function getIdentifiers()
 {
     if (!$this->isHasMany()) {
         throw new RuntimeException('No data member of data member is not a valid has-many relationship.');
     }
     return ResourceIdentifierCollection::create($this->get(self::DATA));
 }
 public function testHasMany()
 {
     $input = new stdClass();
     $input->{Relationship::DATA} = $this->hasMany;
     $object = new Relationship($input);
     $expected = ResourceIdentifierCollection::create($this->hasMany);
     $this->assertEquals($expected, $object->getData());
     $this->assertTrue($object->isHasMany());
     $this->assertFalse($object->isHasOne());
 }
 /**
  * @depends testMap
  */
 public function testMapWithTypeConversion(ResourceIdentifierCollection $collection)
 {
     $a = 'Alias-A';
     $b = 'Alias-B';
     $map = [$this->a->getType() => $a, $this->b->getType() => $b];
     $expected = [$a => [$this->a->getId()], $b => [$this->b->getId()]];
     $this->assertEquals($expected, $collection->map($map));
 }
 /**
  * @inheritDoc
  */
 public function getIdentifiers()
 {
     $collection = new ResourceIdentifierCollection();
     /** @var ResourceInterface $resource */
     foreach ($this as $resource) {
         $collection->add($resource->getIdentifier());
     }
     return $collection;
 }