<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Forum posts to 'Data Model Questions'</title>
		<link>http://www.silverstripe.org/data-model-questions/rss</link>
		<atom:link href="http://www.silverstripe.org/data-model-questions/rss" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280869</link>
			<description>&lt;p&gt;hey guys,&lt;/p&gt;&lt;p&gt;thanks for all the advice.&lt;br /&gt;I'm sure there is one I can use in my project&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280869&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280869&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sun, 14 Mar 2010 02:00:19 +1300</pubDate>
			<dc:creator>theAlien</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280869</guid>
		</item>
		
		<item>
			<title>Re: 2 page types sharing a field but with different class</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280228?start=0#post280850</link>
			<description>&lt;p&gt;Easiest option is to rename your field. You might need to delete the Image columns yourself from Page since not use if SS will clean this up automatically for you. If it doesn't you might run into more issues later on&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: 2 page types sharing a field but with different class &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280228?start=0#post280850&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280228?start=0#post280850&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 13 Mar 2010 14:52:24 +1300</pubDate>
			<dc:creator>Willr</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280228?start=0#post280850</guid>
		</item>
		
		<item>
			<title>Re: Problem with Relationships for DataObject on Page.php</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280719</link>
			<description>&lt;p&gt;Hi Linsey,&lt;/p&gt;&lt;p&gt;I wonder if you are talking about the CMS or the front site when you say: &lt;em&gt;‘but the complex table items seem to appear on every page!’&lt;/em&gt;. That’s why I asked you about your template. In any case, if you want a real 1-to-1, I think you need a HasOneComplexTableField. Also, don’t forget about UncleCheese’s DataObjectManager, which implements similar fields.&lt;/p&gt;&lt;p&gt;Regards,&lt;br /&gt;Juan&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Problem with Relationships for DataObject on Page.php &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280719&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280585?start=0#post280719&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 12 Mar 2010 02:49:51 +1300</pubDate>
			<dc:creator>Juanitou</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280719</guid>
		</item>
		
		<item>
			<title>Re: Problem with Relationships for DataObject on Page.php</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280690</link>
			<description>&lt;p&gt;Hi there,&lt;/p&gt;&lt;p&gt;I'll try this HasOneComplexTableField.&lt;/p&gt;&lt;p&gt;I think I'm missing the point somewhere though, in terms of the relationship thing. Confused by the fact that if a put a new field in via the DB array, then it only appears on the page where I added it, but the compex table items seem to appear on every page!&lt;/p&gt;&lt;p&gt;I'll let you know how I get on with the HasOneComplexTableField, and thanks for helping me again! Twice in a week!&lt;/p&gt;&lt;p&gt;(&quot;,)&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Problem with Relationships for DataObject on Page.php &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280690&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280585?start=0#post280690&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 11 Mar 2010 14:40:30 +1300</pubDate>
			<dc:creator>LinseyM</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280690</guid>
		</item>
		
		<item>
			<title>Re: Problem with Relationships for DataObject on Page.php</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280624</link>
			<description>&lt;p&gt;Hi!&lt;/p&gt;&lt;p&gt;What your template looks like? Have you verified in the database that Pages you create have a TestimonialID column?&lt;/p&gt;&lt;p&gt;Have you tried with HasOneComplexTableField? There is a one-to-one switch.  Some reading: &lt;a href=&quot;http://doc.silverstripe.org/doku.php?id=HasOneComplexTableField&quot;&gt;http://doc.silverstripe.org/doku.php?id=HasOneComplexTableField&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Hope it helps,&lt;br /&gt;Juan&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Problem with Relationships for DataObject on Page.php &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280624&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280585?start=0#post280624&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 11 Mar 2010 02:50:56 +1300</pubDate>
			<dc:creator>Juanitou</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280585?start=0#post280624</guid>
		</item>
		
		<item>
			<title>Problem with Relationships for DataObject on Page.php</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280585#post280585</link>
			<description>&lt;p&gt;Hi guys, me again! Looking for a bit of help as I've tied myself in knots here!&lt;/p&gt;&lt;p&gt;I'm looking to create a new tab in the CMS with a ComplexTableField, where the user can add Testimonials that relate to each specific page. (This will be for ANY page on the site that uses or derives from &quot;Page.php&quot;, but each testimonial will be unique to only the page it was created on.)&lt;/p&gt;&lt;p&gt;Initially I had set it up so that there was only one testimonial per page; on page.php I used the static $db array to create a few fields (quote, name, company)&lt;/p&gt;&lt;p&gt;However, we now want to have it so that the user can add as many Testimonials as they like. I decided to do this using the ComplexTableField.&lt;/p&gt;&lt;p&gt;First of all I created the object, Testimonial.php:&lt;/p&gt;&lt;p&gt;&amp;lt;?php&lt;br /&gt;class Testimonial extends DataObject {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $db = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Quote' =&amp;gt; 'Text',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Name' =&amp;gt; 'Varchar(255)',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Company' =&amp;gt; 'Varchar(255)',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Status' =&amp;gt; &quot;Enum('Active,Inactive', 'Active')&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $singular_name = 'Testimonial';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $plural_name = 'Testimonials';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $has_one = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $default_sort = &quot;Name ASC&quot;;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;Then in page.php I put in the following code:&lt;/p&gt;&lt;p&gt;...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public static $has_one = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Testimonials' =&amp;gt; 'Testimonial',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;function getCMSFields() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$fields = parent::getCMSFields();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$TestimonialsTable = new ComplexTableField($this, 'Testimonials', 'Testimonial', array('Name'=&amp;gt; 'Name'));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$fields-&amp;gt;addFieldToTab(&quot;Root.Content.Testimonial&quot;, new HeaderField( Client Testimonials:', '3', true ));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$fields-&amp;gt;addFieldToTab('Root.Content.Testimonial', $TestimonialsTable);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return $fields;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;...&lt;/p&gt;&lt;p&gt;So this *seemed* to work, but then I realised that if I add a testimonial on one page, it appears on ALL pages that derive from page.php!!!&lt;/p&gt;&lt;p&gt;I guess I've got the relationship thing wrong somewhere?&lt;/p&gt;&lt;p&gt;I tried adding the following code to Testimonial.php, but it didn't have the desired effect - it just created a dropdown box with all the site pages in the modal dialog! (So I've removed it again)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $has_one = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Page' =&amp;gt; 'Page',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;/p&gt;&lt;p&gt;Basically, I need to know how to say &quot;when I create a testimonial on  Page-A it only appears on Page-A&quot;&lt;/p&gt;&lt;p&gt;All help is appreciated, as always!!! I'm reading through my silverstripe book just now to try and figure it out, but my brain hurts!!!&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Linsey    (&quot;,)&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Problem with Relationships for DataObject on Page.php &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280585#post280585&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280585#post280585&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Wed, 10 Mar 2010 11:53:44 +1300</pubDate>
			<dc:creator>LinseyM</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280585#post280585</guid>
		</item>
		
		<item>
			<title>Re: Problem creating TreeMultiselectField to look up Page</title>
			<link>http://www.silverstripe.org/data-model-questions/show/256148?start=8#post280439</link>
			<description>&lt;p&gt;It seems there is a bug somewhere in TreeMultiselectField, isn’t it? Has somebody submitted a ticket to Trac? If there’s no bug (and I think it’s probably us that are not understanding how it works), maybe a developer will explain how to use it! ;-)&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Problem creating TreeMultiselectField to look up Page &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/256148?start=8#post280439&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/256148?start=8#post280439&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Mon, 08 Mar 2010 06:37:31 +1300</pubDate>
			<dc:creator>Juanitou</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/256148?start=8#post280439</guid>
		</item>
		
		<item>
			<title>Re: Do relations to a class work with the classes children?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280372?start=0#post280425</link>
			<description>&lt;p&gt;Thanks again, willr.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Do relations to a class work with the classes children? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280372?start=0#post280425&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280372?start=0#post280425&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sun, 07 Mar 2010 20:20:36 +1300</pubDate>
			<dc:creator>baba-papa</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280372?start=0#post280425</guid>
		</item>
		
		<item>
			<title>Re: Do relations to a class work with the classes children?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280372?start=0#post280420</link>
			<description>&lt;p&gt;No you won't have to create a new relation. If shoe is a subclass of product then shoe is still a product and has a product record. So should work fine.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Do relations to a class work with the classes children? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280372?start=0#post280420&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280372?start=0#post280420&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sun, 07 Mar 2010 19:49:26 +1300</pubDate>
			<dc:creator>Willr</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280372?start=0#post280420</guid>
		</item>
		
		<item>
			<title>Re: How to add search filter in ComplexTableFields in the cms</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280281?start=0#post280379</link>
			<description>&lt;p&gt;Use the DataObjectManager module to search your DataObjects in the Backend.&lt;/p&gt;&lt;p&gt;Are you a woman or a man? This is vital information for my communication behaviour.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: How to add search filter in ComplexTableFields in the cms &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280281?start=0#post280379&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280281?start=0#post280379&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sun, 07 Mar 2010 05:03:03 +1300</pubDate>
			<dc:creator>baba-papa</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280281?start=0#post280379</guid>
		</item>
		
		<item>
			<title>Do relations to a class work with the classes children?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280372#post280372</link>
			<description>&lt;p&gt;I do have a 1:1 relation between a class Auction and a class Product.&lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;static $has_one = array(&quot;product&quot;=&amp;gt;&quot;Product&quot;)&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;I intend to subclass Product for many different product categories, eg Shoe extends Product, Belt extends Product.&lt;br /&gt;Would I have to define a new relation if I want a relation between Auction and Shoe?&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Do relations to a class work with the classes children? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280372#post280372&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280372#post280372&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sun, 07 Mar 2010 02:45:47 +1300</pubDate>
			<dc:creator>baba-papa</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280372#post280372</guid>
		</item>
		
		<item>
			<title>Re: Dataobjects vs Pages?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280205?start=0#post280371</link>
			<description>&lt;p&gt;I would define that many products as DataObjects.&lt;br /&gt;All Page objects are displayed in the backend´s site tree. Now Inagine a site tree with a thousand entries.&lt;br /&gt;A product is not a page on its own. It has in fact a details view, which you have to make by yourself. For a SiverStripe pro this is done within 1 hour.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Dataobjects vs Pages? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280205?start=0#post280371&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280205?start=0#post280371&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sun, 07 Mar 2010 02:35:20 +1300</pubDate>
			<dc:creator>baba-papa</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280205?start=0#post280371</guid>
		</item>
		
		<item>
			<title>Re: renaming columntitles of listview in modeladmin</title>
			<link>http://www.silverstripe.org/data-model-questions/show/276296?start=0#post280357</link>
			<description>&lt;p&gt;ACTUALLY...i just found the answer to this.  the more i learn about SS the more i fall in love with it!!!  &lt;/p&gt;&lt;p&gt;After you have defined your $summary_fields:&lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;static $summary_fields = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'ListingType.ListingType',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'PropertyType.PropertyType',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Name',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Address',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'City',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'State.StateName',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'ZipCode',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;You can/need to the define the labels:&lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;static $field_labels = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'ListingType.ListingType' =&amp;gt; 'Listing Type',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'PropertyType.PropertyType' =&amp;gt; 'Property Type',&lt;br /&gt;                'State.StateName' =&amp;gt; 'State',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;I like this method...because it keeps everything in your model settings.  very nice, though i also agree that it should have simply worked in the example Will gave.  that would have been even better.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: renaming columntitles of listview in modeladmin &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/276296?start=0#post280357&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/276296?start=0#post280357&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 12:52:04 +1300</pubDate>
			<dc:creator>Terry Apodaca</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/276296?start=0#post280357</guid>
		</item>
		
		<item>
			<title>Re: renaming columntitles of listview in modeladmin</title>
			<link>http://www.silverstripe.org/data-model-questions/show/276296?start=0#post280356</link>
			<description>&lt;p&gt;sometimes it works and sometimes it doesn't.  I can't get it to work consistently with the simple example that Will gave.  Has anyone else tried to rename the columns of the grid in the ModelAdmin?&lt;/p&gt;&lt;p&gt;Maybe this is a good place to implement the DOM plugin since it's so much more robust?&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: renaming columntitles of listview in modeladmin &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/276296?start=0#post280356&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/276296?start=0#post280356&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 12:40:02 +1300</pubDate>
			<dc:creator>Terry Apodaca</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/276296?start=0#post280356</guid>
		</item>
		
		<item>
			<title>Re: [SOLVED] URL slug instead of ID on DataObject?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/267363?start=8#post280318</link>
			<description>&lt;p&gt;Nice. So SiteTree::generateURLSegment() is SilverStripe's slug generation equivalent.&lt;/p&gt;&lt;p&gt;-- Jason&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: [SOLVED] URL slug instead of ID on DataObject? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/267363?start=8#post280318&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/267363?start=8#post280318&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 03:09:09 +1300</pubDate>
			<dc:creator>Judge</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/267363?start=8#post280318</guid>
		</item>
		
		<item>
			<title>Re: Setting dynamic default values in a DataObject form</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280315</link>
			<description>&lt;p&gt;Yes, that was it. The documentation is here:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://doc.silverstripe.org/doku.php?id=recipes:populatedefaults&quot;&gt;http://doc.silverstripe.org/doku.php?id=recipes:populatedefaults&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I searched, and searched, and searched again, but did not find it.&lt;/p&gt;&lt;p&gt;This piece of documentation needs to be here, where the other scaffolding information is, including the method of adding static defaults:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://doc.silverstripe.org/doku.php?id=dataobject&quot;&gt;http://doc.silverstripe.org/doku.php?id=dataobject&lt;/a&gt;&lt;/p&gt;&lt;p&gt;At least a little hint to point at the API documentation (&lt;a href=&quot;http://doc.silverstripe.org/doku.php?id=dataobject&quot;&gt;http://doc.silverstripe.org/doku.php?id=dataobject&lt;/a&gt;) would be good on that page.&lt;/p&gt;&lt;p&gt;-- Jason&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Setting dynamic default values in a DataObject form [SOLVED] &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280315&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280289?start=0#post280315&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 02:46:19 +1300</pubDate>
			<dc:creator>Judge</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280315</guid>
		</item>
		
		<item>
			<title>Re: Setting dynamic default values in a DataObject form</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280314</link>
			<description>&lt;p&gt;I'll give that a try. Thanks.&lt;/p&gt;&lt;p&gt;I just realised too that when replacing the primitive datatypes (e.g. text, numbers) with the form fields (e.g. email, calendar, textareas) you don't need to to move the value of the field you are replacing into the new new field you have created.&lt;/p&gt;&lt;p&gt;For example, this will turn a text field into an e-mail field:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;static $db = array('Email' =&amp;gt; 'Varchar(250), ...)&lt;/p&gt;&lt;p&gt;function getCMSfields()&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;// You can try setting a value here (parameter #3) but it will just be discarded.&lt;br /&gt;$fields-&amp;gt;ReplaceField('Email', new EmailField('Email', 'E-mail'));&lt;br /&gt;...&lt;br /&gt;}&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;The value is automatically copied across from the existing database record, or from the $defaults array of the DataObject. That means no matter what values you set in getCMSFields(), they will get overridden further down the line before the form is displayed.&lt;/p&gt;&lt;p&gt;-- Jason&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Setting dynamic default values in a DataObject form [SOLVED] &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280314&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280289?start=0#post280314&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 02:35:05 +1300</pubDate>
			<dc:creator>Judge</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280314</guid>
		</item>
		
		<item>
			<title>Re: Setting dynamic default values in a DataObject form</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280313</link>
			<description>&lt;p&gt;Hi, I haven't tested it, but wouldn't populateDefaults() do the trick?&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Setting dynamic default values in a DataObject form [SOLVED] &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280313&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280289?start=0#post280313&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 02:24:44 +1300</pubDate>
			<dc:creator>martimiz</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280313</guid>
		</item>
		
		<item>
			<title>Re: Setting dynamic default values in a DataObject form</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280309</link>
			<description>&lt;p&gt;I think the problem is that $fields does not directly contain the fields in the displayed form, and so setValues() cannot find the fields to update.&lt;/p&gt;&lt;p&gt;$fields contains the &lt;strong&gt;Root tab&lt;/strong&gt; that contains the fields in the form. getFormFields() is not simply form fields - it also contains the nested tabs used in the screen to display the form.&lt;/p&gt;&lt;p&gt;I'm still tearing my hair out over what should be an extremely simple thing: how to set the value of a form item before the form is displayed. This what I'm trying at the moment, but the text form item resolutely does not change:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;function getCMSFields()&lt;br /&gt;    {&lt;br /&gt;        $fields = parent::getCMSFields();&lt;/p&gt;&lt;p&gt;        $myField = $fields-&amp;gt;dataFieldByName('myField');&lt;br /&gt;        $myField-&amp;gt;setValue('blah blah blah');&lt;/p&gt;&lt;p&gt;        echo $myField-&amp;gt;value(); // This displays &quot;blah blah blah&quot;&lt;/p&gt;&lt;p&gt;        $fields-&amp;gt;replaceField('myField', $myField);&lt;/p&gt;&lt;p&gt;        return $fields;&lt;br /&gt;    }&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;What am I doing wrong? If I var_dump() $myField, it appears to be the correct field object with the updated value. But somehow it does not end up on the form.&lt;/p&gt;&lt;p&gt;-- Jason&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Setting dynamic default values in a DataObject form [SOLVED] &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280309&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/280289?start=0#post280309&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Sat, 06 Mar 2010 00:14:41 +1300</pubDate>
			<dc:creator>Judge</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280289?start=0#post280309</guid>
		</item>
		
		<item>
			<title>Setting dynamic default values in a DataObject form [SOLVED]</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280289#post280289</link>
			<description>&lt;p&gt;Using the standard scaffolding, how would you do about setting default values for fields in a DataObject's form?&lt;/p&gt;&lt;p&gt;I have tried this, but it does not seem to work:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;class Employee extends DataObject {&lt;br /&gt;...&lt;/p&gt;&lt;p&gt;    function getCMSFields()&lt;br /&gt;    {&lt;br /&gt;        $fields = parent::getCMSFields();&lt;/p&gt;&lt;p&gt;        if (!$this-&amp;gt;ID) {&lt;br /&gt;            // New record: set dynamic defaults.&lt;br /&gt;            $fields-&amp;gt;setValues(array(&lt;br /&gt;                'StartDate' =&amp;gt; date('Y/m/d'),&lt;br /&gt;                'EmployeeNumber' =&amp;gt; $this-&amp;gt;getNextEmployeeNumber(),&lt;br /&gt;            ));&lt;br /&gt;        }&lt;/p&gt;&lt;p&gt;        return $fields;&lt;br /&gt;    }&lt;br /&gt;}&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;I was expecting the setValues() method to set the values of the fields before being presented on the new item form, but they are not. That section of code *is* executed though.&lt;/p&gt;&lt;p&gt;Any idea what could be going wrong, or how to set default values for DataObject fields that are not simple static values?&lt;/p&gt;&lt;p&gt;-- Jason&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Setting dynamic default values in a DataObject form [SOLVED] &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280289#post280289&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280289#post280289&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 05 Mar 2010 14:26:46 +1300</pubDate>
			<dc:creator>Judge</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280289#post280289</guid>
		</item>
		
		<item>
			<title>How to add search filter in ComplexTableFields in the cms</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280281#post280281</link>
			<description>&lt;p&gt;Hi there, &lt;br /&gt;I have added a dataobject in complextablefields to the cms but there are 300 rows in data. So I would like to add a simple search filter like in the image upload section to filter the results by names or something else. &lt;br /&gt;I have read the doc in &lt;br /&gt;&lt;a href=&quot;http://doc.silverstripe.org/doku.php?id=dataobject&quot;&gt;http://doc.silverstripe.org/doku.php?id=dataobject&lt;/a&gt;&lt;br /&gt;about this issue where mentions the followings:&lt;/p&gt;&lt;p&gt;$fields = singleton('MyDataObject')-&amp;gt;searchableFields();&lt;br /&gt;class MyDataObject extends DataObject {&lt;br /&gt;   static $searchable_fields = array(&lt;br /&gt;      'Name',&lt;br /&gt;      'ProductCode'&lt;br /&gt;   );&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;Here is my getCMSFields() function {&lt;/p&gt;&lt;p&gt;     $fields = parent::getCMSFields();&lt;/p&gt;&lt;p&gt;    $tablefield = new ComplexTableField(&lt;br /&gt;         $this,&lt;br /&gt;         'MyAdviser',&lt;br /&gt;         'Adviser',&lt;br /&gt;         array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;    'Name' =&amp;gt; &quot;Name&quot;,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&quot;Office&quot;=&amp;gt;&quot;Office&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;    'PostCode' =&amp;gt; 'PostCode',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Email' =&amp;gt; &quot;Email&quot;&lt;br /&gt;         ),&lt;br /&gt;         'getCMSFields_forPopup'&lt;br /&gt;      );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;br /&gt;          $tablefield-&amp;gt;setParentClass('FindAdviser');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  $tablefield-&amp;gt;setAddTitle('an Adviser');&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  $fields-&amp;gt;addFieldToTab( 'Root.Content.Adviser', $tablefield );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  return $fields;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;But I am not sure how I should put those  lines into my page and dataobject to make it work, I did give it a go but no luck so far. Can any one here point me the direction ? Many thanks in advance.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: How to add search filter in ComplexTableFields in the cms &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280281#post280281&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280281#post280281&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 05 Mar 2010 12:12:10 +1300</pubDate>
			<dc:creator>ss_freebie</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280281#post280281</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280233</link>
			<description>&lt;p&gt;Yes, i thought as much.&lt;/p&gt;&lt;p&gt;Pretty useful&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280233&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280233&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 04 Mar 2010 23:06:44 +1300</pubDate>
			<dc:creator>Pigeon</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280233</guid>
		</item>
		
		<item>
			<title>2 page types sharing a field but with different class</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280228#post280228</link>
			<description>&lt;p&gt;This looks like the right place to be asking this question.&lt;/p&gt;&lt;p&gt;Not an easy question to phrase so I'll explain what I am trying to do:&lt;/p&gt;&lt;p&gt;Class Page has an image of class Page_Image&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;public static $has_one=array('Image'=&amp;gt;'Page_Image');&lt;br /&gt;...&lt;br /&gt;$fields-&amp;gt;addFieldToTab('Root.Content.Images', new ImageField('Image', 'Page Image'));&lt;br /&gt;...&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;This works great, I have a Page_Image class that generates a couple of different sized images.&lt;/p&gt;&lt;p&gt;Tricky part comes when I add the ecommerce module where the Product class also has a field called &quot;Image&quot;, this is of Product_Image class though so I was expecting that when adding an image to a Product page it would be entered into the database as such but when I look it has a class of Page_Image and the image formats called in the templates don't work.&lt;/p&gt;&lt;p&gt;The behaviour I was hoping for was that the same field name could be used for both page types, keeping the CMS UI clean, and that the image variations would be generated depending on which page class was being used. I guess that's not how the data/object model works.&lt;/p&gt;&lt;p&gt;Is there a trick I'm missing or will I have to change the field name in the Page class and use a decorator to remove that field fro mthe CMS?&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;Rich&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: 2 page types sharing a field but with different class &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280228#post280228&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280228#post280228&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 04 Mar 2010 20:36:16 +1300</pubDate>
			<dc:creator>sicp</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280228#post280228</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280226</link>
			<description>&lt;p&gt;Yes, you can pass &lt;em&gt;WHERE&lt;/em&gt;, &lt;em&gt;SORT&lt;/em&gt;, &lt;em&gt;JOIN&lt;/em&gt; and &lt;em&gt;LIMIT&lt;/em&gt; as parameters in relation getters.&lt;br /&gt;AFAIK these actually map to the &lt;em&gt;getComponents&lt;/em&gt; and &lt;em&gt;getManyManyComponents&lt;/em&gt; methods in &lt;em&gt;sapphire/core/model/DataObject.php&lt;/em&gt;. At least that's the place I look up the parameter order when I forget it ;)&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280226&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280226&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 04 Mar 2010 19:45:12 +1300</pubDate>
			<dc:creator>banal</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280226</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280211</link>
			<description>&lt;p&gt;Mo,&lt;/p&gt;&lt;p&gt;I believe it does return a DOS, but it might just be a component set, i'm not sure. either way, you can manipulate it as usual.&lt;/p&gt;&lt;p&gt;I've only used this functionality once. A little gem i discovered by just 'trying it out', not documented anywhere that i could find.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280211&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280211&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 04 Mar 2010 13:11:25 +1300</pubDate>
			<dc:creator>Pigeon</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280211</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280209</link>
			<description>&lt;p&gt;Hmm, I wasn't aware you could do that. Would the getSortedmyDataObject() method return a dataobjectset of all linked dataobjects?&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280209&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280209&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 04 Mar 2010 11:55:49 +1300</pubDate>
			<dc:creator>Mo</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280209</guid>
		</item>
		
		<item>
			<title>Dataobjects vs Pages?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/280205#post280205</link>
			<description>&lt;p&gt;Hi guys,&lt;/p&gt;&lt;p&gt;I'm restructuring a site to incorporate some online ordering facilities for 1000+ products.&lt;/p&gt;&lt;p&gt;I'm just after some advise as setting up the product class to extend  pages vs. dataobject.  &lt;br /&gt;What are the pros/cons, and what would you guys consider best practise?&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Dataobjects vs Pages? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280205#post280205&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/280205#post280205&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Thu, 04 Mar 2010 11:19:50 +1300</pubDate>
			<dc:creator>pingu</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/280205#post280205</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280124</link>
			<description>&lt;p&gt;Surely the most simple solution to this is:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;function getSortedmyDataObject() {&lt;br /&gt;    return $this-&amp;gt;myDataObject(null,'LastEdited DESC');&lt;br /&gt;}&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;then in your template it is&lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;&amp;lt;% control SortedmyDataObject %&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;% end_control %&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280124&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280124&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Wed, 03 Mar 2010 21:46:15 +1300</pubDate>
			<dc:creator>Pigeon</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280124</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280123</link>
			<description>&lt;p&gt;Mo is right, try add the line he had written 'myPageID={$this-&amp;gt;ID}' into your query where you have hightlighted '...............?..............'&lt;br /&gt;just remember that 'myPageID' is depend on how you declared the relationship in your dataobject class. In your code it is:&lt;/p&gt;&lt;p&gt;static $belongs_many_many = array(&lt;br /&gt;'myPage'=&amp;gt;'myPage'&lt;br /&gt;); &lt;/p&gt;&lt;p&gt;if your real code is &lt;/p&gt;&lt;p&gt;static $belongs_many_many = array(&lt;br /&gt;'BelongToMyPage'=&amp;gt;'myPage'&lt;br /&gt;); &lt;/p&gt;&lt;p&gt;then in your query it would have to be 'BelongToMyPageID={$this-&amp;gt;ID}'&lt;/p&gt;&lt;p&gt;Hopefully I didn't make the matter worse. ^_^&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280123&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280123&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Wed, 03 Mar 2010 20:56:01 +1300</pubDate>
			<dc:creator>Ben_W</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280123</guid>
		</item>
		
		<item>
			<title>Re: how to sort dataobjects with many-to-many relationship?</title>
			<link>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280088</link>
			<description>&lt;p&gt;For this instance, the join should be generated automatically. Not sure exactly what you are trying to do, but maybe you should add something like:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;&quot;myPageID = {$this-&amp;gt;ID}&quot;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;This should add a filter to the returned myDataObject dataobjectset to only use dataobjects linked to the current page ID. Then you can use a control loop in your template to generate whatever html you want to display the data, EG:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;&amp;lt;% if MyObject %&amp;gt;&lt;br /&gt;    &amp;lt;ul&amp;gt;&lt;br /&gt;        &amp;lt;% control MyObject %&amp;gt;&lt;br /&gt;            &amp;lt;li&amp;gt;$YouObjectVariables&amp;lt;/li&amp;gt;&lt;br /&gt;        &amp;lt;% end_control %&amp;gt;&lt;br /&gt;    &amp;lt;/ul&amp;gt;&lt;br /&gt;&amp;lt;% end_if %&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;Is that the sort of thing you were after?&lt;/p&gt;&lt;p&gt;Mo&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: how to sort dataobjects with many-to-many relationship? &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280088&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/data-model-questions/reply/279966?start=0#post280088&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Wed, 03 Mar 2010 14:03:07 +1300</pubDate>
			<dc:creator>Mo</dc:creator>
			<guid>http://www.silverstripe.org/data-model-questions/show/279966?start=0#post280088</guid>
		</item>
		

	</channel>
</rss>