We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Two Tables, One Model

My database is set up with a main table, and a few subtype tables. Something Like this:

Vehichle -id -vin

Car -vehichle_id -color

Motorcycle -vehichle_id -cylinders

All the relationships to everything else in the database happens through the Vehichle table. I want to setup up a Car model that has the data from the vehichle table and the car table baked in. The obvious solution I see would be to make the car Model's table be "Vehichles" and then give it a hasOne relationship to Car. All my data would be there, but it would be awkward to use $mycar->vin to get the vin and $mycar->car->color to get the color.

Is there any way I can set things up so that I can call $mycar->color AND $mycar->vin?