#012937: DatabaseSchema: ezcDbSchemaPersistentWriter, non increment id

Description:

When I try to generate presistent files from existing ezcDbSchema, in generated file isnt described type of ID (it cam be not only INT, but STRING also).
It will be very useful to save propertyName (in generated files) in camelCase. For example now, if I have a propety some_property (in schema) a name of this propety will be 'some_property' (not 'someProperty' ).
Sorry for my poor english :)


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


- Attachments

No attachments for this issue.


- Comments

For the second part of your issue I created the following enhancement request: http://issues.ez.no/12943url

But I do not understand the first part of your message. Could you please write this a bit more detailed, with perhaps an example?

#256524 by Derick Rethans on May 2nd, 2008 [Permanent Link]

Ok. Example:
lets create a "user" table, with non integer primary key.
CREATE TABLE `user` (
`email` CHAR( 64 ) NOT NULL ,
`name` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `email` )
) ENGINE = innodb;

After this lets generate persistent objects definition (using ezcDbSchemaPersistentWriter)
require 'ezc/ezc_autoload.php';
$db = ezcDbFactory::create( 'mysql://root:password@localhost/temp' );
$dbSchema = ezcDbSchema::createFromDb( $db );
write perssitents
$persistentWriter = new ezcDbSchemaPersistentWriter;
$persistentWriter->saveToFile('persistent', $dbSchema);

And now we have definition for user object:
persistent/user.php

<?php
Autogenerated PersistentObject definition

$def = new ezcPersistentObjectDefinition();
$def->table = 'user';
$def->class = 'user';

$def->idProperty = new ezcPersistentObjectIdProperty();
$def->idProperty->columnName = 'email';
$def->idProperty->propertyName = 'email';
$def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentManualGenerator' );

$def->properties['name'] = new ezcPersistentObjectProperty();
$def->properties['name']->columnName = 'name';
$def->properties['name']->propertyName = 'name';
$def->properties['name']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;

return $def;

?>

But id havent propertyType, wich must be a PHP_TYPE_STRING.

I think that we need add a line ' fwrite( $file, "\$def->idProperty->propertyType = {$this->translateType($field->type)};\n" );' in DatabaseSchema/src/handlers/persistent/writer.php, line 117

#256525 by Serhey Dolgushev on May 2nd, 2008 [Permanent Link]

Fixed in rev. #8248. The feature part of this issue will be implemented in one of the next releases.

#256922 by Tobias Schlitt on June 3rd, 2008 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Components Components
Components » DatabaseSchema
Affects 1.3.1 - DatabaseSchema 1.3.1
Fix Version 2008.1RC1 - eZ components 2008.1RC1
Reporter Serhey Dolgushev
Responsible Tobias Schlitt
Status 0 Closed
Resolution Fixed
Created April 30th, 2008
Updated June 3rd, 2008
Resolved June 3rd, 2008
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels