P粉1868974652023-08-27 17:01:05
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.##.
doctrine:schema:update command will still take the table into account to update the schema.
「忽略 Doctrine2 實體執行架構管理器更新時」 有 3 個有效選項可以忽略架構更新中的實體。
P粉4550931232023-08-27 14:04:02
schema_filter
is not made to "filter" entity but to filter db table from doctrine awareness.
這是一個範例:
#
Assuming you manually create a table that is updated from a custom raw php cronjob called view_booking_by_customer_per_year
, this table is not used by your code in your project is table is not used by your code in your project for is yoursis project your project for.
DROP TABLE view_booking_by_customer_per_year; // NO I DONT WANT THISSo using
schema_filter you can tell doctrine to ignore this table in his validation and update process.
doctrine:schema:validate.
It will show
database is not in sync error.
一旦將其放入 schema_filter 中,錯誤就不會再發生。
doctrine:migration:diff and
doctrine:schema:update
schema_ignore_classes: - Reference\To\My\Class - Reference\To\My\OtherClass僅從 Doctrine 2.7 版本開始工作。 您可以在這裡找到完整的範例: #使用學說遷移
doctrine:migration:diff then
doctrine:migration:migrate instead of
doctrine:schema:update to performbase . It's ok for local dev, but when in production it is a very bad practice.
https://symfony.com/bundles/DoctrineMigrationsBundle/current/index.html #