Doctrine ORM: create a table as another

Is there a way, using Doctrine, to create a table like the other? I know there is a function in MySQL:

CREATE TABLE user2 LIKE user;

and the user and user2 tables will be identical. Can this be done in the Doctrine?

+3
source share
3 answers

I assume that what you are looking for is to define (let use your example) the schematic level that user2inherits from userwhen creating your model. You can do this using the doctrine inheritance described in the documentation .

So in your schema.yml:

User:
  columns:
    name: string

User2:
  inheritance:
    extends: User
    type: concrete
  columns:
    something: int

user2 ( "" ), user. , , , , , .

+1

Doctrine : Doctrine_Record:: copy().

  $copy = $user->copy();

, copy() ( TDIRTY) . , copy (false).

$ copy = $ user-> copy (false) ;

0
source

Source: https://habr.com/ru/post/1721901/


All Articles