diff --git a/library/Class/Profil.php b/library/Class/Profil.php index b7a70f12ddee73c5bd696a5e7a48bf9cf20f1c82..2ae541c25016cb69884f9a52766b49f4302f5142 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -86,7 +86,7 @@ class Class_Profil extends Storm_Model_Abstract { protected static $DEFAULT_VALUES, $CFG_SITE_KEYS, $FORWARDED_ATTRIBUTES; // cache des attributs pour raison de performances - protected $_has_parent_profil; + protected $_has_parent_profil = null; protected $_cfg_site_array; protected $_should_forward_attributes = []; @@ -306,7 +306,7 @@ class Class_Profil extends Storm_Model_Abstract { * @return bool */ public function hasParentProfil() { - if (!isset($this->_has_parent_profil)) + if (null === $this->_has_parent_profil) $this->_has_parent_profil = (null != $this->_get('parent_profil')); return $this->_has_parent_profil; } @@ -1427,7 +1427,7 @@ class Class_Profil extends Storm_Model_Abstract { $this->_copyMenuForMigrationTo($new_parent); parent::_set('parent_profil', $new_parent); - unset($this->_has_parent_profil); + $this->_has_parent_profil = null; $this->_should_forward_attributes = []; if ($this->hasParentProfil()) @@ -1439,13 +1439,13 @@ class Class_Profil extends Storm_Model_Abstract { public function beforeSave() { - unset($this->_has_parent_profil); + $this->_has_parent_profil = null; $this->_should_forward_attributes = []; } public function afterSave() { - unset($this->_has_parent_profil); + $this->_has_parent_profil = null; $this->_should_forward_attributes = []; } diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php index a3c9c974e07876f20e77002bba346ecba1feed80..57a4582937b9213a05a2d592818fa4a2acef8b4b 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -476,7 +476,10 @@ class Admin_ProfilControllerNewPageTest extends Admin_ProfilControllerProfilJeun } - + /** @test */ + public function attributesShouldNotContainsHasParentProfil() { + $this->assertNotContains('_has_parent_profil', $this->new_page->getRawAttributes()); + } }