Giter Site home page Giter Site logo

Comments (6)

stefandoorn avatar stefandoorn commented on July 27, 2024

@pamil Could you advice best way to add a generic export controller that can act similar to ResourceController without extending it (else it's tedious for users of this plugin to get each exporter working)? Would like to use the same filters/data fetching as being used on the 'indexAction' in the ResourceController..

Doing something like this doesn't really get it working (WIP) with such URL: http://webshop.test.local/app_dev.php/admin/export/country/csv?criteria%5Bcode%5D%5Btype%5D=contains&criteria%5Bcode%5D%5Bvalue%5D=nl&criteria%5Benabled%5D=

        // Get metadata config
        // @todo Allow for non-sylius resources
        $metadata = Metadata::fromAliasAndConfiguration('sylius.' . $exporter, $this->container->getParameter('sylius.resources')['sylius.'.$exporter]);
        $configuration = $this->requestConfigurationFactory->create($metadata, $request);
        
        dump($metadata);
        dump($configuration);

        $resources = $this->resourcesCollectionProvider->get($configuration, $repository);

        dump($resources);

I have 2 countries (BE & NL), and in this case only expected NL in the results, but both are. I'm probably overlooking something that makes it pass the criteria GET param to the resolver..

from syliusimportexportplugin.

stefandoorn avatar stefandoorn commented on July 27, 2024

Ok, adding

        _sylius:
            paginate: false
            filterable: true

to the routing helps, but now it's 0 results :-)

from syliusimportexportplugin.

stefandoorn avatar stefandoorn commented on July 27, 2024

Nm, issue with the fact that 'enabled' didn't have a value while filtering. Seems unrelated.

from syliusimportexportplugin.

stefandoorn avatar stefandoorn commented on July 27, 2024

Not sure why on the normal grid an empty value for 'enabled' works (it shows one result), but if in the URL in my example it's not returning a result. Might be a bug in resource resolving?

from syliusimportexportplugin.

stefandoorn avatar stefandoorn commented on July 27, 2024

To make it more clear for @pamil:

I'm using this URL on the grid: http://webshop.test.local/app_dev.php/admin/export/country/csv?criteria[code][type]=contains&criteria[code][value]=nl&criteria[enabled]=.

It returns NL only on the grid. In the database I have NL & BE, that's all. This is expected behavior.

When using the same URL filtering as in PR (#81), the NL is not in the result (result is empty). Adjusting the URL to http://webshop.test.local/app_dev.php/admin/export/country/csv?criteria[code][type]=contains&criteria[code][value]=nl solves it and NL is in the export. It seems due to no value for enabled, but that works on the Grid. Not sure therefore why this is an issue.

from syliusimportexportplugin.

stefandoorn avatar stefandoorn commented on July 27, 2024

Some progress being made in #81. Not sure it's the best solution though.

from syliusimportexportplugin.

Related Issues (20)

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.