5452 Posts in 1673 Topics by 1197 members
|Go to End|
11 August 2010 at 2:01am
Hi, I have a question
if there are a couple of decorators which decorates one class, in what order decorators would be processed?
Situation like this can occur when you want to add functionality to the class that is already decorated by some module that you use in your program.
I did not find answer anywhere, so I hope you will help me.
11 August 2010 at 7:19pm
I am working with subsites module. I need to make uploaded files be available to all subsites or only to one subsite.
To achive this I decorate class File and add to it field Global (boolean). If it is true, the file will be available to all subsites.
In subsites module there is function to disable/enable filtering by subsites when geting data using DataObject::get, but it not work for files. There is decorator for class File in Subsites module, but in this decorator disabling/enabling subsite filter does not work (there is no code for that). In my decorator I add augmentSQL function and remove filtering from where statement in the query (this is added by subsite's decorator).
It works, my decorator processes later than subsites' decorator.
My team leader do not want to change modules becouse of possible updates, etc.
It is the first issue. The second is following.
I want to add possibility for dataobjects or pages be available to all subsites or only to one subsite, as with files. But not to add code to each dataobject or page type I will create, but decorate dataobject(sitetree) class and make this functionality be available to new classes. I want to use decorator to achieve this, as I do with files. For this I need to know order of decorators.
Can you recommend other approach instead of using decorators? I will be very grateful.
19 January 2011 at 2:08am
"In subsites module there is function to disable/enable filtering by subsites when geting data using DataObject::get"
Where can I find this function? It's just what I'm looking for!
I've got a single DataObject::get call that I wish to use to access Pages from another subsite.
19 January 2011 at 2:11am
Sorry, found it!
|Go to Top|