FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Singleton & Autocomplete

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
Shu



Joined: 07 Jul 2009
Posts: 2

PostPosted: Tue Jul 07, 2009 8:32 am    Post subject: Singleton & Autocomplete Reply with quote

Hello,
I usually use a Singleton class Database but self-complete seems buggy
Are there plans to fix it? Is there a solution?

example :
Code:

class Database {
    static $instance;

    private function __construct() {
        ...
    }

    public static function getInstance() {
        if (!isset(self::$instance)) {
            self::$instance = new Database;
        }
        return self::$instance;
    }

    public function select() {
        ...
    }
}
$db = Database::getInstance();
$db->[ctrl-space => no result]
Back to top
View user's profile Send private message
Tomas Mysik
Posted via mailing list.





PostPosted: Tue Jul 07, 2009 9:32 am    Post subject: Singleton & Autocomplete Reply with quote

Hi,

Dne úterý 07 července 2009 10:32:09 Shu napsal(a):
Quote:
I usually use a Singleton class Database but self-complete seems buggy
Are there plans to fix it? Is there a solution?
example :


Code:


class Database {

static $instance;



private function __construct() {

...

}



public static function getInstance() {

if (!isset(self::$instance)) {

self::$instance = new Database;

}

return self::$instance;

}



public function select() {

...

}

}

$db = Database::getInstance();

$db->[ctrl-space => no result]

you are missing PHPDoc tags for your class (NetBeans uses them for code
completion).

Tomas
[1] http://manual.phpdoc.org/
--
Tomas Mysik
address-removed
Back to top
Shu



Joined: 07 Jul 2009
Posts: 2

PostPosted: Tue Jul 07, 2009 9:48 am    Post subject: Re: Singleton & Autocomplete Reply with quote

Tomas Mysik wrote:

you are missing PHPDoc tags for your class (NetBeans uses them for code
completion).


Code:
   
/**
* @static
* @return Database
*/
public static function GetInstance() {
    if (!isset(self::$instance)) {
        self::$instance = new Database;
    }
    return self::$instance;
}

Work like a charm Laughing
Ty for this cool IDE and your fast support Razz
Back to top
View user's profile Send private message
Tomas Mysik
Posted via mailing list.





PostPosted: Tue Jul 07, 2009 10:56 am    Post subject: Singleton & Autocomplete Reply with quote

Hi,

Dne úterý 07 července 2009 11:49:07 Shu napsal(a):
Quote:
Work like a charm [Laughing]

great to hear!

Quote:
Ty for this cool IDE and your fast support Razz

You're welcome.

Tomas
--
Tomas Mysik
address-removed
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB