Adding a '1 – n' schema to the User Content Type?

Topics: Customizing Orchard
Jan 19, 2012 at 1:05 AM

Hi guys, I have extended the User content type with a custom ‘Address’ part, all is good, so I wish to incorporate some more fields/tables.

Basically, I need to add a ‘1 – n relationship’ [User – Donations] i.e. I need to record when ‘one user may’ve made many donations’.

What would be the recommended schema to accomplish such, as I believe my initial addition of an ‘address part to the User’ is only suitable for 1 – 1 relationships? Any suggestions / pointers will be greatly appreciated. Thanks Dyr

Coordinator
Jan 19, 2012 at 2:38 AM

Did you read this?
http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations 

Jan 19, 2012 at 2:59 AM
Edited Jan 19, 2012 at 3:12 AM

Yeah, I gathered this would be the approach -- are you recommending such?  I have been reading through it and tried to get the project going with no success?  I can enable RelationSample in features, but when I goto "Content Types" to create a new "Customer" content type, the address option isnt available? Any thoughts? Thanks Dyr

Jan 19, 2012 at 3:31 AM

If you post your code maybe we can see where things are going wrong.

Also check your logs for any errors (in App_Data\Logs), if an Exception is thrown in your driver this will cause the part to not display.

Jan 19, 2012 at 3:38 AM

Thanks randompete, though this was in relation to the code available from the tutorial without alteration...the log errors are such:

2012-01-19 13:11:27,750 [1] Orchard.Environment.Extensions.ExtensionLoaderCoordinator - No loader found for extension "Orchard.RelationSample"!
2012-01-19 13:12:07,015 [7] Orchard.Environment.Extensions.ExtensionManager - No suitable loader found for extension "Orchard.RelationSample"
2012-01-19 13:13:38,415 [77] Orchard.Environment.Extensions.ExtensionLoaderCoordinator - No loader found for extension "Orchard.RelationSample"!
2012-01-19 13:13:42,515 [81] Orchard.Environment.Extensions.ExtensionManager - No suitable loader found for extension "Orchard.RelationSample"
2012-01-19 13:21:52,660 [75] Orchard.Environment.Extensions.ExtensionLoaderCoordinator - No loader found for extension "Orchard.RelationSample"!
2012-01-19 13:54:17,575 [50] Orchard.Environment.Extensions.ExtensionLoaderCoordinator - No loader found for extension "Orchard.RelationSample"!

Jan 19, 2012 at 3:45 AM

...I'm wondering if the folder name has something to do with it, as in, when I placed the project folder into the modules folder - I renamed it? Will check now and let you know - Thanks guys

Jan 19, 2012 at 4:22 AM

my above thought didn't help...something I did notice however, is that when I enable/disable RelationSample - the confirmation blurb reads "was enabled" or "was disabled" without the RelationSample preceeding it; as in, "RelationSample was enabled". Any thoughts guys? Cheers Dyr

Jan 19, 2012 at 5:02 AM

Scratch that - my hunch was correct, after renaming 'Orchard.Modules.RelationSample.0.5.0' to just 'Orchard.Modules.RelationSample', it asked to be updated, then worked; thanks guys.