NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Code Completion for static functions


Joined: 17 Nov 2008
Posts: 4
Reply with quote
Mostly I make use of the MVC principle with static Mappers to connect the database rows to te models. By example:

Code:

/**
      * Find the requested user by its username
      *
      * @todo handle no results   
      *
      * @param mixed $sUserName
      * @return Employees_Model
      */
      public static function findByUserName( $sUserName ) {
          if( isset( $sUserName ) ) {
            $oDBH = new DataController();   
           
            $stmt = $oDBH->prepare('SELECT * FROM Employees WHERE sUserName = :username');
            $stmt->bindParam('username', $sUserName, PDO::PARAM_STR);
            $stmt->execute();

            $aData = $stmt->fetch();

            $oModel = new Employees_Model();
            $oModel->setModel($aData);

            return $oModel;
          } else {
              throw new InvalidArgumentException('Given parameter is empty');
          }
      }


When I call this function like this:

$oUser = Employees_Mapper::findByUserName(Request::sessionParam('userName'));
and try to auto complete $oUser-> only an error pops up saying:


'failed to identify the type of $oUser'

What is the problem? The phpdoc generator does work perfect and can figure out what the return statement holds.[/code]
View user's profileFind all posts by pderaaijSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
Your sample works fine for me:




Make sure that Employees_Model class is listed in the Code Explorer

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 17 Nov 2008
Posts: 4
Reply with quote
dmitri, The models are in the code explorer, but still it doesn't work
View user's profileFind all posts by pderaaijSend private message


Joined: 17 Nov 2008
Posts: 4
Reply with quote
Now I've installed the latest version it works suddenly. I worked with the version two build ago, so it is a bit weird.
View user's profileFind all posts by pderaaijSend private message
Code Completion for static functions
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
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic