Disable MVC model warnings in phpStorm

In CakePHP in my controller classes i declare models like this:
public $uses = array('Mydata');

But when i use this:
$r = $this->Userdata->find('all', $params);

phpStorm gives warnings:
Field 'Userdata' not found in class AppController

When I add this warnings for class name disappears:

//    /**
//     * Userdata
//     * @var Userdata
//     */
    var $Userdata;

But now, when I try to go to declaration of "Userdata" class, IDE can't find the class which is in the one of the folders of project.

Also IDE gives warnings for **find** method. But **find** is a function in base class of Userdata class.

How can i disable this warning without suppressing all warnings.
Thank you

4 comments
Comment actions Permalink

Hi ben,

In your class, declare it via @propery tag of PHPDoc comment block

/**
* @property Userdata $Userdata
*/
class MyClass extends AppController_OR_WhateverClassThatIs {
...


P.S.
Somehow related -- http://devnet.jetbrains.net/thread/435925

0
Comment actions Permalink

@Andriy thank you.
That helps for class name warnings but method warnings still remain.
$r = $this->Userdata->find('all', $params) ;

Do I miss something?


I added this:

    class AppController extends Controller {

     /**
     * @property Userdata $Userdata
     */
    var $Userdata;

     ....
     ....
     ....
$r = $this->Userdata->find('all', $params) ;
     ....

}


Structure is like this:

class Userdata extends AppModel {
...
}

class AppModel extends Model {
}


class Model  {

          public function find($type = 'first', $query = array()) {
      }
}

0
Comment actions Permalink

See my last comment (point #1) in related thread -- backup your project first and try renaming core class Object to something else (e.g. ObjectCakePHP or whatever).

If the above will not help -- please provide some sample project (all files must be included) where the issue appears for your (so I can try reproducing/digging into it here).

0

Please sign in to leave a comment.