Question

When I generate bundle entities with code

php app/console doctrine:generate:entities EnsJobeetBundle

I'm getting this error

[Doctrine\Common\Persistence\Mapping\MappingException] Invalid mapping file 'Ens.JobeetBundle.Entity.Affiliate.orm.yml' for class 'Ens\JobeetBundle\Entity\Affiliate'.

This is Affiliate.orm.yml file:

 Ens\JobeetBundle\Entity\Affiliate:
  type: entity
  table: affiliate
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    url:
      type: string
      length: 255
    email:
      type: string
      length: 255
      unique: true
    token:
      type: string
      length: 255
    created_at:
      type: datetime
  oneToMany:
    category_affiliates:
      targetEntity: CategoryAffiliate
      mappedBy: affiliate
  lifecycleCallbacks:
    prePersist: [ setCreatedAtValue ]
Was it helpful?

Solution

Try opening the file in a text editor, and replacing " " with " " globally.

My colleague was having the exact same issue on the same file, and it turns out the problem was that the file was using something other than spaces as spaces. file(1) showed that the file was a UTF-8 Unicode text rather than plain ASCII.

I believe this may be caused by the source of the copy + paste using different space characters.

OTHER TIPS

This yaml .yml configuration files cannot contain TABs. Only spaces as intendation. That is the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top