mySQL to ezPersistentObject 3.6.0 datatype mapping

Author Message

Massimiliano Bariola

Wednesday 15 June 2005 3:50:46 am

hi,

I am using eZpersistentObject for a module I'm writing to interface with an external databse and its tables.

Browsing the code, I can see that there is mapping / handling for string and numeric int / float / double types. but how do I write the definition array for fields of date / datetime type?

e.g. from my own ezpersistentObject::definition method:

CreationDate is a mySQL datatype. I would like to write the definition snippet like this....

"creationDate" => array( 'name' => "CreationDate",
'datatype' => 'datetime',
'default' => '',
'required' => true ),

but it seems that eZContentObject has no special handling for dates/datetimes. Should I use the string datatype in definition and make sure myself that the datetime is correctly written to db?

TIA

Massimiliano

Björn Dieding@xrow.de

Wednesday 15 June 2005 5:00:54 am

how about this?

"creationdate" => array( 'name' => "CreationDate",
'datatype' => 'integer',
'default' => time(),
'required' => true ),

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Massimiliano Bariola

Wednesday 15 June 2005 6:07:41 am

Hi Bjorn,

first of all congrats on your lecture at eZcamp 2005.

your solution will work, but I cannot change the mySQL datastructure. I have to stick to the date/datetime columns.

How about if I set it as
datatype => string,
function_attributes =>array('myDateTimeField' => 'myDateGetterFunction'),
set_functions => array('myDateTimeField' => 'myDateTimeSetterFunction')

could it work, in your opinion? I wasn't able to find any documentation for these features though, so it's just a stab in the dark ..

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:32:44
Script start
Timing: Jan 31 2025 04:32:44
Module start 'layout'
Timing: Jan 31 2025 04:32:44
Module start 'content'
Timing: Jan 31 2025 04:32:44
Module end 'content'
Timing: Jan 31 2025 04:32:44
Script end

Main resources:

Total runtime0.0227 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.2734151.2266
Module start 'layout' 0.00720.0034 739.500036.6953
Module start 'content' 0.01060.0102 776.195394.1875
Module end 'content' 0.02080.0018 870.382833.9922
Script end 0.0226  904.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003013.3724140.0002
Check MTime0.00114.8767140.0001
Mysql Total
Database connection0.00114.926110.0011
Mysqli_queries0.002410.615530.0008
Looping result0.00000.119910.0000
Template Total0.00146.210.0014
Template load0.00104.516010.0010
Template processing0.00041.648710.0004
Override
Cache load0.00072.902010.0007
General
dbfile0.00031.270280.0000
String conversion0.00000.049440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs