Skipper is changing how an entity works from original import

0 votes
asked Aug 6, 2015 in General Questions by chateaux (550 points)
edited Aug 6, 2015 by chateaux

I am attempting to drive my apps db structure from skipper. To do this I need to get the app and skipper in sync.

My steps:

  1. Import app to skipper
  2. Export app from skipper to project
  3. View changes, if any, to files

A number of entities were changed during this process and all of them except one I am able to resolve.

On import the entitiy in question looks as such:

 /**
     * @var HierarchicalRoleInterface[]|\Doctrine\Common\Collections\Collection
     * @ORM\ManyToMany(targetEntity="RoleBasedUser\Entity\HierarchicalRole")
     * @ORM\JoinTable(name="rbu_roles_hierarchy")
     */
    protected $children = [];

    /**
     * @var PermissionInterface[]|\Doctrine\Common\Collections\Collection
     * @ORM\ManyToMany(targetEntity="RoleBasedUser\Entity\Permission", indexBy="name", fetch="EAGER")
     * @ORM\JoinTable(name="rbu_roles_permissions")
     */
    protected $permissions;

On export back to the app, immediately after import. It is changed to the following which does not work:

/**
 * @var HierarchicalRoleInterface[]|\Doctrine\Common\Collections\Collection
 * @ORM\ManyToMany(targetEntity="RoleBasedUser\Entity\HierarchicalRole")
 * @ORM\JoinTable(
 *     name="rbu_roles_hierarchy",
 *     joinColumns={@ORM\JoinColumn(name="HierarchicalRole_id", referencedColumnName="id")},
 *     inverseJoinColumns={@ORM\JoinColumn(name="HierarchicalRole_id", referencedColumnName="id")}
 * )
 */
protected $children = [];

/**
 * @var PermissionInterface[]|\Doctrine\Common\Collections\Collection
 * @ORM\ManyToMany(targetEntity="RoleBasedUser\Entity\Permission", indexBy="name", fetch="EAGER")
 * @ORM\JoinTable(
 *     name="rbu_roles_permissions",
 *     joinColumns={@ORM\JoinColumn(name="HierarchicalRole_id", referencedColumnName="id")},
 *     inverseJoinColumns={@ORM\JoinColumn(name="Permission_id", referencedColumnName="id")}
 * )
 */
protected $permissions;

Essentially I want it to be left alone, is there a way to prevent it form being changed on export?

1 Answer

0 votes
answered Oct 13, 2015 by ludek.vodicka Skipper developer (140,450 points)

Hi,

I checked your input and output schema files and both are equal. The only difference is that the second (exported) version contains full definition of join columns. Skipper always exports the most accurate version of schema files.

What exactly do you mean by that schema does not work?

In case your many-to-many database tables use different join columns, simply update these columns in Skipper model after import. But this is a normal import strategy which Skipper uses on all projects and we didn't receive any other report about such complication.

...