Thanks for your answer, I read the thread, but this did not really
help me. It’s not just about redefining some core methods. I think,
the description of my problem was not clear enough, sorry for this. I
would appreciate, if you could have a look at the following
explanation.
I’ve got several entities saved in my database: E1, E2 … En. All
these entities can be flexibly annotated, so I’ve got the following
models:
E1 (Entity) => The entity itself
EA1 (EntityAnnotation) => The various entity annotations, may be
nested
ET (EntityType) => The used entity type which tells something about
the used datatype, display properties, etc.
This group of models repeat themselves for each exposed entity, so
I’ve got:
E1…n
EA1…n
ET
Now comes the point, I was originally refering to:
I created some code which checks, if the given annotation type can be
applied to the entity, what kind of sub-entities (children) the
annotation might can have and how much of them and then save them to
the entity annotation table. Here’s some pseudo-code for this:
1: fetch all annotations / attributes which should be attached to a
entity (those data comes from html formular)
2: check, whether the given annotations can be applied to the entity
and if they have the correct value type
3: if there are sub-annotations, check whether they are valid and do
not exceed the maximum of allowed children and if they also have the
correct value type
4: (check more various constraints…)
5: (maybe, some more stuff to do…)
6: if there’s no error, save the annotations with the given types and
values
As I want to save alle entites separately for some kind of reason, I
come to this (refering to the pseudo code above):
1: fetch the data
2: validate given annotations regarding E1
3: validate given annotation children regarding E1
4: …
5: …
6: no error: save E1 and all corresponding EA1
For the next entity I would repeat all the stuff, just changing the
class names / object names, but gaining all the logic. The point is,
that I don’t want to use some kind of case distinction directly in the
code.
The class using this modul should just define a string constant
defining which entity class / entity annotation class to use. I just
need a possibility to handle class names as string an vice versa like
I do when using the core “send(meth_name, attr, &block)” method.
I hope, this explanation is adequate.
Thanx for your help!
Best regards, ms