[DC-924] type mismatch for keyfield in column aggregation Created: 11/Nov/10 Updated: 11/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Arnaud Morvan | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PostgreSQL |
||
| Description |
|
This is the doc exemple on column aggregation inheritance : Entity: User: Group: But the keyField (type) is created as VARCHAR(255) so PostgreSQL return an error on applying inheritance condition : SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying = integer I found this with symfony sfFilebasePlugin on sfFilebase:create-root task. |
[DC-1015] bindComponent not called before inherited classes base definitions Created: 04/Jul/11 Updated: 04/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance, Schema Files |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Adrian Nowicki | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
symfony 1.4 |
||
| Description |
|
If I define a base model: Entity: and inherited model: Box: Then file with base definition of Box does not contain bindComponent sentence to bind Box model with connection specified for Entity model. |
[DC-619] preHydrate/postHydrate events do not use proper sub-class component Created: 06/Apr/10 Updated: 14/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance, Record |
| Affects Version/s: | 1.2.0, 1.2.1, 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Matt Lehner | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.2.11 (cli), Doctrine 1.2 (Revision: 7537) |
||
| Description |
|
I am trying to use preHydrate/postHydrate with my models that use inheritance. The problem is that when using the parent table is used to query the records, the preHydrate/postHydrate events are passed to the parent record class instead of the proper sub-class for the current record. Using the example schema below, if I do a findAll() on the Person table and it contained two Student records and one Professor record... preHydrate would get called on Person instead of Student and Professor. This also applies for any listeners that are registered on Student/Professor and not Person. Person: Student: Professor: |
[DC-614] Separate the properties of the parent and the children Created: 02/Apr/10 Updated: 02/Apr/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Thomas Tourlourat - Armetiz | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I want to talk about the inheritance, simple type and columns_aggregation. Here an example of parent classes and two sub-classes : http://pastebin.com/5qJKtgp1 To sum up : The parent class is Show, and the sub-classes are Video and Playlist.
The problem that appear with the generated models, Is that the following code is working. Or, the POO concept want that the filename property doesn't exist/available on a Playlist object. And Doctrine should throw an Exception ! Or, It is not the case. The solution is to move the generated code of the sub-classes into there own classes. The problem with the one-to-one or many-to-many relationship is still the same. The solution is more POO compliant. |
[DC-536] Duplicate CREATE TABLE entries in schema.sql when using column_inheritance Created: 02/Mar/10 Updated: 18/Nov/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | webPragmatist | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
MySQL 5 / PHP 5.3.1 / Symfony 1.4.3 (branch) / Doctrine 1.2.1 / Mac OSX |
||
| Attachments: |
|
| Description |
|
When creating a model involving column_inheritance the CREATE TABLE statement gets duplicated. The second CREATE TABLE include an index for the keyField. Test doctrine generated models and generated schema.sql attached. |
| Comments |
| Comment by webPragmatist [ 02/Mar/10 ] |
|
It seems this issue is related to using array_unique() and databases which doctrine creates index along with the CREATE TABLE statement. This does not occur on sqlite as shown above in the console-log.txt (this db uses the CREATE INDEX statement). |
| Comment by Svetoslav Shterev [ 02/Mar/10 ] |
|
Yes, it seems SQL CREATE TABLE statements are generated for each of the children as well, but with sqlite, array_unique() filters out the ones that are "extra". |
| Comment by Tom Boutell [ 07/May/10 ] |
|
We're seeing this issue too. doctrine:build --all --and-load works fine, but doctrine:build-sql generates duplicate CREATE TABLE statements. Our in-house workflow is the former, so the latter came as a surprise. Is there any sign of progress on this one? |
| Comment by Sebastian Schulze [ 07/Jul/10 ] |
|
This looks like a Duplicate of DC-123. |
| Comment by Hany el-Kerdany [ 18/Nov/10 ] |
|
A little addition to the symptoms of this problem. If the one of the child classes has a foreign key to another entity, another Third Create table SQL will be created, which contains the an index on the foreign key column. In other words, it seems that an additional create table statement is created for each automatically created index. An illustration is in the attached yml and sql schema: Tom Boutell: doctrine:build --all generates the problem with me! |
[DC-778] Aggregate column becomes NULL when using TableClass->create(array(...)) Created: 08/Jul/10 Updated: 01/Sep/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Dennis Verspuij | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I use aggregate column inheritance, say B extends A, and create a new record instance of B using BTable->create(array(...values...)). But due to changeset [7618] this fails to set the aggregate column value to the value assigned for B, it becomes NULL. |
| Comments |
| Comment by Jonathan H. Wage [ 01/Sep/10 ] |
|
Can you provide some more information and/or a test case? |
[DC-418] Inherited models creating NOT NULL restrictions on their parents Created: 11/Jan/10 Updated: 11/Jan/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Attributes, Inheritance, Record, Schema Files |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | luke scott | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux skywalker-9 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 17:01:44 UTC 2009 x86_64 GNU/Linux |
||
| Attachments: |
|
| Description |
|
to reproduce, create the yaml included in sample.yaml (Note the not-null columns in each subclass) if you try to save an OnlineProduct without setting copyright_year, or if you create a print_product without setting website_branding_id, then you will get a not null error. |
| Comments |
| Comment by luke scott [ 11/Jan/10 ] |
|
YAML format was destroyed during copy & paste! |
[DC-607] Doctrine concrete inheritance link between tables Created: 30/Mar/10 Updated: 21/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Julien Chiron | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Symfony 1.4.3, php5.3.0 (snow leopard version) |
||
| Description |
|
Hi, I pointed out a strange problem: Batch:
columns:
code: string
is_pure: boolean
Flask:
columns:
batch_id: integer
code: string
quantity: integer
relations:
Batch:
local: batch_id
foreign: id
foreignType: many
ProducedBatch:
inheritance:
type: concrete
extends: Batch
columns:
production_date: date
BoughtBatch:
inheritance:
type: concrete
extends: Batch
columns:
supplier: string
ProducedFlask:
inheritance:
type: concrete
extends: Flask
columns:
weight: integer
BoughtFlask:
inheritance:
type: concrete
extends: Flask
columns:
price: integer
The problem occurs when I try to populate the database. ProducedBatch:
B1:
code: Batch1
ProducedFlask:
F1:
Batch: B1
code: Flask1
When loading fixtures, I get a Invalid row key specified: (batch) B1, referred to in (produced_flask) F1 In fact, Doctrine doesn't take into account the primary key inherited from Flask table. The only solution to solve this is to set a relationship between each couple of sub-table (ProducedFlask -> ProducedBatch and BoughtFlask -> BoughtFlask). |
| Comments |
| Comment by TD [ 21/Jul/10 ] |
|
It is very strange that the doctrine inheritance system don't inherite all the relationship of the mother-table on all sub-table. I think that it will be a very good improvement to fix this problem. For example if you are this model : Unable to find source-code formatter for language: yml. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
motherTable:
columns:
code: string
relationTable_id: integer
relation:
relationTableRelation:
local: relationTable_id
foreign: id
type: one
subTable:
inheritance:
type: concrete
colums:
name: string
relationTable:
columns:
code: integer
relations:
motherTableRelation:
local: id
foreign: relationTable_id
type: many
In this example, the relationTableRelation will be inherited, it is good but the other side of the relation in relation table will always go on motherTable and not on subTable, but motherTable is always empty, moreover subTable don't share its ID with motherTable, so this side of the relationship is unusefull because we can find subTable element in relation with a relationTable element. It will be good to find a solution to this issue |
[DC-464] [Inheritance] Couldn't save record with inheritance by a relationship if the record has no column modified (solution proposed) Created: 29/Jan/10 Updated: 09/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Inheritance |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Colin Darie | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Please consider the following TestCase Inheritance with no property setted, saved by relationship class Doctrine_Ticket_DC464_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { $this->tables[] = 'Ticket_DC464_Entity'; $this->tables[] = 'Ticket_DC464_Article'; $this->tables[] = 'Ticket_DC464_User'; $this->tables[] = 'Ticket_DC464_Group'; parent::prepareTables(); } public function testTest() { $User = new Ticket_DC464_User(); $Article = new Ticket_DC464_Article(); $Article->title = 'my first article'; $Article->Author = $User; $Article->save(); $UserFetched = Doctrine::getTable('Ticket_DC464_User')->find(1); $this->assertTrue($UserFetched instanceof Ticket_DC464_User); //$this->assertEqual($UserFetched->type, 1); } } class Ticket_DC464_Entity extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id', 'integer', 11, array('autoincrement' => true, 'primary' => true)); $this->hasColumn('facultative_field', 'string', 255); $this->hasColumn('type', 'string', 255); $this->setSubClasses(array( 'Ticket_DC464_User' => array('type' => 1), 'Ticket_DC464_Group' => array('type' => 2), )); $this->option('type', 'InnoDB'); } public function setUp() { } } class Ticket_DC464_User extends Ticket_DC464_Entity { } class Ticket_DC464_Group extends Ticket_DC464_Entity { } class Ticket_DC464_Article extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id', 'integer', 11, array('autoincrement' => true, 'primary' => true)); $this->hasColumn('title', 'string', 30); $this->hasColumn('author_id', 'integer', 11); $this->option('type', 'InnoDB'); } public function setUp() { $this->hasOne('Ticket_DC464_User as Author', array( 'local' => 'author_id', 'foreign' => 'id')); } } Notice that in the test, the $User instance has no property setted (in fact in this test, the "useless_field" in the model is... useless). This test fails (the $User object is not saved) because the method UnitOfWork->saveRelatedLocalKeys() - called in saveGraph(), itself called by $Article->save() - returns false because no column has been modified (line 395). To fix this, the Record->assignInheritanceValues() should be executed in top of isModified(), or for each related object in UnitOfWork->saveRelatedLocalKeys() (and probably UnitOfWork->saveRelatedForeignKeys() too). I've attached the test. |
| Comments |
| Comment by Colin Darie [ 30/Jan/10 ] |
|
Fix test with the right prefixes |
| Comment by Jonathan H. Wage [ 15/Mar/10 ] |
|
Do you have a patch for the issue too? |
| Comment by Colin Darie [ 16/Mar/10 ] |
|
Hi, no I doesn't have a patch for this, because I was not sure what the best way to solve this. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
Can you provide a patch for that change then so I can see it and test it? Thanks, Jon |
| Comment by Colin Darie [ 09/Jun/10 ] |
|
I've attached the patch. Once again, this patch fix the issue but there is maybe a better way to fix it to avoid the assignInheritanceValues() at each time. Thanks. |