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
Error in MongoDB types #31
Comments
hash is not a dbtype !! That means the field guesser have not find the model type. see : https://github.com/cedriclombardot/AdmingeneratorGeneratorBundle/blob/master/Guesser/DoctrineODMFieldGuesser.php It's normally take the dbType from doctrine mapping. If it's doesn't work, you could add in your yaml :
|
In fact hash seems really be a type ! https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/config/doctrine/User.mongodb.xml Could you try to complete the guesser ?? probably with a "collection" dbType ?? |
I'll work on it |
Thx for to link, i ll try to implement all fields. Could you do it for hash ? My mongo db env is down tonight i've a fatal doctrine/mongodb-odm#175 |
Now I'm not sure how to do that . |
For me there is only to update https://github.com/cedriclombardot/AdmingeneratorGeneratorBundle/blob/master/Guesser/DoctrineODMFieldGuesser.php switchs to add the hash case |
Is it possible for you to add the "hash" forms and the gusser + filters |
i ll work on it this week |
Thanks , you're a life saver |
@salehsed it's ok for hash i'll will look for other fields |
@cedriclombardot that's awesome. |
It's works for me ! Have you got a js error ?? Have you publish assets before ? Do you use a specific theme ActiveAdmin or original or your own ?? |
We used custom template and extend the blocks {% extends "::base.html.twig" %}
{% block main %}
<div id="content">
{% block flashes %}
{% if app.session.flash('success') %}
<div class="notification_box success">
{{ app.session.flash('success') }}
</div>
{% endif %}
{% if app.session.flash('error') %}
<div class="notification_box error">
{{ app.session.flash('error') }}
</div>
{% endif %}
{% endblock %}
{% block body %}{% endblock %}
</div>
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('/bundles/admingeneratorgenerator/css/all.css') }}" type="text/css" media="all" />
<!--[if IE]>
<link href="{{ asset('/bundles/admingeneratorgenerator/css/ie.css') }}" rel="stylesheet" type="text/css" />
<![endif]-->
{% endblock %} |
Ok so you have to add a jquery because the add code is : $(document).ready(function() {
type_collection_hashField_nextId = $('#edit_movie_hashField > div').length;
$('#type_collection_hashField .new').click(function() {
var prototype = $('#edit_movie_hashField').attr('data-prototype');
prototype = prototype.replace(/\$\$name\$\$/g, type_collection_hashField_nextId);
type_collection_hashField_nextId++;
$('#edit_movie_hashField').append(prototype);
$('#edit_movie_hashField > div:last').append("<a class=\"delete\"> </a>");
$('#edit_movie_hashField .delete').click(function() { //@todo make a function for this
$(this).parent('div').remove();
});
});
$('#edit_movie_hashField > div').append("<a class=\"delete\"> </a>");
$('#edit_movie_hashField .delete').click(function() {
$(this).parent('div').remove();
}); |
is there any way to make the js more general , because it seems to just work with "MOVIE" scenario $('#edit_movie_hashField > div') |
The js is auto generated ;) so it correspond automatically with you field look into your source you will see thats correspond to your field name https://github.com/cedriclombardot/AdmingeneratorGeneratorBundle/blob/master/Resources/templates/CommonAdmin/EditTemplate/Type/collection.php.twig |
can you tell me which twig block is getting the js codes ? |
I m not sure to understand about wich block you speack, The field block is |
I have a similar problem, but with the Collection field type:
I get this error:
I am missing something? |
Is it possible to have a Collection without targetDocument parameter in doctrine ? I tink your line should like /**
* @MongoDB\Colelction(targetDocument="Admingenerator\DoctrineODMDemoBundle\Document\Producer")
*/ |
Yes, it maps to an array of strings. (eg: a list of tags) It is especially useful with MongoDb for his support of "Multikeys": http://www.mongodb.org/display/DOCS/Multikeys |
Finally what is the difference with hash ? is "Multikeys" collection :
isn't an object with a field name, author and an hash tags ? in an odm ? |
The type "Collection" is like the Hash but with numeric indexes. In your example the document class would be:
Also notice that the Collection doesn't have the targetDocument attribute (Unlike ReferenceMany: http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/reference-mapping.html) |
Ok so i have to fix my test on https://github.com/cedriclombardot/AdmingeneratorGeneratorBundle/blob/master/Guesser/DoctrineODMFieldGuesser.php#L167 |
If it can help, I've (partially) fixed the issue with:
However in the List its displayed only "Array" in the services column and the update doesn't work. |
issue closed |
I'm trying to create an admin for The User document in FosUserBundle. That document has a "role" attribute that the type is "hash"
And when the admin controller tries to show the page , it'll throw
The text was updated successfully, but these errors were encountered: