Code Monkey home page Code Monkey logo

mukadi-doctrine-crud's People

Contributors

mbo2olivier avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

tlorens

mukadi-doctrine-crud's Issues

PostManager returns empty object

I'm using Mukadi Symfony and WordPress bundle and have everything running properly locally. My next step is to pull some posts from the database using Mukadi Doctrine CRUD, but when I make the call it appears nothing is being returned. I've created the constructor like this

use Mukadi\WordpressBundle\Manager\PostManager;

private $manager;
public function __construct(PostManager $manager)
    {
        $this->manager = $manager;
    }

but then I was getting autowiring error, so I added alias within services.yaml and error disappeared, like this

...
Mukadi\WordpressBundle\Manager\PostManager: '@mukadi_wordpress.manager.post'

and now when the default page loads, I want to grab post with ID = 1.

/**
 * @Route("/", name="default_index")
 */
    public function index()
    {
        $post1 = $this->manager->get(1);

        return new JsonResponse(
            [
                'action' => 'index',
                'post' => $post1
            ]);
    }

When I return this, I am getting empty object even though a post with ID = 1 exists in database. What connection can be missing? Later on, I modified a piece of the CRUD.php file to create a method that returns all of the posts in the database. Upon doing this, the JSON response contained an array of 10 empty objects, the amount of posts I have in the database. I added one more post as sanity check and refreshed and the count in the response updated. So, I am connected... but why are objects empty?

ACF Compatibility

Hi @mbo2olivier,
Is it possible to use your bundle with WP ACF plugin?
If yes, how?

Thanks by advance for your feedback.
Kind regards.

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.