ezpersistentobject fetch function

Author Message

Claudia Kosny

Monday 06 November 2006 3:14:29 pm

Hi there

I had to write my own datatype which writes some data into an additional table. I am trying to use the ez database abstraction using expersistentobject. The problem I have now is that the fetch function which is used in the constructor of expersistentobject is not defined in the expersistentobject class so I have no example for what to do in my class. When I check the code in other classes that extend ezpersistentobject the fetch functions are to different to know what is really necessary.

Currently I use this for my function fetch:

    function &fetch($rowId, $asObject)
    {
      return eZPersistentObject::fetchObject( eZChannelRelation::definition(),
                                                null,
                                                array( "id" => $rowId),
                                                $asObject );
    }

This seems to work fine but I would like to have some confirmation or correction as this is a major project.

So could someone point me to more information about the usage of ezpersistentobject?

The definition of my persistentobject looks like this:

    function definition()   
    {                       
        return array( "fields" => array( "id" => array( 'name' => 'id',
                                                        'datatype' => 'integer',
                                                        'default' => 0,
                                                        'required' => true ),
                                         "create_time" => array( 'name' => "createTime",
                                                                 'datatype' => 'integer',
                                                                 'default' => '',
                                                                 'required' => true ),                                         
                                         "creator_id" => array( 'name' => "creatorId",
                                                                 'datatype' => 'integer',
                                                                 'default' => 0,
                                                                 'required' => true ),
                                         "channel_id" => array( 'name' => "channelId",
                                                               'datatype' => 'integer',
                                                               'default' => 0,
                                                               'required' => true ),
                                         "expert_id" => array( 'name' => "expertId",
                                                               'datatype' => 'integer',
                                                               'default' => 0,
                                                               'required' => true ),
                                         "price" => array( 'name' => "price",
                                                               'datatype' => 'float',
                                                               'default' => 0,
                                                               'required' => true ),
                                         "status" => array( 'name' => "status",
                                                               'datatype' => 'integer',
                                                               'default' => 0,
                                                               'required' => true ) ),
                      "keys" => array( "id" ),
                      "increment_key" => "id",
                      "function_attributes" => array('channel_name' => 'channelName'),
                      "sort" => array( "id" => "asc" ),
                      "class_name" => "eZChannelRelation",
                      "name" => "my_expert_channel_relation" );
    }

Thanks

Claudia

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 19 2025 07:20:12
Script start
Timing: Jan 19 2025 07:20:12
Module start 'layout'
Timing: Jan 19 2025 07:20:12
Module start 'content'
Timing: Jan 19 2025 07:20:12
Module end 'content'
Timing: Jan 19 2025 07:20:12
Script end

Main resources:

Total runtime0.8383 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.1641152.6250
Module start 'layout' 0.00590.0026 741.789139.4609
Module start 'content' 0.00850.8284 781.2500419.3438
Module end 'content' 0.83680.0014 1,200.593812.1563
Script end 0.8383  1,212.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3847160.0002
Check MTime0.00130.1521160.0001
Mysql Total
Database connection0.00070.083310.0007
Mysqli_queries0.798295.2141460.0174
Looping result0.00040.0494440.0000
Template Total0.803295.820.4016
Template load0.00230.278220.0012
Template processing0.800995.540320.4005
Template load and register function0.00020.023410.0002
states
state_id_array0.00140.164810.0014
state_identifier_array0.00090.108720.0005
Override
Cache load0.00180.2173130.0001
Sytem overhead
Fetch class attribute can translate value0.00070.084310.0007
Fetch class attribute name0.00050.061310.0005
XML
Image XML parsing0.00010.013010.0001
class_abstraction
Instantiating content class attribute0.00000.000610.0000
General
dbfile0.00070.0831100.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs