/** * Populate the given data object * * @param t41_Data_Object $do data object instance * @return boolean */ public function read(t41_Data_Object $do) { $subDn = $this->_mapper ? $this->_mapper->getDatastore($do->getClass()) : null; // get data from backend try { if (!$this->_ressource) { $this->_connect($subDn); } //$data = $this->_ressource->getEntry($do->getUri()->getIdentifier()); $data = $this->_ressource->search('(objectClass=*)', $do->getUri()->getIdentifier()); } catch (Exception $e) { throw new Exception($e->getMessage); } if (empty($data)) { return false; } // Normalize array before mapping // Almost each record in a LDAP result array is an array $data = $this->_flattenArray($data); $do->populate($data, $this->_mapper); return true; }
/** * * Populate the object data object with given array and optional mapper * @param array $data * @param t41_Backend_Mapper $mapper */ public function setData(array $data, Backend\Mapper $mapper = null) { $this->_dataObject->populate($data, $mapper); }