- LSldapObject :: updateRelationsCache()

-> Utilisation d'un nouvel objet pour faire le cache plutot que $this. Cela
		 posait des problèmes dans la mise à jour de relation sinon
This commit is contained in:
Benjamin Renard 2008-10-09 10:19:07 +00:00
parent 0e84f7d284
commit ff1a020630

View file

@ -1036,15 +1036,18 @@ class LSldapObject {
function updateRelationsCache() { function updateRelationsCache() {
$this -> _relationsCache=array(); $this -> _relationsCache=array();
if (is_array($this->config['relations'])) { if (is_array($this->config['relations'])) {
$type = $this -> getType();
$me = new $type();
$me -> loadData($this -> getDn());
foreach($this->config['relations'] as $relation_name => $relation_conf) { foreach($this->config['relations'] as $relation_name => $relation_conf) {
if ( isset($relation_conf['list_function']) ) { if ( isset($relation_conf['list_function']) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) { if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) {
$obj = new $relation_conf['LSobject'](); $obj = new $relation_conf['LSobject']();
if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) { if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) {
$list = $obj -> $relation_conf['list_function']($this); $list = $obj -> $relation_conf['list_function']($me);
if (is_array($list)) { if (is_array($list)) {
// Key Value // Key Value
$key = $obj -> $relation_conf['getkeyvalue_function']($this); $key = $obj -> $relation_conf['getkeyvalue_function']($me);
$this -> _relationsCache[$relation_name] = array( $this -> _relationsCache[$relation_name] = array(
'list' => $list, 'list' => $list,