mtarld / symbok-bundle

Symfony annotations bundle
MIT License
49 stars 1 forks source link

Bundle version 2.x causes @Vich\Uploadable annotation on entity to be removed #25

Closed RaederDev closed 4 years ago

RaederDev commented 4 years ago

I tried installing the newest dev version to solve the issues I encountered with Symfony4, unfortunately it seems to be not compatible with Vich\UploaderBundle.

My Entity has the Vich\UploaderBundle\Mapping\Annotation\Uploadable annotation on the class as is required by the other bundle but after installing symbok the annotation seems to be removed:

The class "App\Entity\Advertisement" is not uploadable. If you use annotations to configure VichUploaderBundle, you probably just forgot to add `@Vich\Uploadable` on top of your entity. If you don't use annotations, check that the configuration files are in the right place. In both cases, clearing the cache can also solve the issue.

My class looks like this:

/**
 * @ORM\Entity(repositoryClass="App\Repository\AdvertisementRepository")
 * @Data(fluent=true)
 * @Vich\Uploadable()
 */
class Advertisement
{
...properties here
}
mtarld commented 4 years ago

You're perfectly right ! Symbok seems to remove class annotations that aren't generic ones (such as @author) or that aren't from it's own namespace (such as @Data)

You can see the generated output using php bin/console symbok:preview [classFilePath]

I'll fix it ASAP, thanks !

mtarld commented 4 years ago

@N0ps32 should be fixed on 2.x Can you give a try ?

RaederDev commented 4 years ago

@mtarld unfortunately I'm still getting the same error with the latest version

mtarld commented 4 years ago

@N0ps32, could you give me the output of php bin/console vich:mapping:debug-class App\\Entity\\[YOUR_CLASS] ?

mtarld commented 4 years ago

As discussed together, I was able to reproduce that bug and I fixed it. 2.0.0 version is now keeping every annotations.

Feel free to reopen the issue if your still experiencing that bug. Thanks for your report :)

RaederDev commented 4 years ago

@mtarld thank you for the fix! I can confirm that it works on my installation as well.