/** * fetch one contact of a user identified by his user_id * * @param int $_userId * @return Addressbook_Model_Contact * @throws Addressbook_Exception_NotFound if contact not found */ public function getByUserId($_userId) { $userId = Tinebase_Model_User::convertUserIdToInt($_userId); $contactData = $this->_ldap->fetch($this->_baseDn, "uidnumber={$userId}", $this->_getSupportedLdapAttributes()); if (!$contactData) { throw new Addressbook_Exception_NotFound("Contact with user id {$_userId} not found."); } $contact = $this->_ldap2Contacts(array($contactData))->offsetGet(0); $contact->jpegphoto = $this->_ldap->fetchBinaryAttribute($this->_baseDn, "uidnumber={$userId}", 'jpegphoto'); return $contact; }