[DC-791] [PostgreSQL] In case model is build from existing database sequence name is invalid and doctrine throw exception Created: 16/Jul/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: Przemysław Ciąćka Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

symfony 1.4.5, postgresql 8.4, debian lenny, nginx


Attachments: PNG File doctrine.png    

 Description   

Firstly I created database directly in postgresql.
After that I generated schema from existsing database and after all i built model.

When I try to insert new record to database I received following error:

sequence "Category_id_seq" does not exist

In schema file sequence name is defined like this: sequence: '"Address_id_seq"'
There's are apostrophes and quotes.

In Category model file is same like above, apostrophes and quotes.

When I remove quotes from sequence in model files everything is ok and there're no problems with insert new row to database.



 Comments   
Comment by Enrico Stahn [ 13/Aug/10 ]

There are 2 solutions to your problem. The first is to change the sequence name in the schema, the second is to change the doctrine configuration.

The default behavior of doctrine is to add a "_seq" to each sequence name. If you remove this part from you sequence name then it sould work as expected. The second option is to change the behavior of doctrine with the following configuration parameter:

 
Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, '%s'); 

default: Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, '%s_seq');

Comment by Przemysław Ciąćka [ 25/Aug/10 ]

Problem are quotes in sequence name.
Sequence names in schema built from existing database have quotes in their names, e.g ' "Address_seq" ' and Doctrine try to execute sequence with quotes but in database names exist without quotes.

Temporarly I fixed it by add str_replace() into importer from PostgreSQL - now in schema sequence names are without quotes.





[DC-980] Moving all ALTERS queries to the end of generated sql file (task build-sql) Created: 04/Mar/11  Updated: 04/Mar/11

Status: Open
Project: Doctrine 1
Component/s: Cli, Schema Files
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Critical
Reporter: Sergey Eremenko Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File Export.php    

 Description   

Actual in case of using multi database configuration and foreign keys between them.

Now build-sql task generates SQL query for database by database in alphabetical order. It's ugly when we have multidatabase configuration and foreign keys between their tables. It's impossible to do 'import-sql' without errors beucase foreign keys constrains to nonexisting tables are in next database in order.

I have added some code to strings 1176-...






[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:
connection: other
columns:
name: {}
size: {}

and inherited model:

Box:
inheritance:
extends: Entity
type: column_aggregation

Then file with base definition of Box does not contain bindComponent sentence to bind Box model with connection specified for Entity model.






[DC-991] Views abstraction model Created: 28/Mar/11  Updated: 28/Mar/11

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Documentation Priority: Major
Reporter: Jesus Farías Lacroix Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

all



 Description   

View abstraction model

Hi, i've been using doctrine from about six months, i'm not an expert but i know the basics and this has been enough for me and my web-app requirements. The problem begins cause i need a kind of "dynamic table model" in other words an specific one table's abstraction, i thought implement a view for this purpose, but i can't figure out how define the BaseModel for the view to use it like a table, thus allowing the use of methods like save(), find() and build (logicals) relationships with others entities. in few words: can i build a table model from a query/view?, it is possible? i read the posts from above but this issue still being not realy clear at all for me.

me realy will apreciate any help, thanks in advance.

Regards.






[DC-888] Foreign key id columns do not respect ATTR_DEFAULT_IDENTIFIER_OPTIONS Created: 13/Oct/10  Updated: 13/Oct/10

Status: Open
Project: Doctrine 1
Component/s: Migrations, Relations, Schema Files
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Tom Boutell Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Any



 Description   

Some time ago Jon Wage suggested that one can override the 8-byte default integer type for IDs by setting Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS in configureDoctrine (in a Symfony project), like this:

public function configureDoctrine(Doctrine_Manager $manager)

{ // Use 4-byte IDs for backwards compatibility with databases built on // Apostrophe 1.4, sfDoctrineGuard pre-5.0, etc. You don't need this for // a brand new site $options = $manager->getAttribute(Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS); $options['length'] = 4; $manager->setAttribute(Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS, $options); }

This works for primary key id columns. However it is not respected by foreign key id columns, which do not consult ATTR_DEFAULT_IDENTIFIER_OPTIONS.

I looked at working around this using ATTR_DEFAULT_COLUMN_OPTIONS, however it is not type-specific. So if you set a length of 4 with that option, it applies not just to all integers but also to dates, datetimes, booleans and many other things that definitely should not be 4 bytes.

The correct fix seems to be for foreign key id columns to respect ATTR_DEFAULT_IDENTIFIER_OPTIONS.

Also, ATTR_DEFAULT_COLUMN_OPTIONS should probably let you specify different defaults for each column type as the length option is basically not usable in its current form. But that would not be a particularly clean solution to the foreign key id problem since limiting non-ID integers to 4 bytes should not be necessary.

  • * *

The motivation for this bug report:

The new stable release of sfDoctrineGuardPlugin (for Symfony) does not specify an integer size as it formerly did, so the size of integers now defaults to 8 bytes. This breaks backwards compatibility with existing code that adds foreign key relationships to sfGuard objects like sfGuardUser, etc. Creating migrations to deal with changing this across all tables involved is quite difficult (all foreign key indexes must be dropped and recreated - doctrine:migrations-diff is unable to figure it out, understandably).






[DC-886] Doctrine should support mysql native float/double Created: 13/Oct/10  Updated: 13/Oct/10

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Severin Puschkarski Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

symfony 1.4.8 / mysql



 Description   

Doctrine does not support native mysql float/double. It always specifies float(18,2) which reduces precission to 2 decimals.
Although it is possible via
type: float(18), scale: 6
to enhance precission, I experience the side-effect, that for example 76.86 is now stored as 76.860001
This ugly formatted number shows up in every form, unless I make an effort to round every field accordingly.

I think doctrine should support mysql native float/double!






[DC-885] Building schema doesn't work when tables have cross database foreign keys (MySQL). Created: 12/Oct/10  Updated: 12/Oct/10

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Fabrice Agnello Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows XP SP3, Apache 2, PHP 5.3, MySQL 5.1.36, Symfony 1.4.8.



 Description   

When building schema using the doctrine:build-schena task from multiple databases used in our project, the import process end up with a "missing classname" error without building the schema.yml file.

This seems to be caused by the fact that the tables contained in the databases contain foreign keys referencing the other databases tables pks.

As an example we have :

  • A main database (call it portal) that contains user's informations, and many other things.
  • a second database that contains business informations with some tables refererecing users informations contained in the main database.

When generating the schema, and specifically on the second database step, there are no informations found for the primary keys contained main database.

Digging in the import process, it seems that the issue comes from the fact that the Doctrine_Import.importSchema function creates a new definition array instance for every database encountered in the databases.yml.

The correction found for this was to take the array() creation one level up before the connections traversing.

original code :
public function importSchema($directory, array $connections = array(), array $options = array())
{
$classes = array();

$manager = Doctrine_Manager::getInstance();
foreach ($manager as $name => $connection) {
// Limit the databases to the ones specified by $connections.
// Check only happens if array is not empty
if ( ! empty($connections) && ! in_array($name, $connections))

{ continue; }

$builder = new Doctrine_Import_Builder();
$builder->setTargetPath($directory);
$builder->setOptions($options);

$definitions = array(); // <<<<<<<<<<<<<<<<<<< STAYING THERE CAUSES THE "MISSING CLASSNAME" ERROR

foreach ($connection->import->listTables() as $table) {
......

modified code :

public function importSchema($directory, array $connections = array(), array $options = array())
{
$classes = array();

$manager = Doctrine_Manager::getInstance();
$definitions = array(); // <<<<<<<<<<<<<<<<<<PUT HERE

foreach ($manager as $name => $connection) {
// Limit the databases to the ones specified by $connections.
// Check only happens if array is not empty
if ( ! empty($connections) && ! in_array($name, $connections)) { continue; }

$builder = new Doctrine_Import_Builder();
$builder->setTargetPath($directory);
$builder->setOptions($options);

foreach ($connection->import->listTables() as $table) {
.......






[DC-858] Custom Behaviors/Templates cause autoloader errors Created: 04/Sep/10  Updated: 04/Sep/10

Status: Open
Project: Doctrine 1
Component/s: Behaviors, Schema Files
Affects Version/s: 1.2.1, 1.2.2, 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: apric Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows Vista/7
PHP 5.3.1 - 5.3.3
Zend autoloader
not occuring under Ubuntu 10.05 / MacOSX



 Description   

When emitting Behaviors from schema files (YAML in our case),
Doctrine expects a shortened class name of the behavior (e.g. 'Timestampable') instead of the full class name:
The string 'Doctrine_Template_' is automatically prepended and a check (class_exists()) is made.

This is leading to possible autoloader errors (in our case: Zend autoloader does not find our custom behavior):

YAML:

{{
Person:
actAs: [SoftDelete, My_Doctrine_Template_CustomBehavior]
...
}}

'SoftDelete' is the short class name of 'Doctrine_Template_SoftDelete'.
'My_Doctrine_Template_CustomBehavior' is the full class name and shall not be prefixed with 'Doctrine_Template_'.

The corresponding section responsible for this bug:

File: Doctrine/Import/Builder.php
Lines: 702-704, function emitAssign()

{{
if (class_exists("Doctrine_Template_$name", true))

{ $classname = "Doctrine_Template_$name"; } }}

There is no test whether a full class name is given as $name, so there is no way to add custom behaviors to records without the autoloader checking for a non-existing class and spilling errors/notices.
With the above YAML schema file it would test for class_exists('Doctrine_Template_My_Doctrine_Template_CustomBehavior'), which is obviously not existing.

a quick fix could look like this:

{{
if (strpos($name, '_') === false // is this a shortened name of an original Doctrine behaviour class?
&& class_exists("Doctrine_Template_$name", true)) { $classname = "Doctrine_Template_$name";}}}

Another alternative (but breaking compatability with existing schema files) would be to always use full class names instead of fancy short names.

Interestingly enough, this error is only occuring with Zend autoloader on Windows systems, but can be easily avoided with the fix like suggested above.



 Comments   
Comment by Jonathan H. Wage [ 04/Sep/10 ]

I believe this is because the Zend autoloader does not fail silently by default. I think it can be configured to check if the file exists and not throw any errors.





[DC-849] Error Generate Schema.yml Database Oracle Created: 31/Aug/10  Updated: 31/Aug/10

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: fernando guerrero Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 10.4, Oracle



 Description   

Some deleted records are genereated by the Oracle driver, the following patch solves the problem, found with .... alexia.velasquez@hotmail.es, vtamara@pasosdeJesus.org, jeronimo0000@gmail.com

— Doctrine/Import/Oracle.php.orig 2010-08-31 11:01:10.934142453 -0500
+++ Doctrine/Import/Oracle.php 2010-08-31 11:01:35.778661707 -0500
@@ -118,7 +118,7 @@
SELECT tc.column_name, data_type,
CASE WHEN data_type = 'NUMBER' THEN data_precision ELSE data_length END AS data_length,
nullable, data_default, data_scale, data_precision, pk.primary
-FROM all_tab_columns tc
+FROM user_tab_columns tc
LEFT JOIN (
select 'primary' primary, cc.table_name, cc.column_name from all_constraints cons
join all_cons_columns cc on cons.constraint_name = cc.constraint_name
@@ -252,4 +252,4 @@
$query = 'SELECT view_name FROM sys.user_views';
return $this->conn->fetchColumn($query);
}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}



 Comments   
Comment by Jonathan H. Wage [ 31/Aug/10 ]

Hi, the formatting is a bit unreadable. Can you fork http://github.com/doctrine/doctrine1 and send a pull request?





[DC-833] Data type in YAML schema spacing issue Created: 18/Aug/10  Updated: 18/Aug/10

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Danny Kopping Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 7, Apache 2.2.11, PHP 5.2.9, MySQL 5.1.36



 Description   

When creating a column in a table in a YAML schema file, the following two scenarios produce different results:

Model:
columns:
...
some_numeric:
type: integer(3)
....
__________________________
Model:
columns:
...
some_numeric:
type: integer (3)
....

Please note the spacing in the second example before the (3) in the type definition. The first example will generate a mediumint in MySQL with a length other than 3, while the second example works as expected.



 Comments   
Comment by Danny Kopping [ 18/Aug/10 ]

The formatting for the YAML didn't come out right through JIRA, I apologize for that





[DC-400] bit(1) columns are broken Created: 06/Jan/10  Updated: 11/Apr/11

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Rory McCann Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 9.10 php 5.2 mysql 5.1, all installed with ubuntu's apt



 Description   

Ihave the following Doctrine schema:


TestTable:
columns:
bitty: bit(1)

I have created the database and table for this. I then have the following PHP code:

$obj1 = new TestTable();
$obj1['bitty'] = b'0';
$obj1->save();

$obj2 = new TestTable();
$obj2['bitty'] = 0;
$obj2->save();

Clearly my attempt is to save the bit value 0 in the bitty column.

However after running this PHP code I get the following odd results:

mysql> select * from test_table;
---------+

id bitty

---------+

1  
2  

---------+
2 rows in set (0.00 sec)

mysql> select * from test_table where bitty = 1;
---------+

id bitty

---------+

1  
2  

--------+
2 rows in set (0.00 sec)

mysql> select * from test_table where bitty = 0;
Empty set (0.00 sec)

Those boxes are the 0x01 character, i.e. Doctrine has set the value to 1, not 0.

However I can insert 0's into that table direct from MySQL:

mysql> insert into test_table values (4, b'0');
Query OK, 1 row affected (0.00 sec)

mysql> select * from test_table where bitty = 0;
---------+

id bitty

---------+

4  

---------+
1 row in set (0.00 sec)

See also this question on StackOverflow http://stackoverflow.com/questions/2008021/php-doctrine-orm-not-able-to-handle-bit1-types-correctly






[DC-359] concrete inheritance doesn't create all relations Created: 14/Dec/09  Updated: 16/Dec/09

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: 1.2.0, 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Juan Vega Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.2.11 (cli) (built: Oct 5 2009 21:36:09)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans

Server version: Apache/2.2.13 (Unix)

Server version: 5.1.38-log MySQL Community Server (GPL)


Attachments: File fix-dc-359.diff     PNG File Picture 1.png    

 Description   

This is the YML schema

Entity:
  actAs:
    Timestampable:
  columns:
    id:
      type: integer(11)
      primary: true
      autoincrement: true
    name: string(50)
  relations:
    DynamicFields:
      class: DynamicField
      local: id
      foreign: dynamic_field_id
      refClass: EntityDynamicFields

DynamicField:
  actAs:
    I18n:
      fields: [name_xml]
  columns:
    id:
      type: integer(11)
      primary: true
      autoincrement: true
    name_xml: 
      type: string(50)
      notnull: true
  relations:
    Entities:
      class: Entity
      local: dynamic_field_id
      foreign: id
      refClass: EntityDynamicFields

EntityDynamicFields:
  actAs:
    I18n:
      fields: [value_xml]
  columns:
    id:
      type: integer(11)
      primary: true
    dynamic_field_id:
      type: integer(11)
      primary: true
    value_xml: string(250)

Airline:
  inheritance:
    extends: Entity
    type: concrete

Bank:
  inheritance:
    extends: Entity
    type: concrete

Client:
  inheritance:
    extends: Entity
    type: concrete

Employe:
  inheritance:
    extends: Entity
    type: concrete

Host:
  inheritance:
    extends: Entity
    type: concrete

Partner:
  inheritance:
    extends: Entity
    type: concrete

Person:
  inheritance:
    extends: Entity
    type: concrete

Supplier:
  inheritance:
    extends: Entity
    type: concrete

I run the commands

./doctrine build-all

and

./doctrine rebuild-db

The problem is when I verify if the foreign keys are created, but
these were only created for the "client" and "employee" models, to
"host" does not create the relationship in the MySQL, but if I rename
"host" with a name like "Ent", the relationship is established, or if I rename
the parent model "Entity" to "Zzzzz", all relations are created.

I did several tests, and the only way that the relation is created, is
that the model name, is alphabetically sorted before the parent model name.

This is a part of the dump of MySQL

ALTER TABLE `entity_dynamic_fields`
  ADD CONSTRAINT `entity_dynamic_fields_dynamic_field_id_dynamic_field_id` FOREIGN KEY (`dynamic_field_id`) REFERENCES `dynamic_field` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_airline_id` FOREIGN KEY (`id`) REFERENCES `airline` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_bank_id` FOREIGN KEY (`id`) REFERENCES `bank` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_client_id` FOREIGN KEY (`id`) REFERENCES `client` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_employe_id` FOREIGN KEY (`id`) REFERENCES `employe` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_entity_id` FOREIGN KEY (`id`) REFERENCES `entity` (`id`);

The other foreign keys are missed

you can view the diagram EER created with reverse engineering of MySQL Workbench



 Comments   
Comment by Juan Vega [ 15/Dec/09 ]

I know where is the problem, in Doctrine_Core::loadModels the list of models returned are alphabetically sorted, if I can rearrange the array by inheritance, the foreign keys for the models ('host' 'partner' 'person' 'supplier') are created.

more explicity:

I have this

Array
(
    [0] => Airline
    [1] => Bank
    [2] => Client
    [3] => DynamicField
    [4] => Employe
    [5] => Entity
    [6] => EntityDynamicFields
    [7] => Host
    [8] => Partner
    [9] => Person
    [10] => Supplier
)

I need this

Array
(
    [0] => Entity
    [1] => Airline
    [2] => Bank
    [3] => Client
    [4] => Employe
    [5] => Host
    [6] => Partner
    [7] => Person
    [8] => Supplier
    [9] => DynamicField
    [10] => EntityDynamicFields
)
Comment by Juan Vega [ 16/Dec/09 ]

ok, this is my patch to rearrange the models loaded, this array puts the child models before the parents





[DC-287] Schema: package property for model Created: 25/Nov/09  Updated: 08/Jun/10

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Mickael HOAREAU Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File DC-287.patch    

 Description   

There is a property "package" for the schema.yml file.
http://www.doctrine-project.org/documentation/manual/1_0/en/yaml-schema-files#features-examples:packages

But this should be used only for plugin symfony.

It will be good to have the same feature for classic model (not plugin), to be available to organize the model inside of the model folder.

This feature is critical for huge project. Indeed having 200 files at the root of the folder model/doctrine is very difficult to maintain.



 Comments   
Comment by Mickael HOAREAU [ 25/Dec/09 ]

Here a possible patch for doctrine 1.2, it is working for the basic cases.

It probably needs to be improved.

Comment by Jonathan H. Wage [ 15/Mar/10 ]

I agree this is a problem, but your patch is not good. It doesn't follow the coding standards and has some formatting problems. Also, it doesn't seem like a good solution. What do you think?





[DC-948] 3 underscores in my yaml file lead to error Created: 09/Dec/10  Updated: 09/Dec/10

Status: Open
Project: Doctrine 1
Component/s: Schema Files
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Lawrence Krubner Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:54:29 UTC 2009

Symfony 1.4



 Description   

I had this yaml:

OldAppellations:

connection: doctrine

tableName: old_appellations

columns:

appellations___sql:

{ type: text }

appellationsapcode_sql:

{ type: text }

appellationsappellation_sql:

{ type: text }

appellationscolor_sql:

{ type: text }

appellationscountry_sql:

{ type: text }

appellationsregion_sql:

{ type: text }

appellationsregion_for_link_sql:

{ type: text }

appellationssubt_sql:

{ type: text }

appellationstaster_appel_sql:

{ type: text }

appellationstotal_r_sql:

{ type: text }

appellationstype_sql:

{ type: text }

export_record_id_sql:

{ type: text }

I got this error:

Notice: Undefined index: o__appellations in /home/lkrubner/dev/tastingnotes/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 302
Notice: Undefined index: in /home/lkrubner/dev/tastingnotes/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 303
Fatal error: Call to a member function getFieldName() on a non-object in /home/lkrubner/dev/tastingnotes/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 304

Then I changed the 3 underscores to 1:

appellations_sql:

{ type: text }

I rebuilt the model and the error was gone.

More details and screenshots are here:

http://www.symfonyexperts.com/question/show/id/178






[DC-864] Generating YAML schema from model should pick up also charset, collate and other options Created: 10/Sep/10  Updated: 10/Jan/11

Status: Open
Project: Doctrine 1
Component/s: Import/Export, Schema Files
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Peter Helcmanovsky Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File Export_Schema.patch    

 Description   

I did change Doctrine/Export/Schema.php to pick up some options from model, then they get exported into YAML schema by current code.

Adding the patch. (sorry, can't run the tests, so I'm not sure whether it does break something, really shouldn't)

In my project it works just as expected (did need it for the way I do migrations).

TODO for Doctrine devs:

  • run tests with my patch and let me know if there's a problem
  • consider other option names, which are worth of export, so far I did need "charset" and "collate", and I added "queryParts" as well.

I hope my additions make sense and will help you to improve Doctrine project. (and that you will include it, so I don't have custom modified Doctrine )



 Comments   
Comment by Peter Helcmanovsky [ 10/Jan/11 ]

By hunting down an eluding bug I figured out (i.e. by hard way) that the indexes are dropped as well during YAML generation.

I will do another pull request on github including another 3 lines to fix that...

I see this issue is ignored anyway by core devs.





[DC-776] $record->link('Alias', $id) throws an exception because of getIdentifier returns array, not string Created: 05/Jul/10  Updated: 05/Jul/10

Status: Open
Project: Doctrine 1
Component/s: Record, Relations, Schema Files
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Viktoras Bezaras Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Symfony 1.4.6-DEV


Sub-Tasks:
Key
Summary
Type
Status
Assignee
DC-775 $record->link('Alias', $id) throws an... Sub-task Resolved Jonathan H. Wage  

 Description   

I want to bookmark ads on my site. So i have Ads table, users table (sfDoctrineGuard) and a refclass Bookmarks. I've created an ajax link to an action, where i retrieved $ad object, $user_id and
$ad->link('Bookmarks', $user_id, true);
So I expected a record in a database to be created.

Bookmarks:
...
columns:
user_id:

{ type: integer(4), primary: true }

ad_id:

{ type: integer(4), primary: true }

relations:
sfGuardUser:

{ onDelete: CASCADE, local: user_id, foreign: id }

Ads:

{ onDelete: CASCADE, local: ad_id, foreign: ad_id }

As my Bookmarks table has 2 primary keys in the link method

if (count($ids) > 0)

{ $q->whereIn($rel->getTable()->getIdentifier(), array_values($this->identifier())); }

$rel->getTable()->getIdentifier() returned me an array('user_id', 'ad_id') instead of a string. So the query which was generated looked like
UPDATE bookmarks SET ad_id = ? WHERE (Array IN )
And Array is not the name of a column.

My schema:
http://pastie.org/private/2lr9gy1h3mtdwdsiwrwylq

I've solved an issue by creating a new Bookmark instance and saving it, but i presume that issue might distract someone.






[DC-752] Data type "decimal" can be unsigned in MySQL 5.0 Created: 18/Jun/10  Updated: 18/Jun/10

Status: Open
Project: Doctrine 1
Component/s: Native SQL, Schema Files
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ilya Sabelnikov Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS: FreeBSD 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 amd64
PHP: 5.2.13 (cli) (built: May 6 2010 01:51:58), Zend Engine v2.2.0, with Xdebug v2.0.5
Symfony: 1.4.6-DEV (/web/vendor/symfony/1.4-svn/lib)
MySQL: Ver 14.14 Distrib 5.1.46, for portbld-freebsd8.0 (amd64) using 5.2



 Description   

I have found in official docs of MySQL v5.0:

Decimals can be unsigned: DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]

Here above is my "schema.yml" file:

schema.yml
 
Project:
  columns:
    id:
      type: integer(4)
      unsigned: true
      primary: true
      autoincrement: true
    salary_range_from:
      type: decimal(12)
      scale: 2
      unsigned: true

After i run:

./symfony doctrine:build --all

my "schema.sql" is:

schema.sql
 
CREATE TABLE `project` (
  `id` INT AUTO_INCREMENT, 
  `salary_range_from` DECIMAL(12, 2), 
  INDEX `company_id_idx` (`company_id`), PRIMARY KEY(`id`)
) DEFAULT CHARACTER SET utf8 ENGINE = INNODB;





[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: File sample.yaml    

 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.
Inherited tables should be able to set their own NOT NULL columns without affecting other tables in the inheritance tree (should be handled in the preSave() method? or is there another mechanism?)



 Comments   
Comment by luke scott [ 11/Jan/10 ]

YAML format was destroyed during copy & paste!
I'm attaching the sample yaml, instead of including it in the description





Generated at Thu Nov 27 06:45:51 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.