Skip to content

False Possitive in Abstract Respoitory classes mapped to Abstract Entity classes: "<entity> has no field or association named <field>"  #525

Closed
@arderyp

Description

@arderyp

Bug report

Here is an example of what I am seeing. It is incorrect on all counts.

------ ------------------------------------------------------------------------------------------------------------- 
  Line   src/App/Repository/AbstractEntityRepository.php                                                       
 ------ ------------------------------------------------------------------------------------------------------------- 
  19     QueryBuilder: [Semantical Error] line 0, col 86 near 'active = 1': Error: Class                              
         App\Entity\AbstractEntity has no field or association named active                      
  40     QueryBuilder: [Semantical Error] line 0, col 86 near 'altId': Error: Class              
         App\Entity\AbstractEntity has no field or association named altId  
  49     QueryBuilder: [Semantical Error] line 0, col 86 near 'altId': Error: Class              
         App\Entity\AbstractEntity has no field or association named altId  
  82     QueryBuilder: [Semantical Error] line 0, col 86 near 'number = :number': Error: Class                        
         App\Entity\AbstractEntity has no field or association named number                      
  93     QueryBuilder: [Semantical Error] line 0, col 86 near 'active = 1 ORDER': Error: Class                        
         App\Entity\AbstractEntity has no field or association named active                      
 ------ ------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------- 
  Line   tests/Default/Common/Controller/AbstractControllerTestCase.php                                                      
 ------ -------------------------------------------------------------------------------------------------------------------- 
  484    QueryBuilder: [Semantical Error] line 0, col 20 near 'id) FROM App\Common\Entity\AbstractEntity': Error: Class  
         App\Common\Entity\AbstractEntity has no field or association named id                                           
 ------ --------------------------------------------------------------------------------------------------------------------

I don't know how to replicate this type of thing on phpstan.org given the Doctrine dependency. Let me know if you might have a suggestion.

Code snippet that reproduces the problem

No response

Expected output

no erros

Did PHPStan help you today? Did it make you happy in any way?

always :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions