I try to ignore two entities when I execute the command line doctrine:schema:update --force
in my project who is writing like this :
/**
* @ORM\Entity(readOnly=true)
* @ORM\Table(name="view_tableau_de_bord")
*/
class ViewTableauDeBord
{
//...
}
In my doctrine.yaml configuration file:
doctrine:
dbal:
default_connection: default
connections:
default:
url: '%env(resolve:DATABASE_URL)%'
driver: 'pdo_pgsql'
server_version: '12'
charset: utf8
schema_filter: ~^(?!view_)~
# ...
Doctrine keeps generating all entities while my views are in the schema_filter
. Do you have an explanation about this ? It's my first time with this option in a project.
Configuration du projet:
- Symfony 5.4.14
- PHP 7.4.26
- doctrine:orm: 2.13.3
- doctrine/annotations: 1.13.3
- doctrine/doctrine-bundle: 2.7.0
- doctrine/doctrine-migrations-bundle: 3.2.2
- symfony/doctrine-bridge: 5.4.14
- doctrine/data-fixtures: 1.5.3
CodePudding user response:
An entity marked with the flag readOnly=true
is not tracked for updates anymore but it is still possible to insert or delete rows, as explained in the documentation.
The doctrine:schema:update
command will still take the table into account to update the schema.
In the answers to the question "Ignore a Doctrine2 Entity when running schema-manager update" there are 3 valid options to ignore the entity from schema update.
CodePudding user response:
Your regex seems wrong.
Try "~^view_.*~"