[Closed] Why are the properties in entity in opposite order

0 votes
asked Mar 24, 2015 in Solved by PaddyLock (310 points)
edited Oct 13, 2015 by ludek.vodicka

Why are the properties in the generated entity created in opposite order to that shown in the table view in Skipper? Can I control this?

commented Mar 24, 2015 by ludek.vodicka Skipper developer (140,450 points)

Not sure which properties do you mean. Can you post some screenshot and example of generated entity?

commented Mar 24, 2015 by PaddyLock (310 points)

For example when editing the table in skipper I have the following fields

createdAt
updatedAt

when I export to ORM the generated entity (symfony2) has the properties in the opposite order like this

updatedAt
createdAt

However, even though they are at the end of the table in Skipper, they are placed in the middle of the other existing properties in the entity like so

/**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $transId;

    /**
     * @ORM\Column(type="datetime", nullable=false)
     * @Gedmo\Timestampable(on="update")
     */
    private $updatedAt;

    /**
     * @ORM\Column(type="datetime", nullable=false)
     * @Gedmo\Timestampable(on="create")
     */
    private $createdAt;

    /**
     * @ORM\Column(type="string", length=16, nullable=true)
     */
    private $postcode;

There doesn't seem to be any Rhyme nor reason to the order of the properties generated?

commented Mar 24, 2015 by ludek.vodicka Skipper developer (140,450 points)

This is really strange, because fields should be ordered by model.

Only way how this should happen is when each field is created and exported after previous field was already exported. In such cases all new fields are added to the end of file.

But when I just tried create simple entity and select export, I have a correct output:

Example

Can you try to export it to empty folder to test if properties will be ordered correctly?

commented Mar 24, 2015 by PaddyLock (310 points)

I have just done a test by deleting all the properties in the existing entity and then re-exporting from Skipper.

Here's the table:
enter image description here

And here is the resulting entity:

enter image description here

As you can see opposite order.

commented Mar 24, 2015 by ludek.vodicka Skipper developer (140,450 points)

This is strange. Can you please send me your project to [email protected] so I can test it here?

commented Mar 24, 2015 by ludek.vodicka Skipper developer (140,450 points)

Fixed in 3.1.2.1193 version (http://www.skipper18.com/en/download)

1 Answer

0 votes
answered Mar 30, 2015 by ludek.vodicka Skipper developer (140,450 points)
 
Best answer

Fixed in 3.1.2.1193 version (http://www.skipper18.com/en/download)

...