These are chat archives for symfony2admingenerator/GeneratorBundle

1st
Apr 2015
Dražen Perić
@peric
Apr 01 2015 08:50
@loostro We've tried your example now and it works - just one more thing, for now... how to configure an image preview on edit/show view?
Dražen Perić
@peric
Apr 01 2015 14:55
@loostro also, I would be really pleased if I can get also an working example for "s2a_collection_upload" - I've tried to follow the documentation but no-go.
Bob van de Vijver
@bobvandevijver
Apr 01 2015 18:59
@loostro Do you know how to enable support for an extra form/filter type (in my case phone_number). I can not get it accepted in the config.yml (gives an "unrecognized option")...
ioleo
@ioleo
Apr 01 2015 21:00
@bobvandevijver what do you mean in config.yml?
@peric ill make a gist tomorrow
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:03
Well, as defined in Configuration, you there the default list of supported types. This should be adjustable in the config.ymlof your own application, but when doing that, you overwrite all the default field/filter types, and a type which is not mentioned in the Configuration.php config is not allowed
ioleo
@ioleo
Apr 01 2015 21:05
no
this configuration is for the form/filter type guesser
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:05
Exactly
ioleo
@ioleo
Apr 01 2015 21:05
so, you can put any type in there
you can tell admingenrator to use 'choice' type to handle 'boolean' fields
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:06
Yeah, but that is not what I want
ioleo
@ioleo
Apr 01 2015 21:06
what are you trying to achieve?
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:06
I want to tell the admingenerator to treat the phone_number type as text
ioleo
@ioleo
Apr 01 2015 21:07
ok
the configuration you mentioned is the "default type" for given database field type
eg. for BOOLEAN use "checkbox"
phone_number is not a database field type
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:08
It is when you have installed an extension ;)
ioleo
@ioleo
Apr 01 2015 21:08
ah I see
so you have a custom field type
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:08
Yes
ioleo
@ioleo
Apr 01 2015 21:08
what are you useing? Propel/Doctrine/Mongo?
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:09
Doctrine
Tobias Feijten
@tobias-93
Apr 01 2015 21:09
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized option "phone_number" under "admingenerator_generator.form_types.doctrine_orm"
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:09
That's the exact error ^^
So, I think that the Configuration is not correct, as it only allows the default Doctrine types, while it should be possible to also introduce your own dbTypes
ioleo
@ioleo
Apr 01 2015 21:11
we've never had anyone with that problem before :)
you know, we can't handle "all possible cases" coz there is not enough time :D
let me think for a moment
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:12
Yeah, it wouldn't be the first time that I encountered that ;)
ioleo
@ioleo
Apr 01 2015 21:14
first thing that come to my head is to create your own bundle that extends Admingenerator
you know, in AcmeMyBundle.php you just add
    public function getParent()
    {
        return 'AdmingeneratorGeneratorBundle';
    }
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:14
I can also create the feature for this bundle, as it really should be to much code/work
ioleo
@ioleo
Apr 01 2015 21:15
and then just overwrite the Configuration.php file
but im not sure that would work
ive never had to overwrite configuration for a bundle yet :)
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:15
Me neither
you should check this out, if it works
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:19
Sure, I think that it should be possible in this manner
But I also think it would be nicer to just support it correctly in the AdminGenerator itself :smile:
ioleo
@ioleo
Apr 01 2015 21:22
im thinking about that
we could probably add ->prototype('array') in the config tree
which would allow adding new (non default) keys
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:24
Let me try that
ioleo
@ioleo
Apr 01 2015 21:26
could you checkout symfony2admingenerator/GeneratorBundle#103
checkout on-standard-dbtypes branch and test if this works?
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:26
Sure, give me a moment
ioleo
@ioleo
Apr 01 2015 21:27
sorry, its non-standard-dbtypes (lost an n)
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:29
PHP Fatal error: Call to undefined method Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition::arrayNode() in /var/www/dev2/vendor/symfony2admingenerator/generator-bundle/DependencyInjection/Configuration.php on line 112
ioleo
@ioleo
Apr 01 2015 21:30
hmm thats weird
it does not complain on line 82
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:30
Missing and extra end as far as can see
It complains about the new ArrayNode, which can not be created in the prototype
ioleo
@ioleo
Apr 01 2015 21:33
you're right
->prototype() needs an ->end()
i've updated the branch
ok now it should be OK
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:35
Maybe it is an better idea to let me first find what is exactly needed, as this also does not solve my problem...
Or at least, as far as I can see at the moment
ioleo
@ioleo
Apr 01 2015 21:36
Why? It should allow you to add non-defined keys to these arrays
you can add a phone_number: text key to your config.yml when this is merged
then, the fieldguesser, when he finds a phone_number field, will by default apply text type
here is the code responsible for checking the dbType
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:39
Already found that code off course, but it does not accept the configuration at the moment
Just give me a moment to check it ;)
ioleo
@ioleo
Apr 01 2015 21:41
the only problem i see is "how to add new key-value pairs to admingenerator_generator.form_types.doctrine_orm array, and I think my PR should solve this (but lets test it to be sure ;) )
if your key-value pair is in the configuration, the rest of the code (FieldGuesser) should recognize it and work
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:41
admingenerator_generator: # Admingenerator configuration
  form_types:
    doctrine_orm:
      phone_number: text
ioleo
@ioleo
Apr 01 2015 21:41
note: you may want to clear your cache for the changes to take effect
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:42
Gives an Invalid type for path "admingenerator_generator.form_types.doctrine_orm.phone_number". Expected array, but got string
ioleo
@ioleo
Apr 01 2015 21:44
hmm
maybe i got it wrong
try now?
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:46
->addDefaultsIfNotSet() is not applicable to prototype nodes at path "admingenerator_generator.form_types.doctrine_orm"
ioleo
@ioleo
Apr 01 2015 21:47
ok well
i must go to sleep now
and find a way to allow adding new keys to that array
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:47
Already got it open ;)
ioleo
@ioleo
Apr 01 2015 21:47
if you find a working solution
just make a pr to non-standard-dbtypes branch
ill merge it tomorrow
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:48
But I will tomorrow (also time for me to go to bed), and when I find the solution, I will let you know
And make the PR :+1:
ioleo
@ioleo
Apr 01 2015 21:48
ok :) have a good night
ill be on chat tomorrow all day
Bob van de Vijver
@bobvandevijver
Apr 01 2015 21:48
You too!
I won't be on the chat until later on the day
Tobias Feijten
@tobias-93
Apr 01 2015 23:11
@loostro one small question: if a field which is not yet available to be filtered on is defined as 'filterable', will it give an error or simply not appear in the filters section of the admin?
I suspect the latter, and in that case we should just wait until the rework of the filters is ready before we can deploy the new version of the admingenerator