Module only returns strings, no integers

Author Message

Pål J Didriksen

Tuesday 28 June 2005 2:38:42 pm

I have a problem with the array returned from an extension module, and can't find out why.

I made a simple module, fetching content from an external table, called 'points'. Somehow, all values are returned as strings, even though most of them should be integers.

This is the code in 'points.php':

<?php

include_once( 'kernel/classes/ezpersistentobject.php' );

class Points extends eZPersistentObject
{

    function Points( $row )
    {
        $this->eZPersistentObject( $row );
    }

    function &definition()
    {
        $defArray= array( "fields" =>
               array(
                    'id' => array(
                    'datatype' => 'integer',
                    'default' => 0,
                    'name' => 'id',
                    'required' => true ),
              'contentobject_id' => array(
                    'name' => 'contentobject_id',
                    'datatype' => 'integer',
                    'default' => 0,
                    'required' => true ),
              'year' =>
              array('name' => 'year',
                    'datatype' => 'integer',
                    'default' => 0,
                    'required' => true ),
              'date' =>
              array('name' => 'date',
                    'datatype' => 'date',
                    'default' => 0,
                    'required' => false ),
              'category' =>
              array('name' => 'category',
                    'datatype' => 'integer',
                   'default' => 0,
                    'required' => false ),
              'title' =>
              array('name' => 'title',
                    'datatype' => 'string',
                    'default' => '',
                    'required' => false ),
              'points_int' =>
              array('name' => 'points_int',
                    'datatype' => 'integer',
                    'default' => 0,
                    'required' => false ) ),
           'keys' => array( 'id' ),
           'increment_key' => 'id',
           'class_name' => 'points',
           'sort'  => array( 'id' => 'asc'),
           'name' => 'points' );

        return $defArray;

    }

    function &fetchListFromDB( $parameters )
    {
        return Points::handleList( $parameters, false );
    }

    function &handleList( $parameters = array(), $asCount = false )
    {
        $parameters = array_merge( array( 'as_object' => true,
        'sort_by' => false,
        'offset' => false,
        'limit' => false,
        'contentobject_id' => true
         ),
        $parameters );

        $asObject = $parameters['as_object'];
        $offset = $parameters['offset'];
        $limit = $parameters['limit'];
        $sorts = $parameters['sort_by'];

        if (!$parameters['contentobject_id'] == "" )
            $conds = array('contentobject_id' => $parameters['contentobject_id']);
          $conds = "";

        $limitArray = null;
        if ( !$asCount and $offset !== false and $limit !== false )
        $limitArray = array( 'offset' => $offset,
                            'length' => $limit );

        $obj= eZPersistentObject::fetchObjectList( Points::definition(),
                                                    null, $conds, $sorts, $limitArray,
                                                    $asObject );

       return $obj;
    }

}

?>

Any tips, ideas or similar experiences?

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

Main resources:

Total runtime0.7934 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.0056 590.4063152.6406
Module start 'layout' 0.00560.0037 743.046939.4766
Module start 'content' 0.00920.7827 782.5234452.5234
Module end 'content' 0.79190.0015 1,235.046912.1250
Script end 0.7934  1,247.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4723160.0002
Check MTime0.00160.2057160.0001
Mysql Total
Database connection0.00070.084910.0007
Mysqli_queries0.748194.2871460.0163
Looping result0.00070.0841440.0000
Template Total0.757895.520.3789
Template load0.00220.281120.0011
Template processing0.755595.225720.3778
Template load and register function0.00010.017810.0001
states
state_id_array0.00140.171810.0014
state_identifier_array0.00130.159120.0006
Override
Cache load0.00180.223190.0002
Sytem overhead
Fetch class attribute can translate value0.00150.190710.0015
Fetch class attribute name0.00050.068720.0003
XML
Image XML parsing0.00280.355510.0028
class_abstraction
Instantiating content class attribute0.00000.000520.0000
General
dbfile0.00290.3676160.0002
String conversion0.00000.001340.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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: 7
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs