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

Collection_Upload and Propel #118

Open
ndoulgeridis opened this issue Mar 26, 2014 · 3 comments
Open

Collection_Upload and Propel #118

ndoulgeridis opened this issue Mar 26, 2014 · 3 comments

Comments

@ndoulgeridis
Copy link

Hello,

If there a sample code how to achieve admingenerator+AvocodeFormsExtensions+Propel (and vichuploader probably)?
A simple sample code with Gallery-Images will help very much to see how it works.

Thanks a lot.

@ioleo
Copy link
Member

ioleo commented Mar 26, 2014

@Crash21 i don't use propel, but:

  • AvocodeFormExtensionsBundle is ORM agnostic
  • AdmingeneratorGeneratorBundle supports Propel (for all features, as far as I'm aware)
  • unfortunately VichUploaderBundle does not support Propel according to README it does support only Doctrine ORM and ODM
  • however there is a way to use afe_single_upload and afe_collection_upload without dependencies and it has been documented here - the example is for Doctrine Entity, but the same would probably work with Propel object class:
    • implement Avocode\FormExtensionsBundle\Form\Model\UploadCollectionFileInterface
    • add getXxx and getXxxWebPath methods (where Xxx is the field name)
    • make sure instance of Symfony\Component\HttpFoundation\File\File is injected into $Xxx property (if the file is set ofcourse), an example impementation in the code I linked to above

@ndoulgeridis
Copy link
Author

Hmm I get

Key "id" in object with ArrayAccess of class "Symfony\Component\Form\FormView" does not exist in AvocodeFormExtensionsBundle:Form/CollectionUpload:template_download.html.twig at line 59

Any ideas how to fix it?

@sescandell
Copy link
Member

Hi @Crash21

This is because the AbstractType defined in your "type" option for your afe_collection_upload field doesn't contain any "id" field.

Why id? Simply because it is the default value of primary_key option from your afe_collection_upload field. Two things to fix it:

  1. add an id field to your Type
  2. change the primary_key option to the right one for you

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

No branches or pull requests

3 participants