How to stop doctrine trying to create a table for a view that has been mapped on an entity?

Viewed 4571

How I can stop symfony trying to create the table for the view I created on a doctrine migration?

Entity mapping the view

/**
* Class TenancyPendingInspection
* @ORM\Entity(repositoryClass="DJABundle\PropertyVisit\Repository\TenancyPendingInspectionRepository", readOnly=true)
* @ORM\Table(name="view_tenancies_pending_inspections")
*/
class TenancyPendingInspection
{

I have as well the doctrine migration file.

Doctrine Configuration

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                [...]
                charset:   UTF8
                server_version:       5.6
                schema_filter: ~^(?!view_)~

Doctirne schema validate

php app/console doc:sch:val
[Mapping]  OK - The mapping files are correct.
[Database] FAIL - The database schema is not in sync with the current mapping file.

Doctrine schema update

php app/console doc:sch:update --dump-sql
CREATE TABLE view_tenancies_pending_inspections ...
3 Answers
Related