Thursday, 15 May 2014

php - Repository Entity not found in symfony2 -


I am developing two projects with Symfony2, and I started giving the code to the second project and with the custom Some problems are coming to work in my tables to search.

This is my site unit

  name space ad \ SisBundle \ Entity; Use the theory / ORM \ mapping as an ORM; / ** * Sites * * @ORM table (name = "sites") * @ORM \ unit (repositoryClass = "advertising \ SisBundle \ unit \ SitesRepository") * / class sites { 
< P> This is my sites repository unit

  name space ad \ SisBundle \ Entity; Use the principle / ORM \ EntityRepository; Class SitesRepository extends EntityRepository { 

The problem is that I have any function that I can not reach to your SitesRepository

I Principle dumping EntityRepository class I saw . This

  EntityRepository {# 309 ▼ #_entityName: "Ad \ SisBundle \ unit \ Sites" #_em: EntityManager {# 289 ... 10} #_class: ClassMetadata {# 298 ▼ + Name "Ad \ SisBundle \ unit \ Sites" + namespace: "Ad \ SisBundle \ institution" + RootEntityName: "Ad \ SisBundle \ unit \ Sites" + CustomGeneratorDefinition: null + CustomRepositoryClassName: null + IsMappedSuperclass: false + parentClasses: [] + subclasses: [] + namedQueries: [] + namedNativeQueries: [] + sqlResultSetMappings: [] + identifier: array: 1 [▶] inheritanceType: 1 + generatorType: 4 + fieldMappings: array: 5 [▶] fieldNames: array: 5 [▶] + column name: array: 5 [▶] + discriminated value: Person + discrimination icon [] + discrimination rectifier column: tap + table: Array: 1 [▶] lifecycleCallbacks: [] + entityListeners: [] + associationMappings: [] + isIdentifierComposite: False + ContainsForeignIdentifier: False + idGenerator: IdentityGenerator {# 306 ▶} + sequenceGeneratorDefinition: Null + tableGeneratorDefinition: Null + changeTrackingPolicy: 1 + isVersioned: Null + versionField: Null + reflClass: ReflectionClass {# 307 ▶} + IsReadOnly: False #namingStrategy: DefaultNamingStrategy {# 276} + reflFields: Array : 5 [▶] -_prototype: null}}  

So I went to my first project, which is working fully and did the same thing.

  Submit Schedule {# 1 9 31 ▼ #_entityName: "ApplicationBundle \ Entity \ Schedule" #_em: EntityManager {# 137 ... 10} #_class: ClassMetadata {# 1825 ▼ + name: "ApplicationBundle \ unit \ Schedule" + namespace: "ApplicationBundle \ institution" + rootEntityName: "ApplicationBundle \ unit \ Schedule" + customGeneratorDefinition: nine ll + customRepositoryClassName: "ApplicationBundle \ unit \ ScheduleRepository" + isMappedSuperclass: false + parentClasses: [] + subclasses: [] + NamedQueries: [] + NamedNativeQueries: [] + SqlResultSetMappings: [] + identifier: array: 1 [▶] inheritanceType: 1 + generatorType: 4 + fieldMappings: array: 3 [▶] fieldNames: array : 3 [▶] COLUMNNAMES: Array: 3 [▶] discriminatorValue: Null + discriminatorMap: [] + discriminatorColumn: Null + Table: Array: 2 [▶] lifecycleCallbacks: Array: 2 [▶] entityListeners: [] + associationMappings: Array: 2 [▶] isIdentifierComposite: False + ContainsForeignIdentifier: False + idGenerator: IdentityGenerator {# 1852 ▶} + sequenceGeneratorDefinition: null + tableGeneratorDefinition: null + changeTrackingPolicy: 1 + isVersioned: null + versionField: null + reflClass: ReflectionClass {# 1840 ▶} + IsReadOnly: false #namingStrategy: DefaultNamingSt rategy {# 119} + reflFields: array: 5 [▶] -_prototype : Unsupported}}  

From the # 1 project to my schedule unit I filled in customRepositoryClassName , but not in my sites unit. Why? Use the same version of both theories and symphonies.


I saw that the # 1 project has dump dumping ScheduleRepository and Project # 2 is dumping EntityRepository . Probably this is the problem?

Project # 1 Dump:

  $ em = $ this- & gt; GetDoctrine () - & gt; GetManager (); Dump ($ em-> getRepository ("App bundle: Schedule")); Exit;  

Project # 2 Dump:

  $ them = $ this-> GetDoctrine () - & gt; GetManager (); Dump ($ em-> getRepository ("AdSis bundle: sites")); Exit;  

The project was created by using the Body # 2:

This is the only difference between the two projects.

Thanks for the help.


No comments:

Post a Comment