Hello everyone!
I'm here because I'm trying to extend the modResource Class and manage their extra field.
I looked at the guide to "extend modUser" and "create Resource Class".
http://rtfm.modx.com/display/revolution20/Creating+a+Resource+Class
http://rtfm.modx.com/display/revolution20/Extending+modUser
I created two new CRC called "
Resort" and "
Room", for each of them I created controllers and processors:
class Room extends modResource{...}
class Resort extends modResource{...}
class RoomCreateProcessor extends modResourceCreateProcessor {...}
class RoomUpdateProcessor extends modResourceUpdateProcessor {...}
class ResortCreateManagerController extends ResourceCreateManagerController{...}
class RoomCreateManagerController extends ResourceCreateManagerController{...}
and everythings it's fine and work! I can create different resource, like Resort and Room.
Now I would like to extend the resource "Room" following the logic of "ExtUser", so I created the following schema:
<model package="swingtime" version="1.0" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
<object class="Resort" extends="modResource" />
<object class="Room" extends="modResource" >
<composite alias="roomInfo" class="roomInfo" local="id" foreign="roomInfo_id" cardinality="one" owner="local" />
</object>
<object class="RoomContainer" extends="modResource" />
<object class="roomInfo" table="roominfo" extends='xPDOSimpleObject'>
<field key='roomInfo_id' dbtype='int' precision='10' phptype='integer' null='false' />
<field key='name' dbtype='varchar' precision='255' phptype='string' null='false'/>
<field key='description' dbtype='varchar' precision='525' phptype='string' null='false'/>
<field key='img' dbtype='varchar' precision='255' phptype='string' null='true'/>
<index alias="roomInfo_id" name="roomInfo_id" primary="false" unique="true" type="BTREE">
<column key="roomInfo_id" collation="A" null="false" />
</index>
<aggregate alias='Room' local='roomInfo_id' foreign='id' cardinality='one' owner='foreign' />
</object>
</model>
Now my questions are:
1) How do I handle fields of roomInfo through RoomCreateProcessor and RoomUpdate Processor?
2) it is possible to manage the fields directly in the panel for creating a new "Room" by adding their fields in the panel Ext.extend(Swingtime.panel.Room) during creation or updating? How?
Thx in advice!
Waiting for reply