4
votes

hello I created the little "foo" api with the api-platform and I am now trying to use my own entities but I keep getting the 404 error no resources found.

I am following this tutorial: https://api-platform.com/docs/distribution/

Here is my entity

<?php

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;

/**
 * Job
 *
 * @ApiResource
 * @ORM\Entity
 */
class Job
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="title", type="string", length=100, nullable=false)
     */
    private $title;

    /**
     * @var string
     *
     * @ORM\Column(name="description", type="text")
     */
    private $description;

    /**
     * @var Location The location this job is about.
     *
     * @ORM\ManyToOne(targetEntity="Location", inversedBy="jobs")
     */
    private $location;

If anyone can help my out why this doesnt work I would realy appreciate it :)

Many thanks in advance!

2
maybe there is something wrong with your controller/route, can you show its code? - Francesco Borzi
Check out if you have the symfony's config.yml and parameters.yml correctly configured, and all the dependencies for api-platform in AppKernel - José Lozano Hernández
Check out if you have the symfony's config.yml and parameters.yml correctly configured, and all the dependencies for api-platform in AppKernel - José Lozano Hernández

2 Answers

4
votes

Most of the times after a modification on entity or creation of entity you have to run:

$ php bin/console cache:clear

in order the new changes to take effect. I still haven't found a way to disable cache for dev mode.

0
votes

I had the same problem when I had run my server with php -S localhost:8000 -t public and then I used symfony server:start, and with this worked as supposed to be