Hey Guys,
I am trying to extend mod user to have a relationship with another table so I can store "goals" that have been completed by each user. Here is my Schema:
<?xml version="1.0" encoding="UTF-8"?>
<model package="Offer_Status" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
<object class="extUser" table="modx_users" extends="modUser">
<composite alias="OfferSummary" local="id" foreign="UserId" cardinality="many" owner="local" />
</object>
<object class="OfferSummary" table="modx_offer_summary" extends="xPDOSimpleObject">
<field key="UserId" dbtype="int" precision="11" phptype="integer" null="false" index="index" />
<field key="OfferId" dbtype="int" precision="11" phptype="integer" null="false" />
<field key="CompleteDate" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" />
<field key="OfferStatus" dbtype="tinyint" precision="1" phptype="integer" null="false" />
<index alias="UserId" name="UserId" primary="false" unique="false" type="BTREE" >
<column key="UserId" length="" collation="A" null="false" />
<column key="CompleteDate" length="" collation="A" null="false" />
</index>
<aggregate alias="extUser" local="UserId" foreign="id" cardinality="one" owner="foreign" />
</object>
</model>
I have followed the tutorial in rtfm and I think I set it up properly. I also edited the class file extuser.class.php
<?php
/**
* @package extendeduser
* @subpackage user.mysql
*/
class extUser extends modUser {
function __construct(xPDO & $xpdo) {
parent :: __construct($xpdo);
$this->set('class_key','extUser');
}
}
?>
Now my question is all the users in the table modx_users have the class key of modUser, do i have to create new users (via the api) to be able to use the extended fields, I would like all users to be able to have access to extended fields.
If I change my user manually in the database to extUser it automatically logs me out and cant log back in until i change it back to modUser.
Also I havnt found any documentation on how to add data to my table so it creates the relationship with the current user.
Any help is appreciated, kind of fumbling through all this as it is my first time with xpdo.
[ed. note: datarecall last edited this post 14 years, 7 months ago.]