+2 votes


I think that I've asked this a few years from now. Just wanted to know if this is something you'll eventually plan or have in mind!


in Feature Request by (200 points)

1 Answer

0 votes


unfortunately there is a very low interest (~0.1% of users) in this feature so we decided to not to implement it right now. In case there will be larger interest we can implement it later.

Currently there is a small workaround how to support trait class:

  • add entity for your trait
  • export entity (class instead of trait will be used)
  • change class to trait and skipper will not touch it again.

Thanks for this you can see trait classes and export it.

by Skipper developer (141k points)

I'm not sure that I'm using traits like this. Here I'm using it to avoid code duplication.

Say for example you have an Timestampable entity:

class Foo {
    use TimeStampable;

Where timestampable is:

trait TimeStampable {
     * @ORM\Column(type="date")
    public $createdAt;

     * @ORM\Column(type="date")
    public $updatedAt;

In Skipper, you'll not see the two properties from the Trait.

I also encountered this situation. I created a Timestampable Trait, which contains the ORM column definitions for created and updated fields, plus getters and setters for them.

I then Use this trait within my Entities.

I as currently understand it, I would need to replace the instances of those Use statements with the code in the Trait in each Entity that currently uses the Trait, in order to let Skipper see these fields correctly?

I only used the Trait as a time saver and to know that all my Timestampable fields were always the same, so it's a small developer experience improvement, which would be great to be able to use as well as Skipper (I'm currently appraising if I can change all the trait uses acceptably which would mean I could use Skipper for our projects).

So it's small but it is the thing that's stopping me making an immediate purchase decision, if that's helpful feedback.


Skipper is currently not able to handle traits. Traits are Php constructs, not ORM constructs. Because of that, there is currently no way how to handle it in Skipper.

In case you want to handle @ORM fields in Skipper, it needs to be placed in the entity. You can freely place it in the trait, but it will not be visible in Skipper.

We are still considering traits, but as you can see based on this thread, there is the only small amount of users who use it. But such change would require huge changes in Skipper.

In case you're using traits only as a timesaver for Timestampable, I believe there is no issue when you will put these columns to trait. There will be no dependencies to these fields from an entity (associations, indexes,..), so it's not an issue.

On the other hand, instead of using traits, you can use new Skipper feature "Field templates", where you can define columns createdat and updatedat with one click from the entity editor:

enter image description here

These templates are fully customizable so you can define your own or update the existing ones.

Thanks for the reply and the suggestion of field templates - I think this may really be what I was aiming for with my use of Traits within the Entities.

As I was doing it 'by hand', I wanted some form of automation to make sure they were the same - it looks like Skipper can handle this using field templates, which might actually be preferable.


And in your case, maybe there is an even better solution. You can also template for all new/updated objects in Skipper


This means, you can predefine new entity template, that it will contain id, createdat, updatedat, uuid,... whatever you need.

So after creating a new entity, this entity can automatically contain any field, or attribute, index, etc.

Thanks for the extra information. In my case, I am using the Gedmo\Timestampable extension to handle the entity created/updated timestamps. So the full docblock annotation for eg the created at field is:

 * @var \DateTime $created
 * @Gedmo\Timestampable(on="create")
 * @ORM\Column(type="datetime")
private $created;

Is there a way to cause the entity template to include the @Gedmo\Timestampable(on="create") annotation?

You can create an entity template including Gedmo annotation.

It's still the same as when you add fields. The simplest way is to configure entity in Skipper, then user CTRL+C to copy full entity XML definition and paste it to template definition.

<?xml version="1.0"?>
  <entity name="\SampleEntity" local-name="SampleEntity" namespace="\" position-x="10" position-y="20" hdr-color="#D2D2D2" bg-color="#FFFFFF">
    <field name="id" type="integer" required="true" unique="true" primary="true" auto-increment="true"/>
    <field name="created_at" type="datetime" required="true"/>
    <field name="name" type="string" size="255"/>
      <attribute name="Gedmo">
        <attribute name="Timestampable">
          <attribute name="Fields">
            <attribute name="Field">
              <attribute name="Field">created_at</attribute>
              <attribute name="On">update</attribute>

I just wanted to throw out that I am interested in trait support as well. My preference would be to use traits over the current field templates, as I find the reduction of duplicated code extremely valuable to my own productivity.