Giter Club home page Giter Club logo

sonatadoctrinemongodbadminbundle's Introduction

SonataDoctrineMongoDBAdminBundle

Symfony Sonata / Integrate Doctrine MongoDB ODM into the SonataAdminBundle

Latest Stable Version Latest Unstable Version Psalm Type Coverage License

Total Downloads Monthly Downloads Daily Downloads

Branch Github Actions Code Coverage Documentation
4.x Test Coverage Status Documentation Status
5.x Test Coverage Status Documentation Status

Documentation

Check out the documentation on the official website.

Support

For general support and questions, please use StackOverflow.

If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the contributing guide.

License

This package is available under the MIT license.

sonatadoctrinemongodbadminbundle's People

Contributors

core23 avatar dao avatar dmaicher avatar dunglas avatar emmanuelvella avatar enleur avatar franmomu avatar greg0ire avatar gregbiv avatar jeantristan avatar jordisala1991 avatar joshlopes avatar kingcrunch avatar kunicmarko20 avatar matteosister avatar oskarstark avatar pascal-hofmann avatar pborreli avatar petk avatar phansys avatar rakhnin avatar rande avatar sonataci avatar soullivaneuh avatar spolischook avatar sujayjaju avatar tiagojsag avatar vincentlanglet avatar webdama avatar wesleyvanopdorp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonatadoctrinemongodbadminbundle's Issues

Unexpected "render" tag on Symfony 3.0

The error:
Unexpected "render" tag (expecting closing tag for the "if" tag defined near line 54) in SonataDoctrineMongoDBAdminBundle:Form:form_admin_fields.html.twig at line 54.

I don't find how to fix it ?

Log MongoDB queries

Is there a way to log the admin DB queries (for example on the list view)? They aren't logged in the application's dev.log, neither do they appear in the profiler.

Sort by embedded field

Hi!

There is problem with sort data by embedded field. I want to change method setSortBy in ProxyQuery base on $parentAssociationMappings.

Is it good solution? Maybe do you have better idea?

EmbedOne: How to configureFormFields ?

When I use ->add('user.name') I have an error:
No mapping found for field 'user__name' in class '..\Document\Account'.

But the mapping is in the embed class, called in my case as EmbedUser ...

class Account
{
    /**
     * @MongoDB\Id
     */
    protected $id;

    /**
     * @MongoDB\EmbedOne(targetDocument="EmbedUser")
     */
    protected $user;
[...]

Many to one relations not shown in list view

When a many to one relation is defined on a Doctrine (MongoDB) Document, the related document is never shown in the list view.

In the following example, category is a property of a Post that contains a Category object.

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper->add('category');
    }

I expect the string representation of the category to be shown in the list view. Instead nothing is shown.

ReferenceMany with discriminatorMap

I have these simple document:

/**
 * @MongoDB\Document
 */
class Object
{

    /**
     * @MongoDB\Id
     */
    private $id;


    /**
     * @MongoDB\String
     */
    private $title;


    /**
     * @MongoDB\ReferenceMany(discriminatorMap={"file"="File","link"="Link"})
     */
    private $resources = array();

}

[...]

and this ObjectAdmin.php:

class ObjectAdmin extends Admin
{
    // Fields to be shown on create/edit forms
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('title')
            ->add('resources', 'sonata_type_model', array('expanded' => true))
    }
[...]

But something goes wrong with:

Class does not exist
500 Internal Server Error - ReflectionException

May you help me?

v.

Filtering by mongo id do not work properly.

I think there must be new filter type for mongo id because type "doctrine_mongo_string" doesn't work for it.

 $queryBuilder->field($field)->equals(new \MongoRegex(sprintf('/%s/i', $data['value'])));

Embed array and Embed Collection are not shown on admin interface

I am getting crazy becausefe of the lack of enough knowledge about sonata admin and of course SonataDoctrineMongoDBAdminBundle. Firstly, I have installed SonataUserBundle and everything works well except user groups. To run the interface correctly, I need to comment all abput groups.

So to run without errors my final UserAdmin file is like this. http://pastebin.com/DNM8kf6V

If I remove comments before on groups when edit or add new user then an exception occurs such as:

Class '' does not exists

When I use SonataDoctrineORMAdminBundle there is no any problem. Everyting runs like http://demo.sonata-project.org/admin/dashboard

When I read the documentation, everything is about Doctrine ORM. There is no sufficient documentation for mongodb users. I have wasted about 15 days on this issue. But I could not find any solution. This is getting me so nervous. Would you recommend me a good installaition guide for mongodb? I really need some guru's help.

Tag versions && used tagged dependencies

Right now the composer.json requires: "doctrine/mongodb-odm-bundle": "dev-master".
Which means it won't be usable for projects that don't want all the pain associated with depending on dev-master.

Is the dependency actually really on master or would it be possible to use a tagged version instead?

What about inherit SonataDoctrineORMAdminBundle?

I found bug in association js, that already fixed in SonataDoctrineORMAdminBundle (pr is coming soon). So what about inherit some template, especially javascript templates, from SonataDoctrineORMAdminBundle?

Impossible to add new rows in modified collection

I have a document with an EmbeddedCollection field (let's call it myCollection). In sonata admin I render that field as sonata_type_collection type with edit => inline, inline => table options.

Let's assume, that I need to flush all elements in myCollection depending on some GET parameter. For example, I can achieve it like this:

protected function configureFormFields(FormMapper $formMapper)
{
        if ($this->request->get('test') !== null) {
            foreach ($this->getSubject()->getMyCollection() as $collectionELement) {
                $this->getSubject()->removeMyCollectionElement($collectionELement);
            }
        }
}

Steps which reproduce my problem:

  1. I've god 6 elements saved in my myCollection field.
  2. I go to sonata's edit page of that document with test=1 GET parameter
  3. Table for myColleciton is empty (it's okay, because we flushed it)
  4. Click on the "Add new" button, I'm getting an error:

What I see next:

Key "0" for array with keys "6" does not exist in SonataDoctrineMongoDBAdminBundle:CRUD:edit_mongo_collection.html.twig at line 25

What supposed to be:
New row added to the table without errors.

Add docs for DocumentManager and QueryBuilder usage

Analog to the DoctrineORMAdminBundle
http://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/query_proxy.html
there is an entry for MongoDBAdminBundle
http://sonata-project.org/bundles/mongo-admin/master/doc/reference/query_proxy.html

But I don't know if the usage of

$queryBuilder = $this->em->createQueryBuilder();

is correct for the ODM.

Anyway what still is missing (in the other bundle too BTW:
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/master/Resources/doc/reference/list_field_definition.rst
)
is an example for the QueryBuilder usage for filter types like doctrine_mongo_choice e.g.:

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $builder = $this->getModelManager()
                        ->getDocumentManager('Sps\Bundle\CrmBundle\Document\HistoryType')
//                        ->getDocumentManager()
                        ->createQueryBuilder('Sps\Bundle\CrmBundle\Document\HistoryType');

        $types = $builder
                ->select('name', 'slug')
                ->hydrate(false)
                ->getQuery()
                ->execute();

        $typeChoices = array();
        foreach ($types as $type) {
            $typeChoices[$type['slug']] = $type['name'];
        }

        $datagridMapper
            ->add('type', 'doctrine_mongo_choice', array(),
                    'choice',
                    array('choices' => $typeChoices)
            )
        ;
    }

I havn't found any docs on this yet so I don't know if my attempt is best practice.

Can somebody comment on this and where I should create a PR with updated docs e.g.:
https://github.com/sonata-project/SonataDoctrineMongoDBAdminBundle/blob/master/Resources/doc/reference/list_field_definition.rst

No docs

Hi,

I realize that it's early stage development, but sure would appreciate a doc with just the config options laid out. thx.

composer install problems

hi, i have problems while installing "sonata/doctrine-mongodb-admin-bundle": "dev-master" via packagist on clean symfony-standard project. i've got error during installation:

[Composer\DependencyResolver\SolverProblemsException]
[Job(cmd=install, target=sonata/doctrine-mongodb-admin-bundle, packages=[sonata/doctrine-mongodb-admin-bundle-9999999-dev]), ]

here is my JSON config:

{
    "name": "symfony/framework-standard-edition",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.2",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": "2.2.0",
        "doctrine/doctrine-bundle": "dev-master",
        "twig/extensions": "dev-master",
        "symfony/assetic-bundle": "dev-master",
        "symfony/swiftmailer-bundle": "dev-master",
        "symfony/monolog-bundle": "dev-master",
        "sensio/distribution-bundle": "dev-master",
        "sensio/framework-extra-bundle": "dev-master",
        "sensio/generator-bundle": "dev-master",
        "jms/security-extra-bundle": "dev-master",
"sonata-project/admin-bundle": "*",
"doctrine/mongodb-odm-bundle": "dev-master",
"sonata/doctrine-mongodb-admin-bundle": "dev-master"

    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web"
    }
}

i solved this problem by adding new repository to config, where i told to install directly from github:

               {
            "type": "package",
            "package": {
                "name": "sonata-project/doctrine-mongodb-admin-bundle/Sonata/DoctrineMongoDBAdminBundle",
                "version": "master",
                "source": {
                    "url": "git://github.com/sonata-project/SonataDoctrineMongoDBAdminBundle.git",
                    "type": "git",
                    "reference": "master"
                }
            }
        },

but i don't think that is clean solution

add to composer?

Are you planning to add a composer.json file and add this bundle to packagist?
I'm using the symfony-standard master that now uses composer as its only package manager.
So...If you want, I can send you a pull request with the composer.json file. Just let me know.

doctrine_mongo_choice filter use with references

Hi, Iย have problem with filtering with references.
I can't figure out how to make this filter work.

first try, this will show select with id's, it's not nice and query is wrong:

$typeQuery = $this->getModelManager()->createQuery('MyBundle:Types')->execute();

            ->add('type','doctrine_mongo_choice',
                [
                    'field_type' => 'choice',
                    'field_options' => array('choices' => $typeQuery),
                ])

query:

db.Place.count({ "type": 56b46f048faed573218b45ee }).runCommand({ "count": "Place", "query": { "type": 56b46f048faed573218b45ee }, "limit": 0, "skip": 0 });

this will trigger An Exception was thrown while handling: zero-length keys are not allowed, did you use $ with double quotes?

query should be: { "type.$id": ObjectId("56b46f048faed573218b45ee") }

so I can set up fieldType like this:

->add(
                'type',
                'doctrine_mongo_choice',
                [...],
                'choice',
                [
                    'multiple' => false,
                    'choices' => $typeQuery,
                    'choice_label' => function ($type, $key, $index) {
                        return $type->getTitle();
                    },
                ]

select is nice with right properties show to user but error is still same.

can I somehow modify query builded by filter or fix this with other filterType?

Can't use export feature

Hi everyone!

I have an issue, when i whant to export for example users
i got error:

500 Not yet implemented - function getExportFields($class) in DoctrineMongoDBAdminBundle/Model/ModelManager.php

When i override getExportFields() i got same error with function getDataSourceIterator()

how should I ovverride getDataSourceIterator()?
or i made something wrong?

Common parent bundle

It seems, that this bundle contains many code, that is also in SonataDoctrineORMAdmingBundle. I think you should get in touch with @rande (ping ๐Ÿ˜‰ ) to create a common parent bundle (or library). It seems like every bug is always fixed twice (or once and then copied).

SonataAdmin dependancy

Now that SonataAdmin has a master in sync with sf 2.2 and added two branches for 2.0 and 2.1, this bundle should reflect the changes too

Reference to One -> Pick List and trying to filter breaks

I have this mapping (i am not sure if its just Mongo) but basically is One to One

/**
     * @ODM\ReferenceOne(targetDocument="Shopcade\UserBundle\Document\User", simple=true, inversedBy="posts", name="uid")
     * @Assert\NotBlank()
     */
    private $author;

And have this on my configureForm

->add('author', 'sonata_type_model_list', array(
                        'btn_add'       => false,
                        'btn_list'      => 'Pick Author',
                        'btn_delete'    => false,
                        'btn_catalogue' => 'AppBundle',
                    ), [
                        'placeholder' => 'No Author',
                        'associated_tostring' => 'getName'
                    ])

It renders properly: http://grab.by/HUSk
Also it renders properly when i click on Pick Author but when i TRY to filter that list it gives me the page i am in, in the model prespective: http://grab.by/HUSC

Type "sonata_type_collection" is not yet implemented.

Looks like I am lucky again :)

Type "sonata_type_collection" is not yet implemented.
500 Internal Server Error - RuntimeException
../SonataDoctrineMongoDBAdminBundle/Builder/FormContractor.php at line 123

Should I start work on PR?

EmbedMany sonata_type_model

Hi,

If I do EmbedMany instead of ReferenceMany there is a strange behaviour.

db.Offer.update({ "_id": ObjectId("55e9b36138bee0189700002d") }, { "$unset": { "creatives.0": true, "creatives.1": true } });
db.Offer.update({ "_id": ObjectId("55e9b36138bee0189700002d") }, { "$pull": { "creatives": null } });
db.Offer.update({ "_id": ObjectId("55e9b36138bee0189700002d") }, { "$pushAll": { "creatives": [ { "_id": ObjectId("55eb456038bee05035000036"), "name": "test", "height": 48, "width": 320, "imageName": "55eb4560a5e82.gif", "type": "image" }, { "_id": ObjectId("55eb457f38bee0c8bb
000031"), "name": "TEst", "height": 50, "width": 300, "imageName": "55eb457f43712.gif", "type": "image" }, { "_id": ObjectId("55eb536e38bee014bc00002a"), "name": "javert", "height": 856, "width": 660, "imageName": "55eb536e223bf.jpg", "type": "image" } ] } });
db.Creative.remove({ "_id": ObjectId("55eb456038bee05035000036") });
db.Creative.remove({ "_id": ObjectId("55eb457f38bee0c8bb000031") });

Why does it remove the parent element from the database?

Could not load type "filter" and Could not load type "s4fe7206bea35a"

Hi,

I am on Symfony 2.1.0-BETA1, and I have this error when I want to List a document since few weeks :

URL : app_dev.php/admin/mysite/site/site/list

Could not load type "filter"
500 Internal Server Error - FormException

and adding a new records doesn't works too :

URL : app_dev.php/admin/mysite/site/site/create

Could not load type "s4fe7210ba9d6b"
500 Internal Server Error - FormException

This is very strange, because few weeks ago, Sonata worked pretty well under Symfony 2.1 on the same project (and I've nothing changed in my sonata admin class).

Is someone encounter the same issue ?
Jonathan.

Problem with rendering relation in list

After this change 55bda56#L5R16 we are getting error in list actions for one-to-one and one-to-many related entities:

Key "route" for array with keys "placeholder, label, sortable, sort_parent_association_mappings, sort_field_mapping, _sort_order, code" does not exist in SonataDoctrineMongoDBAdminBundle:CRUD:list_mongo_one.html.twig at line 12

Not sure what's the main cause of it, but reverting the line solves the issue for us.

Will appreciate some advice on subject. Should we just fix dependency on previous commit? Or the line in face should be reverted? Or we missed some other changes that should be done in our code?

Thanks

got an error about generateObjectUrl

*18925351 FastCGI sent in stderr: "PHP message: PHP Catchable fatal error: Argument 3 passed to Sonata\AdminBundle\Admin\Admin::generateObjectUrl() must be of the type array, boolean given in /var/www/www.test.com/releases/20130903100912/app/cache/prod/classes.php on line 7917" while reading response header from upstream, client: 180.166.43.146, server: www.test.com, request: "GET /admin/test/web/topicomment/list HTTP/1.1", upstream: "fastcgi://unix:/var/run/www.php5-fpm.socket:", host: "www.test.com", referrer: "http://www.test.com/admin/test/web/test/list"

TravisCI build breaks randomly

TravisCI build breaks randomly with:

PHP Fatal error: Interface 'Symfony\Component\Security\Acl\Model\DomainObjectInterface' not found in /home/travis/build/sonata-project/SonataDoctrineMongoDBAdminBundle/vendor/sonata-project/admin-bundle/Admin/Admin.php

See:

(first two builds are for the same code, third link leads to a different PR which also randomly failed.)

GridFilter -- Using embed document and Reference One

Trying to filter a merchant that is part of a embed document... code:

#Document\Product
/** @ODM\EmbedOne(targetDocument="ProductMerchant") */
    private $merchant;
#Document\ProductMerchant
/** @ODM\ReferenceOne(targetDocument="\Shopcade\MerchantBundle\Document\Merchant", simple=true) */
    private $id;
 /** @ODM\Field(name="n", type="string") */
    private $name;
#Admin\ProductAdmin
->add('merchant.id')

Error: Error: Call to a member function getRepository() on a non-object

$loader = function (Options $options) use ($type) {
            $queryBuilder = (null !== $options['query_builder'])
                ? $options['query_builder']
                : $options['em']->getRepository($options['class'])->createQueryBuilder('e'); # This is line 71 - $options['em'] seems to be null!
            return $type->getLoader($options['em'], $queryBuilder, $options['class']);
        };

Stack Trace: in vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php at line 71

One to Many in the same Edit Panel

Hello,

I have this small issue, i have this type of Relation:

Post 1 - N Blocks
Blocks 1 - N Products

My problem is that when i am editing the Post, i have the Blocks Tab and inside that tab i have the list of Blocks in inline edit table , where the products are there as well but those products are already inserted in the DB i need autocompletation on those.

screen shot 2015-09-16 at 16 45 59

Right now i put that as a Sonata_type_collection but even if its save at first time, it break right afterwards. So what i really wanted was:

screen shot 2015-09-16 at 16 46 13

Something like this but for multiple entities, where you have the Pick Product and a green button below "Adding Product". You add multiple products and you pick the product thru the model picker.

Is this possible? any ideas? work in progress? suggestions on how to do this ? and alternatives are very well welcomed :)

Thanks

Tag versions

See discussion at #71

The problem is, that as long this bundle doesn't tag their versions (even the older ones ๐Ÿ˜‰ ) it is quite likely, that it will get out of sync with sonata-admin in an application. For now I think the easiest solution is to choose a revision from the same date (and maybe around the same time) as the sonata-admin-tags, that "works", and tag it with the same name. At least for the latest v2.2.3

Would be nice, if someone from sonata-admin ( @rande ?) can join this topic. Maybe it is useful to introduce a release-process for Sonata-Project-bundles?

'roles' array is generated as a subdocument

Why the roles array is generated not as a common array but a subdocument where fields are actually array indexes?

I have a problem when I attempt to find users, which have ROLE_SOMETHING or ROLE_SOMETHING_ELSE as one of their roles. It would be a simple query if 'roles' is an array:

db.User.find({roles: {$in: ['ROLE_SOMETHING', 'ROLE_SOMETHING_ELSE']}})

But I can't do that, because 'roles' is a subdocument.
Maybe there is some kind of doctrine query builder that allows me to get the expected result set?

Please, tell me how can I do such query.

Autodetection for date filters does not work

protected function configureDatagridFilters(DatagridMapper $datagridMapper) {
        $datagridMapper
                ->add('created')
        ;
    }

Throws an error.

protected function configureDatagridFilters(DatagridMapper $datagridMapper) {
        $datagridMapper
                ->add('created', 'doctrine_mongo_date')
        ;
    }

Works.

Wont install via composer with latest AdminBundle && symfony 2.3 as a result

This bundle requires AdminBundle 2.2.*, which requires symfony/twig-bridge < 2.3

Leads to a nasty composer fail...

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install symfony/symfony 2.3.x-dev
    - Conclusion: don't install symfony/symfony v2.3.1
    - Conclusion: don't install symfony/symfony v2.3.0
    - Conclusion: don't install symfony/symfony v2.3.0-RC1
    - Conclusion: don't install symfony/symfony v2.3.0-BETA2
    - sonata-project/admin-bundle 2.2.0 requires symfony/twig-bridge >=2.2,<2.3-dev -> satisfiable by symfony/symfony[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2], symfony/twig-bridge[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2].
    - sonata-project/admin-bundle 2.2.1 requires symfony/twig-bridge >=2.2,<2.3-dev -> satisfiable by symfony/symfony[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2], symfony/twig-bridge[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2].
    - sonata-project/admin-bundle 2.2.2 requires symfony/twig-bridge >=2.2,<2.3-dev -> satisfiable by symfony/symfony[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2], symfony/twig-bridge[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2].
    - sonata-project/admin-bundle 2.2.x-dev requires symfony/validator >=2.2,<2.3-dev -> satisfiable by symfony/symfony[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2], symfony/validator[2.2.x-dev, v2.2.0, v2.2.1, v2.2.2].
    - Can only install one of: symfony/symfony[v2.3.0-BETA1, 2.2.x-dev].
    - Can only install one of: symfony/symfony[v2.3.0-BETA1, v2.2.0].
    - Can only install one of: symfony/symfony[v2.3.0-BETA1, v2.2.1].
    - Can only install one of: symfony/symfony[v2.3.0-BETA1, v2.2.2].
    - Can only install one of: symfony/symfony[v2.3.0-BETA1, 2.2.x-dev].
    - don't install symfony/validator 2.2.x-dev|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/validator v2.2.0|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/validator v2.2.1|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/validator v2.2.2|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/twig-bridge 2.2.x-dev|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/twig-bridge v2.2.0|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/twig-bridge v2.2.1|don't install symfony/symfony v2.3.0-BETA1
    - don't install symfony/twig-bridge v2.2.2|don't install symfony/symfony v2.3.0-BETA1
    - Installation request for symfony/symfony 2.3.* -> satisfiable by symfony/symfony[2.3.x-dev, v2.3.0, v2.3.0-BETA1, v2.3.0-BETA2, v2.3.0-RC1, v2.3.1].
    - sonata-project/doctrine-mongodb-admin-bundle dev-master requires sonata-project/admin-bundle 2.2.*@dev -> satisfiable by sonata-project/admin-bundle[2.2.x-dev, 2.2.0, 2.2.1, 2.2.2].
    - sonata-project/doctrine-mongodb-admin-bundle dev-master requires sonata-project/admin-bundle 2.2.*@dev -> satisfiable by sonata-project/admin-bundle[2.2.x-dev, 2.2.0, 2.2.1, 2.2.2].
    - Conclusion: don't install sonata-project/admin-bundle 2.2.x-dev|keep sonata-project/admin-bundle 2.2.x-dev|install sonata-project/admin-bundle 2.2.0|install sonata-project/admin-bundle 2.2.1|install sonata-project/admin-bundle 2.2.2
    - Installation request for sonata-project/doctrine-mongodb-admin-bundle master -> satisfiable by sonata-project/doctrine-mongodb-admin-bundle[dev-master].

Pager improvement

Right now the pager execute the query twice, one for the count and one to have the XX first results.

Plus the count query is executed with the sort options, is that really necessary ?

db.book.find().sort({ "status": 1 });
db.book.find().skip(0).limit(25).sort({ "status": 1 });

Can't we do that instead :

db.book.count();
db.book.find().skip(0).limit(25).sort({ "status": 1 });

or just

db.book.find().sort({ "status": 1 });

Filter by embed Document

I have a document that has the property merchant with the name ("m") and embeds a document with id that referes to a Merchant in simple = true

When i am filtering my field name is always ID -- to fix it i added this:

# Sonata/DoctrineMongoDBAdminBundle/Filter/Filter.php
public function getFieldName()
    {
        $fieldName = $this->getOption('field_name');

        if (!$fieldName) {
            throw new \RuntimeException(sprintf('The option `field_name` must be set for field: `%s`', $this->getName()));
        }

        foreach($this->getOption('parent_association_mappings') as $map) {
            if(!empty($map['name'])) {
                $fieldName = $map['name'] . "." . $fieldName;
            } elseif (!empty($map['fieldName'])) {
                $fieldName = $map['fieldName'] . $fieldName;
            }
        }

        return $fieldName;
    }

Not sure if is the best approach or if is going to break more stuff -- on DataGridBuilder there is a function "fixFieldDescription" , i could set the option field name there but wanted to make sure what is the right approach to this.

The option "csrf_protection" does not exist.

Hi,

When trying to access a list i'm getting this error msg:

The option "csrf_protection" does not exist. Known options are: "virtual", "error_bubbling", "empty_data", "data", "data_class", "trim", "required", "read_only", "max_length", "pattern", "property_path", "by_reference", "error_bubbling", "error_mapping", "label", "attr", "invalid_message", "invalid_message_parameters", "translation_domain", "empty_data", "validation_groups", "validation_constraint", "sonata_admin", "sonata_field_description"

Called by

`FormFactory ->createNamedBuilder ('form', 'filter', array(), array('csrf_protection' => false)) '

in

https://github.com/sonata-project/SonataDoctrineMongoDBAdminBundle/blob/master/Builder/DatagridBuilder.php#L128

Is it out of sync with the symfony trunk or a configuration issue in my setup?

Thx

filter is not working when apply some columns that equals 0

for example,I have a document A, which has a column B. The type of B is boolean,that means values of B could be 1 or 0.

then I created a admin form of A, I have set B as filter.

when I choice "B yes 1" in the filter. the query will be like:

db.feeds.find({  "B": 1 }).limit().skip().sort({ "created_at": -1 });

If I choice "B yes 0" in the filter, the query SHOULD like :

db.feeds.find({  "B": 0 }).limit().skip().sort({ "created_at": -1 });

but In fact,the query is like following:

db.feeds.find().limit().skip().sort({ "created_at": -1 });

as you can see, B is missing

the problem is that because in ChoiceFilter.php line 50:

            if (empty($data['value']) || $data['value'] == 'all') {

this is wrong.

for example:

$a="0";
var_dump(empty($a));    // the output will be true.

I've made a pr to solve this problem.

config.yml

Hello,

i'm trying to install this bundle with SonataAdminBundle but i've founded some problems with the configuration file. Could you put a simple example about how i could config it ? For example for

sonata_doctrine_odm_admin:

in config.yml

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.