how to add values to sibling relationships

1 view
Skip to first unread message

AjejeBraso

unread,
Jul 8, 2008, 11:42:52 AM7/8/08
to Php Object Generator
Hi all,
first of all thanks for the code generator, it saves me a lot of time
and i like how it allows me to manipulate the DB. great job!

The one thing i would like to ask/i miss is how to add a field to a
sibling or m:n relationship. Lets assume i have "workflow" and
"parameter". A workflow can have multiple parameters and a parameter
can be present in multiple workflows. Now, each relationship of
workflow/parameter can have a particular value set for the parameter,
and i assume it should go in to the map table, right?

something like

Workflow-->AddParameter(parameter, value)

i assume would be the best way to accomplish this... right?

Any help/ideas/comments are appreciated! Thanks!

A

Crispy

unread,
Jul 9, 2008, 7:42:20 AM7/9/08
to Php Object Generator
If Workflow is a class and Parameter is a class, then this is what I
would be doing...

$workflow = new Workflow();
$workflow->Get($existingId);

$parameter = new Parameter();
$parameter->value = "something";

$workflow->AddParameter($parameter);

...

-Mark

Vlada

unread,
Aug 12, 2008, 4:42:45 PM8/12/08
to Php Object Generator
I have the same problem:

For example:
If we have class Exam and class Student, both siblings.
Now, if we want to enter some marks, I think it must be entered
in class examstudentmap.

I don't know how to do that?

Is there any way to add columns in examstudentmap table???
Any suggestions?
Thanks






AjejeBraso је написао:

Joel Wan

unread,
Aug 12, 2008, 5:35:46 PM8/12/08
to Php-Object...@googlegroups.com
There seems to be a misunderstanding between email 1 and 3 and what Mark suggested.
 
You should consider the mapping table 'off-limits' or invisible to the developer. The mapping table is private to POG and is used by POG to manage the relationships between 2 siblings, i.e. there is currently no way for POG to automatically add and manage columns to the mapping table. Now, you are free to alter the tables and mapping classes manually but we would not recommend it as any time you regenerate a class, your tables will not be in line with your classes.
 
Now, I understand that you both want to be able to add a "property" or column to the mapping object. I think if you want to do this the "POG way", you should create the 3rd property into its own object, either as a child or sibling. Example:
 
Exam is sibling of Student and vice-versa. Now, instead of trying to add Marks as a third 'column', you can think of Mark as actually a child of Student (i.e. a student can have many marks, but each mark belongs to only one student).
 
The relationship between Exam, Student and Mark will be proper and no data will be lost.
 
Thoughts?

2008/8/12 Vlada <ilicvla...@gmail.com>

Vlada

unread,
Aug 13, 2008, 11:39:26 AM8/13/08
to Php Object Generator
Thanks!!!

This will solve my problem.
I create Mark as child of Student and child of Exam.
Actually, this will create table with 3 columns - examid, studentid
and examid, and we can add
more properties if we want.

Again, thanks a lot!!!

Joel Wan је написао:
Reply all
Reply to author
Forward
0 new messages