0 votes

Is it possible to display PHP attribute names instead of SQL column names in model?

I am using printouts of models as aid in my coding process. In code I use objects and object attributes and i don't have to worry about column names. So I would like to see attribute names instead of column names in my model. Is that possible? ORM was created so we can "think in objects" instead of tables and columns so I am expecting the same from ORM designer tool. :)

asked Feb 13, 2015 in Solved by dmijic (160 points)
recategorized Mar 19, 2015 by ludek.vodicka

1 Answer

0 votes

Skipper already works and displays PHP attribute names and not SQL column names. As you can see on following screenshot, the "name" is used to define PHP attribute name and "column" or "column_definition" is used to define SQL name and SQL definition:

Doctrine2 attribute editor

All ORM / PHP names are imported from schema files (XML/YML/PHP Annotations) as same as "column" definitions are imported from correspond fields.

In case you're seeing SQL names in the model, it means that you have incorrectly defined your own model and Skipper only visualize your data.

answered Feb 13, 2015 by ludek.vodicka Skipper developer (120,030 points)

Sorry, I was not clear enough.

Instead of PHP attribute names for associated entities column name is displayed:

enter image description here

In this example i see countryid instead of country and persontype_id instead of contactType which is the name of the actual collection.

You're right. For associations/relations there are currently displayed column names because of historical reason. Attribute names are defined via "Aliases" defined in association wizard/editor:

enter image description here

In latest version we made first code changes to support associations without columns (for MongoDB support) which was the first step to switch columns to background and display aliases (which can be defined for both directions) in entities.

Thanks, I manually defined my aliases using that dialog window in Skipper.

And I am really glad that Skipper is recognizing association as one-directional if only one alias is defined. That's great.

Great, I'm glad you solved it out.

Skipper recognizes one-way and two-way associations and for MongoDB there are supported also reversed associations (many-to-one, one-to-many and one-to-one).