diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php index 8766c78e37c678c12ad8af10b41a38b3c8ae03f5..76442fb3f55ae80c4cf38d495dcfa559aef71f8d 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php @@ -409,4 +409,10 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo public function xmlBaliseAbonneShouldBeSubscribers() { $this->assertEquals('subscribers', Class_IntProfilDonnees::find(56)->getXmlBaliseAbonne()); } + + + /** @test */ + public function xmlAbonneIdShouldBeId() { + $this->assertEquals('id', Class_IntProfilDonnees::find(56)->getXmlAbonneId()); + } } \ No newline at end of file diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index 2cb2c7ad4859e3e9ec1f515f25daeadf15b4701e..9611876969a32cc81cda54dbbd90056fe1117ced 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -170,7 +170,8 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { NOVELTY_FORMAT = 'format', NOVELTY_VALEURS = 'valeurs', XML_SUBSCRIBER_FIELD = 'xml_balise_abonne', - XML_SUBSCRIBER_FIELDS = 'xml_champs_abonne'; + XML_SUBSCRIBER_FIELDS = 'xml_champs_abonne', + XML_IDABON = 'IDABON'; protected $_table_name = 'profil_donnees', @@ -711,6 +712,11 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { } + public function getXmlAbonneId() { + return $this->getProfilePrefs()->getSubscriberXmlFieldValue(Class_IntProfilDonnees::XML_IDABON); + } + + public function getProfilePrefs() { if(!$this->_profile_prefs) $this->_profile_prefs = (new Class_ProfilePrefs())->setDatas($this->toArray()); diff --git a/library/Class/ProfileSerializer.php b/library/Class/ProfileSerializer.php index a889e40035038e591abb6ae54ce8fe5a62ebfe39..f517ea462e6330fdfe26c7c50bfccce8998b28d5 100644 --- a/library/Class/ProfileSerializer.php +++ b/library/Class/ProfileSerializer.php @@ -21,6 +21,7 @@ class Class_ProfileSerializer { + const XML_PREFIX = 'xml_abonne_'; protected $_datas; @@ -76,7 +77,7 @@ class Class_ProfileSerializer { public function extractSubscribers() { return [Class_IntProfilDonnees::XML_SUBSCRIBER_FIELD => $this->extractXmlSubscriber(), - $this->extractSubscriberFields()]; + Class_IntProfilDonnees::XML_SUBSCRIBER_FIELDS => $this->extractSubscriberFields()]; } @@ -101,7 +102,7 @@ class Class_ProfileSerializer { public function extractSubscriberFields() { - + return [Class_IntProfilDonnees::XML_IDABON => $this->_datas[static::XML_PREFIX . Class_IntProfilDonnees::XML_IDABON]]; } } ?> \ No newline at end of file