Class attribute - help

Author Message

Hugo Oliveira

Monday 10 September 2007 5:29:47 pm

Hi

First of all I'd like to apologize if this topic is in the wrong place.

I've got a class with an attribute that (ideally) could be one of 2 things: a hyperlink or a file. Is there a way to define a class to harbor such a constraint? This attribute should never be both at the same time. Is there a way to do this with just a class definition?

Thanks in advance.

Olivier Ouin

Monday 17 September 2007 8:25:06 am

I think it's not possible to do it only with a new class.

For me, the simpliest way is to create a class with the 2 attributes, with a custom edit template that allow to input only one of them (javascript validation prior to post, by example).

More sophisticated, you can deleguate creation of these objects to a custom module, calling for a custom template.

Another solution could be the custom datatype which will reject validation if link and file are submited, but it's maybe a kind of overkill.

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 18 2025 18:18:35
Script start
Timing: Jan 18 2025 18:18:35
Module start 'layout'
Timing: Jan 18 2025 18:18:35
Module start 'content'
Timing: Jan 18 2025 18:18:35
Module end 'content'
Timing: Jan 18 2025 18:18:35
Script end

Main resources:

Total runtime0.0161 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.0067 587.9063152.6250
Module start 'layout' 0.00670.0042 740.531339.4453
Module start 'content' 0.01090.0035 779.976689.1016
Module end 'content' 0.01430.0017 869.078130.3047
Script end 0.0160  899.3828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002616.1818140.0002
Check MTime0.00137.9379140.0001
Mysql Total
Database connection0.00159.580510.0015
Mysqli_queries0.004226.188530.0014
Looping result0.00000.124710.0000
Template Total0.00148.910.0014
Template load0.00084.957310.0008
Template processing0.00063.937010.0006
Override
Cache load0.00053.246510.0005
General
dbfile0.00021.231280.0000
String conversion0.00000.047540.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