3093 Posts in 875 Topics by 654 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 644 Views |
-
[SOLVED] 1-N relationship...how create data in child?

27 June 2010 at 9:12pm Last edited: 30 June 2010 7:09pm
Hi,
I've a 1-n relation that is 1 product ; N quotes...
I solved how create quotes, but ProductID value in child is always 0. How Do I insert relation data?
Code:$myMember = DataObject::get_by_id('Member',$People);
if ($myMember) {
$people_tmp=$myMember->FirstName." ".$myMember->Surname;}
$InfoQuota = new ProductQuota();$InfoQuota->People=$people_tmp;
$InfoQuota->Quota=$QuotaNumber;
echo "Product" . $ProductID;
$InfoQuota->ProductID=$ProductID;
var_dump($InfoQuota);
$InfoQuota->write();
}Thank you
-
Re: [SOLVED] 1-N relationship...how create data in child?

28 June 2010 at 9:24am
echo "Product" . $ProductID;
Does that correctly output your product id? You don't mentioned where that comes from so I'm going to assume that is set.
This line should set the relation - $InfoQuota->ProductID=$ProductID; which is what you are doing so that should be working as long as $ProductID is set.
-
Re: [SOLVED] 1-N relationship...how create data in child?

28 June 2010 at 10:46pm
If so...I need to investigate on ProductID parameter...
-
Re: [SOLVED] 1-N relationship...how create data in child?

30 June 2010 at 7:09pm
Problem was from $this->ProductID to $this->ProductID
Thank you
| 644 Views | ||
|
Page:
1
|
Go to Top |

