I'm in the beginning stages of setting up an app in Symfony, and I'd
really like to use OO inheritance in the generated model classes.
I've got a test schema.yml set up like this:
---
AceResource:
tableName: ace_resource
columns:
id:
type: integer(4)
primary: true
autoincrement: true
institution_id:
type: integer(4)
identifier:
type: string(255)
title:
type: string(255)
Work:
tableName: work
inheritance:
extends: AceResource
columns:
display_creator:
type: string(255)
Basically, Work extends AceResource - and it works, it generates code
indicating that Work only hasColumn display_creator, and the rest are
contained in AceResource. My understanding from looking at Doctrine
documentation (http://www.phpdoctrine.org/index.php/documentation/
manual?chapter=relations#inheritance) is that the Work table should
only contain the unique subclass columns (and an id)... However, I'm
getting this SQL generated:
CREATE TABLE work (id INT AUTO_INCREMENT, institution_id INT,
identifier TEXT, title VARCHAR(255), display_creator VARCHAR(255),
PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE ace_resource (id INT AUTO_INCREMENT, institution_id INT,
identifier TEXT, title VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB;
... The Work table contains all of the columns. One of my big reasons
for trying to get this to work is I want to be able to select various
subclasses and easily order by columns contained in the AceResource
superclass. This is totally broken if it's duplicating columns
between subclasses...
Make sense? I'm currently testing against Symfony 1.0 and sfDoctrine
1.0. Is this fixed in the 1.1 version of sfDoctrine? It sounds like
that's the same except for the tasks, so maybe not? Or will this be a
bug until the new version of Doctrine is released? Or am I just doing
something wrong?
Overall I really like how the inheritance is implemented from an
object perspective, it's exactly what I want, but I would really like
the DB tables to reflect the documentation... Any clues?
-- Nate
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---