Skip to content

Commit

Permalink
Removing strict check on id properties
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Oct 2, 2015
1 parent e52a4b2 commit 0cdb9e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
9 changes: 1 addition & 8 deletions src/Mapping/MappingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,12 @@ private static function getSelfUrl(array &$mappedClass)
/**
* @param array $mappedClass
*
* @throws MappingException
*
* @return mixed
*/
private static function getIdProperties(array &$mappedClass)
{
if (empty($mappedClass['id_properties'])) {
throw new MappingException(
'Could not find "id_properties" property with data . This is required in order to make the resource to be reachable.'
);
}

return $mappedClass['id_properties'];
return (!empty($mappedClass['id_properties']))? $mappedClass['id_properties'] : [];
}

/**
Expand Down
6 changes: 0 additions & 6 deletions tests/Mapping/MappingFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ public function testItWillThrowExceptionIfArrayHasNoClassKey()
MappingFactory::fromArray($mappedClass);
}

public function testItWillThrowExceptionIfArrayHasNoIdPropertiesKey()
{
$this->setExpectedException(MappingException::class);
$mappedClass = ['class' => 'Post', 'id_properties' => [], 'urls' => ['self' => 'some/url']];
MappingFactory::fromArray($mappedClass);
}

public function testItWillThrowExceptionIfArrayHasNoSelfUrlKey()
{
Expand Down

0 comments on commit 0cdb9e1

Please sign in to comment.