New datatype not storing content

Author Message

Eirik Alfstad Johansen

Tuesday 13 January 2004 5:45:41 am

Hi,

I've created a new datatype, but for some strange reason, it won't store the its value when creating an object. I've done some bug searching by trying to print out the value in the fetchObjectAttributeHTTPInput functionn where the value is supposed to be stored, and the value exists all the way to the following piece of code:

$contentObjectAttribute->setAttribute( "data_text", $data );

...which should save the data. However, just an empty textstring is saved. Does anyone have any idea as to what I could be doing wrong? Thanks in advance !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Hans Melis

Tuesday 13 January 2004 8:19:17 am

Hi Eirik,

Have you implemented the function storeObjectAttribute() in your datatype? Even an empty implementation seems to do the trick according to the eztext datatype, but there are other ways as well.

/*!
Store the content.
*/
function storeObjectAttribute( &$attribute )
{
}

hth

--
Hans

Hans
http://blog.hansmelis.be

Eirik Alfstad Johansen

Tuesday 13 January 2004 10:15:05 am

Hi Hans,

Yes, I have, so that can't be it. Any other ideas?

Thanks in advance !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Eirik Alfstad Johansen

Friday 16 January 2004 6:10:23 am

Hi Hans,

In your previous post you mentioned that "there are other ways as well". What other ways were you referring to, as I still can't get this to work. BTW, here's the mothod which should store the datatype value.

function fetchObjectAttributeHTTPInput( &$http, $base, &$contentObjectAttribute )
{
if ( $http->hasPostVariable( $base . "_data_text_" .
$contentObjectAttribute->attribute( "id" ) ) )
{
$data =& $http->postVariable( $base . "_data_text_" .
$contentObjectAttribute->attribute( "id" )
);

$contentObjectAttribute->setAttribute( "data_text", $data );
}

return false;
}

Any insight is greatly appreciated !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Hans Melis

Friday 16 January 2004 7:45:51 am

Eirik,

The method we usually use in datatypes uses the content(). Example:

function fetchObjectAttributeHTTPInput( &$http, $base, &$contentObjectAttribute )
{
if ( $http->hasPostVariable( $base . "_data_text_" .
$contentObjectAttribute->attribute( "id" ) ) )
{
$data =& $http->postVariable( $base . "_data_text_" .
$contentObjectAttribute->attribute( "id" )
);

$contentObjectAttribute->setContent( $data );
return true;
}

return false;
}

and then:

function storeObjectAttribute( &$attribute )
{
$data = $attribute->content();
$attribute->setAttribute('data_text', $date);
}

But I just spotted something. In your fetchHTTPinput function, you don't do a "return true;" when you've done setAttribute(). Maybe that has something to do with it.

--
Hans

Hans
http://blog.hansmelis.be

Eirik Alfstad Johansen

Friday 16 January 2004 10:03:57 am

Hi Hans,

> But I just spotted something. In your fetchHTTPinput function,
> you don't do a "return true;" when you've done setAttribute().
> Maybe that has something to do with it.

That was it! Thanks a million, Hans!

- Eirik

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

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

Main resources:

Total runtime0.0256 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.0095 589.1641152.6250
Module start 'layout' 0.00950.0060 741.789139.4453
Module start 'content' 0.01550.0074 781.234497.3359
Module end 'content' 0.02290.0026 878.570338.3047
Script end 0.0256  916.8750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003312.9865140.0002
Check MTime0.00134.8879140.0001
Mysql Total
Database connection0.00145.297310.0014
Mysqli_queries0.005923.159630.0020
Looping result0.00000.117310.0000
Template Total0.00228.510.0022
Template load0.00103.969310.0010
Template processing0.00124.520210.0012
Override
Cache load0.00072.740810.0007
General
dbfile0.00176.467280.0002
String conversion0.00000.058640.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.0013 secs