Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctrine findBy()/findOneBy() in repository fails as incorrect #898

Open
viktorasp opened this issue Mar 21, 2017 · 3 comments
Open

Doctrine findBy()/findOneBy() in repository fails as incorrect #898

viktorasp opened this issue Mar 21, 2017 · 3 comments

Comments

@viktorasp
Copy link

Phpstorm version: 2016.3.3
Plugin version: 0.13.138

Considering Account entity and AccountRepository for it, then the following code in the repository clas:

    /**
     * @param string $accountEmail
     *
     * @return null|Account
     */
    public function getAccountByEmail(string $email)
    {
        return $this->findOneBy(['email' => $email]);
    }

would result in "return" statement being marked as incorrect, due to type mismatch. There's no auto-complete for fields names as well.
However, the following function would have all the auto-complete and return type is detected correctly:

    /**
     * @param string $accountEmail
     *
     * @return null|Account
     */
    public function getAccountByEmail2(string $accountEmail)
    {
        return $this->getEntityManager()->getRepository('AccountBundle:Account')->findOneBy(['email' => $accountEmail]);
    }
@Haehnchen
Copy link
Owner

Haehnchen commented May 7, 2017

  • result in "return"
  • auto-complete

@Richard87
Copy link

Hi, I have the same problem:

image

I see that you have added a easy mark on it, is it anything I could help with?

@bettinz
Copy link

bettinz commented Sep 4, 2018

Hello, same issue here. Happy to see I'm not alone 😃 do you have any update @Haehnchen ? Thank you very much for the help 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants