sonata-project / SonataPageBundle

This bundle provides a Site and Page management through container and block services
https://docs.sonata-project.org/projects/SonataPageBundle
MIT License
216 stars 209 forks source link

Entity is not recognised for new projects #1632

Closed eerison closed 1 year ago

eerison commented 1 year ago

I setup sonata page bundle 4.0 from scratch, But for some reason doctrine doesn't recognized the entities

for example

<?php

declare(strict_types=1);

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Sonata\PageBundle\Entity\BasePage;

#[ORM\Entity]
#[ORM\Table(name: "page__page")]
class SonataPagePage extends BasePage
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: 'integer')]
    protected $id;
}

commands to check the diff

output

[OK] Nothing to update - your database is already in sync with the current entity metadata. 
[OK] Up-to-date! No migrations to execute. 

Database

Screenshot 2022-10-24 at 12 34 11

error when I open the page

Unable to find the mapping information for the class App\Entity\SonataPageSite. Please check the `auto_mapping` option (http://symfony.com/doc/current/reference/configuration/doctrine.html#configuration-overview) or add the bundle to the `mappings` section in the doctrine configuration.
eerison commented 1 year ago

I tried to add this mapping https://symfony.com/doc/current/reference/configuration/doctrine.html#configuration-overview

doctrine:
    orm:
        auto_mapping: true
        mappings:
            SonataPageBundle:
                type: xml
                dir: 'Resources/config/doctrine'

But I'm getting the same issue

eerison commented 1 year ago

Ok it's an issue in doctrine! it's happening for all entities not just page bundle :)