Skip to content
Snippets Groups Projects
Commit a3526169 authored by pbarroca's avatar pbarroca
Browse files

FRBR : Correction d'un cas ou il est possible de charger une notice si sa clé alpha est vide

parent 7e744959
Branches
Tags
No related merge requests found
......@@ -144,16 +144,19 @@ class Class_FRBR_Link extends Storm_Model_Abstract {
return;
$attribute = '_' . $type .'_entity';
if (!$this->$attribute) {
if ($this->$attribute)
return $this->$attribute;
try {
$key = $this->_extractKeyFromUrl($this->{'get'. ucfirst($type)}());
} catch(Zend_Uri_Exception $e) {
return $this->$attribute = null;
}
$this->$attribute = Class_Notice::getLoader()->getNoticeByClefAlpha($key);
try {
$key = $this->_extractKeyFromUrl($this->{'get'. ucfirst($type)}());
} catch(Zend_Uri_Exception $e) {
return;
}
if (!$key)
return;
$this->$attribute = Class_Notice::getLoader()->getNoticeByClefAlpha($key);
return $this->$attribute;
}
......
......@@ -22,7 +22,7 @@
class FRBR_LinkWrongAttributesTest extends Storm_Test_ModelTestCase {
public function setUp() {
parent::setUp();
$this->link = Class_FRBR_Link::newInstanceWithId(34)
->setSource('zork')
->setTarget('http://localhost/notice/view/clef/TINTIN')
......@@ -44,7 +44,7 @@ class FRBR_LinkWrongAttributesTest extends Storm_Test_ModelTestCase {
/** @test */
public function getTargetNoticeShouldReturnNullWithInvalidType() {
$this->assertEquals(null, $this->link->getTargetNotice());
$this->assertEquals(null, $this->link->getTargetNotice());
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment