https://www.silverstripe.org/community/forums/rss injecting a new method into SiteTree to add functionality to page_type_classes()?? https://www.silverstripe.org/community/forums/data-model-questions/show/122392 <p>Morning, injecting a new method into SiteTree to add functionality to page_type_classes(). For some reason CMSMain::PageTypes() is now returning the name of the injector as the class name for all page types?</p> <br /> <p data-swiftype-index="false">Posted to: injecting a new method into SiteTree to add functionality to page_type_classes()?? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/122392" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/122392" class="replyLink">Post Reply</a></p> Mon, 02 Oct 2017 23:34:46 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/122392 Re: Emails not displaying correctly. Suspected Email Function issue. https://www.silverstripe.org/community/forums/data-model-questions/show/119043#post424376 <p>Better way (without hacking core) is to put this in your config.yml: </p><p><div class="codesnippet"><p>Mailer: <br /> default_message_encoding: 'base64'</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Emails not displaying correctly. Suspected Email Function issue. | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119043#post424376" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119043" class="replyLink">Post Reply</a></p> Fri, 22 Sep 2017 11:36:24 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119043#post424376 Re: write() updates _Live table only https://www.silverstripe.org/community/forums/data-model-questions/show/13385#post424032 <p>I am having a very similar problem, but years later. </p><p> $contact = Contact::create(); <br /> $form-&gt;saveInto($contact); <br /> $ret = $contact-&gt;write(); <br /> error_log("Wrote contact: $ret"); </p><p>In the error log I get the ID, but it is for the contact_live table. <br />I can find no method 'publish' <br />In the examples , the 'one ring rentals' case that I copied from there is no '_live' table. <br />i am perplexed</p> <br /> <p data-swiftype-index="false">Posted to: write() updates _Live table only | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/13385#post424032" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/13385" class="replyLink">Post Reply</a></p> Wed, 30 Aug 2017 10:13:47 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/13385#post424032 Re: Migrating to MySQL 5.7 https://www.silverstripe.org/community/forums/data-model-questions/show/119774#post423515 <p>My issue was in CWP "DatedUpdateHolder" in the ExtractMonths function. <br />Changed to: <br /><div class="codesnippet"><p>$dates = $updates-&gt;dataQuery() <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;groupby('YEAR("Date")') <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;groupby('MONTH("Date")') <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//-&gt;sort('Date', 'DESC') <br /> -&gt;sort('Year', 'DESC') <br /> -&gt;sort('Month', 'DESC') <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;query() <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;setSelect(array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Year' =&gt; 'YEAR("Date")', <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Month' =&gt; 'MONTH("Date")', <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;addWhere('"Date" IS NOT NULL') <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;execute();</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Migrating to MySQL 5.7 | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119774#post423515" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119774" class="replyLink">Post Reply</a></p> Wed, 12 Jul 2017 18:25:58 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119774#post423515 Re: Migrating to MySQL 5.7 https://www.silverstripe.org/community/forums/data-model-questions/show/119774#post423514 <p>Hit same issue today with SS 3.6.0 &amp; MySQL 5.7.18 <br /><div class="codesnippet"><p>SELECT DISTINCT YEAR("Date") AS "Year", MONTH("Date") AS "Month" <br />FROM "SiteTree_Live" <br />LEFT JOIN "Page_Live" ON "Page_Live"."ID" = "SiteTree_Live"."ID" <br />LEFT JOIN PortalUpdatePage_Live ON PortalUpdatePage_Live.ID = SiteTree_Live.ID <br />WHERE (SiteTree_Live.ParentID = ?) <br /> AND ("SiteTree_Live"."ClassName" IN (?, ?)) <br /> AND ("SiteTree_Live"."SubsiteID" IN (0)) <br /> AND ("SiteTree_Live"."Locale" = 'en_NZ') <br /> AND ("Date" IS NOT NULL) <br />GROUP BY YEAR("Date"), MONTH("Date") <br />ORDER BY "Date" DESC</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Migrating to MySQL 5.7 | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119774#post423514" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119774" class="replyLink">Post Reply</a></p> Wed, 12 Jul 2017 16:53:25 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119774#post423514 Get the Year of a date https://www.silverstripe.org/community/forums/data-model-questions/show/121281 <p>Hi everyone, i have dates defined in a dataobject like so </p><p>private static $db = array( <br /> 'DateStart'=&gt;'Date', <br /> 'DateEnd'=&gt;'Date', <br /> ); </p><p>when i try to get the Year by <br />$DateStart-&gt;Year() or $DateStart-&gt;Format('YYYY') or any kind of function, it's always either blank or i get an error. <br />I tried everything i could since hours, i still get no results. </p><p>So, what is the function i'm meant to use to get the Year, month and day of "Date" Object in the php file ? </p><p>Any help is welcome, thanks</p> <br /> <p data-swiftype-index="false">Posted to: Get the Year of a date | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121281" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121281" class="replyLink">Post Reply</a></p> Tue, 11 Jul 2017 03:36:29 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121281 Re: has_many and template https://www.silverstripe.org/community/forums/data-model-questions/show/121269#post423495 <p>The solution is here: <a href="https://stackoverflow.com/questions/44906667/how-to-render-has-many-in-template">https://stackoverflow.com/questions/44906667/how-to-render-has-many-in-template</a></p> <br /> <p data-swiftype-index="false">Posted to: has_many and template | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121269#post423495" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121269" class="replyLink">Post Reply</a></p> Wed, 05 Jul 2017 19:52:04 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121269#post423495 has_many and template https://www.silverstripe.org/community/forums/data-model-questions/show/121269 <p>I have two classes : Letter and LetterFiles (attached files to the letter): <br /><div class="codesnippet"><p>Class Letter extends DataObject { <br /> private static $db = array ( <br /> &nbsp;&nbsp;&nbsp; 'Sender' =&gt; 'Text', <br />&nbsp;&nbsp;&nbsp; 'SendTo' =&gt; 'Text', <br />……&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> ); <br /> private static $has_many = array ( <br /> &nbsp;&nbsp;&nbsp;'Letters' =&gt; 'LetterFiles' ); <br />&nbsp;&nbsp;&nbsp;); <br />…… <br />} </p><p>Class LetterFiles extends File { <br /> private static $has_one = array ( <br /> &nbsp;&nbsp;&nbsp;'Files' =&gt; 'Letter' <br /> ); <br />......... <br /> }</p></div> </p><p>I want to show all letters and all attached files on LetterPage: <br /><div class="codesnippet"><p>class LetterPage extends Page { <br />&nbsp;&nbsp;&nbsp;private $db = array(); <br />} </p><p>class LetterPage_Controller extends Page_Controller { <br /> public function index () { <br /> $letters = Letter::get()-&gt;sort('DateUpload'); <br /> return array ( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AllLetters' =&gt; $letters <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;); </p><p>}</p></div> </p><p>I want to use template LetterPage.ss: <br /><div class="codesnippet"><p>&lt;% loop $AllLetters %&gt; <br /> &lt;tr&gt; <br /> ……. <br /> &lt;td&gt;$Sender&lt;/td&gt; <br /> &lt;td&gt;$SendTo&lt;/td&gt; <br /> &lt;td&gt;$Theme&lt;/td&gt; <br /> &lt;td&gt; <br /> &lt;% loop $Files %&gt; <br /> $Name <br /> &lt;% end_loop %&gt; </p><p> &lt;/td&gt; </p><p> &lt;/tr&gt; <br />&lt;% end_loop %&gt;</p></div> <br />But it doesn't render attached files. <br />Please, give me any ideas.</p> <br /> <p data-swiftype-index="false">Posted to: has_many and template | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121269" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121269" class="replyLink">Post Reply</a></p> Thu, 29 Jun 2017 21:02:31 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121269 Re: is it possible to make Diff::compareHTML() to ignore HTML attributes? https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423466 <p>OK, maybe this can be of help to you: </p><p>I made some changes to Diff::compareHTML(). Normally it will create two arrays $from and $to, and feed them to a new Diff(). But for this purpose the MappedDiff class may be the better choice: it takes 4 arrays: the original $from and $to, and a second set of arrays that contain the values you actually want to compare. (Note this is SilverStripe 3.6)</p><p>So I created the second set by looping through the original arrays and removing all attributes using a regexp I found here: <a href="https://stackoverflow.com/questions/3026096/remove-all-attributes-from-an-html-tag">https://stackoverflow.com/questions/3026096/remove-all-attributes-from-an-html-tag</a> (there may/will be better ways, but hey :) )</p><p>This is the code I altered (Diff.php #700):</p><p></p><div class="codesnippet"><p>   public static function compareHTML($from, $to, $escape = false) {<br>      // First split up the content into words and tags<br>      // Martimiz: renamed the variables to make things more readable<br>      $arrFrom = self::getHTMLChunks($from);<br>      $arrTo = self::getHTMLChunks($to);</p><p>      // Martimiz: next create the mapped versions, with all attributes removed<br>      $mappedFrom = array();<br>      foreach ($arrFrom as $item) {</p><p>         if (isset($item[0]) &amp;&amp; $item[0] == '&lt;') {<br>            $mappedItem = preg_replace("/&lt;([a-z][a-z0-9]*)[^&gt;]*?(\/?)&gt;/i",'&lt;$1$2&gt;', $item);<br>         } else {<br>            $mappedItem = $item;<br>         }<br>         $mappedFrom[] = $mappedItem;<br>      }</p><p>      $mappedTo = array();<br>      foreach ($arrTo as $item) {</p><p>         if (isset($item[0]) &amp;&amp; $item[0] == '&lt;') {<br>            $mappedItem = preg_replace("/&lt;([a-z][a-z0-9]*)[^&gt;]*?(\/?)&gt;/i",'&lt;$1$2&gt;', $item);<br>         } else {<br>            $mappedItem = $item;<br>         }<br>         $mappedTo[] = $mappedItem;<br>    }</p><p>      // Diff that<br>      // Martimiz:: use renamed variables<br>      //$diff = new Diff($arrFrom, $arrTo);</p><p>      // Martimiz: use MappedDiff<br>      $diff = new MappedDiff($arrFrom, $arrTo, $mappedFrom, $mappedTo);</p><p>      ...</p></div><p>Tested it with:</p><p></p><div class="codesnippet"><p>$from = '&lt;p class="left"&gt;test&lt;/p&gt;&lt;p&gt;old&lt;/p&gt;';<br> $to = '&lt;p class="right"&gt;test&lt;/p&gt;&lt;p&gt;new&lt;/p&gt;';</p><p> $diff = Diff::compareHTML($from, $to);</p><p> var_export($diff);</p></div><p>The original function gave me this:</p><p></p><div class="codesnippet"><p>&lt;ins&gt;&lt;p class="right"&gt; test &lt;/p&gt;&lt;/ins&gt; &lt;del&gt;&lt;p class="left"&gt; test &lt;/p&gt;&lt;/del&gt; &lt;p&gt; &lt;ins&gt;new&lt;/ins&gt; &lt;del&gt;old&lt;/del&gt; &lt;/p&gt;</p></div><p>The new version gave me this:<br></p><div class="codesnippet"><p>&lt;p class="left"&gt; test &lt;/p&gt; &lt;p&gt; &lt;ins&gt;new&lt;/ins&gt; &lt;del&gt;old&lt;/del&gt; &lt;/p&gt;</p></div><p>note that the &lt;p class="left"&gt; is now considered not changed, so it still displays the old version. But that would be logical... Nice puzzle :)</p> <br> <p data-swiftype-index="false">Posted to: is it possible to make Diff::compareHTML() to ignore HTML attributes? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423466" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119137" class="replyLink">Post Reply</a></p> Fri, 23 Jun 2017 08:52:28 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423466 Re: is it possible to make Diff::compareHTML() to ignore HTML attributes? https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423465 <p>Thank you martimiz for your reply and for a tip about StackOverflow. You might be right about that this question perhaps doesn't suit for the style of StackOverflow, but it's good to know that StackOverflow generally has more active people answering complicated questions though :). </p><p>SilverStripe uses the Diff class in the "compare" view between two versions of a single Page. (This can be found in the History tab in the CMS). I guess it's not the most used feature in the backend, so perhaps that's why the class was not developed to generate the most polished output.</p> <br /> <p data-swiftype-index="false">Posted to: is it possible to make Diff::compareHTML() to ignore HTML attributes? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423465" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119137" class="replyLink">Post Reply</a></p> Fri, 23 Jun 2017 02:18:30 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423465 Re: is it possible to make Diff::compareHTML() to ignore HTML attributes? https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423459 <p>Hi, I'm sorry - I have no direct answer. In fact I didn't even know that class exists :( I'm kind of intrigued and would like to help but at this point I can't even fathom how this class would be used :( </p><p>Anyway, I'm afraid the forum might not be the best place for this question, as it's not overly active and this is a very specific question. The folks over at Stackoverflow are more active - then again I'm not quite sure if this is a stackoverflow kind of question... </p><p>Anyway, just wanted to let you know that someone did hear you :)</p> <br /> <p data-swiftype-index="false">Posted to: is it possible to make Diff::compareHTML() to ignore HTML attributes? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423459" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119137" class="replyLink">Post Reply</a></p> Thu, 22 Jun 2017 03:06:25 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423459 Re: is it possible to make Diff::compareHTML() to ignore HTML attributes? https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423408 <p>Bump, anyone? :) And the answer doesn't have to be for the current Diff class of SilverStripe. If you happen to have good experiences of some other Diff library, please share your thoughts and I will try it out. Thanks!</p> <br /> <p data-swiftype-index="false">Posted to: is it possible to make Diff::compareHTML() to ignore HTML attributes? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423408" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119137" class="replyLink">Post Reply</a></p> Thu, 15 Jun 2017 00:00:23 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119137#post423408 Time Based Graph Data Modeling https://www.silverstripe.org/community/forums/data-model-questions/show/121216 <p>I have a data modeling question. The data that I have is basically nodes with relations to other nodes. Nodes have properties. Edges are directional and have properties. I am exploring if a Graph DB like Neo4j will be appropriate or not. </p><p>The doubt is because: The data that I have is time based. It changes on the basis of time, and I need to keep track of the historical data as well. For example, I should be able to query: </p><p>What was the graph like on a particular date? <br />Who all did a given node depend on at a particular time? <br />What were the properties of the edge between two given nodes at a particular time? <br />I searched but couldn't find a satisfactory resource where I could understand how time can be factored into a Graph DB. Do you think my requirement can be inherently met using a Graph DB? Is there an example/resource/article which describes this for Neo4j or any other graph db? </p><p>I want to make sure that the database is scalable to about 100K nodes, and millions of edges. I am optimizing for time over space.</p> <br /> <p data-swiftype-index="false">Posted to: Time Based Graph Data Modeling | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121216" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121216" class="replyLink">Post Reply</a></p> Tue, 06 Jun 2017 21:30:55 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121216 Re: How to store a DataObject's table in another database https://www.silverstripe.org/community/forums/data-model-questions/show/121193#post423387 <p>Damned, this forum made me to lose the long answer that I just wrote :(. This has happened to me many times in the past and now it stroke again! Write a message so long that your session expires, click the Post button and then: BOOM! The only thing you can see is an error message telling that you are not logged in anymore. Tell goodbye to your long string of typed letters and watch them fade away. :( </p><p>Thanks for your suggestion, martimiz. Now that my answer is buried deep in the graveyard of cyberspace , I will just say shortly that I did develop this feature using secureassets but then I just wanted to switch to use a database for this. It makes certain things more simple, such as data encryption (which I even managed to do with secureassets + encrypt-at-rest + own code, but there were other reasons too to start using a database for this). All the reasons are in the post I just wrote and which can be found at... nowhere! :D </p><p>And sorry, no pun intended when I complain about the behaviour of this forum. It's a great forum with just this one inconvenience! :)</p> <br /> <p data-swiftype-index="false">Posted to: How to store a DataObject&#039;s table in another database | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121193#post423387" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121193" class="replyLink">Post Reply</a></p> Sat, 03 Jun 2017 00:25:39 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121193#post423387 Re: How to store a DataObject's table in another database https://www.silverstripe.org/community/forums/data-model-questions/show/121193#post423362 <p>First - sorry, I haven't thought of solution for your original question. But another option might be to use the secure assests module? </p><p><a href="http://addons.silverstripe.org/add-ons/silverstripe/secureassets">http://addons.silverstripe.org/add-ons/silverstripe/secureassets</a> </p><p>Have every user create his own filefolder, maybe based on the emailaddress, or the user ID. It should be possible to secure the folder on creation to be only accessible to the user and Admin...</p> <br /> <p data-swiftype-index="false">Posted to: How to store a DataObject&#039;s table in another database | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121193#post423362" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121193" class="replyLink">Post Reply</a></p> Sun, 28 May 2017 00:56:26 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121193#post423362 How to store a DataObject's table in another database https://www.silverstripe.org/community/forums/data-model-questions/show/121193 <p>Hi, </p><p>is there any simple way to define another database for a specific DataObject? I know that I can use DB::connect() to create a connection to the other database and this is what I will be doing if I don't find a feature in SilverStripe itself that would do this for me. But then I have to create all the database queries myself - which is not too much of work in this case - but it's certainly more work than what it would be to use the ORM. And I also need to write a table creation query manually. </p><p>Thanks for your support! :) </p><p>Background: I'm going to implement a feature that allows registered users to upload their own attachments and I don't want them to appear in the assets folder due to security reasons (other members are NOT allowed to be able to see attachments uploaded by others), so storing them in the database makes sense. Also this way I don't have to worry about duplicate filenames in the system. Setting up another database for this is just for keeping the main database light weighted - easier to transfer data between production and development. The databases can reside on the same server and even use the same MySQL user to avoid the hassle with different passwords.</p> <br /> <p data-swiftype-index="false">Posted to: How to store a DataObject&#039;s table in another database | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/121193" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/121193" class="replyLink">Post Reply</a></p> Thu, 25 May 2017 21:09:22 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/121193 DBField: Is it possible to get access to the owner DataObject? https://www.silverstripe.org/community/forums/data-model-questions/show/120796 <p>Hi, </p><p>this question may have a simple solution, but unfortunately I was not able to solve it by looking at the source code of DBField. </p><p>I have a custom DBField, actually inherited from Text, so let's define it for example like this: </p><p><div class="codesnippet"><p>class CustomField extends Text <br />{ <br /> // ... <br /> public function getValue() <br /> { <br /> //Some custom logic to retrieve the value <br /> } <br /> // ... <br />}</p></div> </p><p>Is there any way for me to find out which DataObject owns this particular field? I would need this information in the getValue() method. Something like $this-&gt;owner like we are able to use in Extensions or something different? </p><p>Thanks! :)</p> <br /> <p data-swiftype-index="false">Posted to: DBField: Is it possible to get access to the owner DataObject? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/120796" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/120796" class="replyLink">Post Reply</a></p> Thu, 04 May 2017 23:14:48 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/120796 Re: DataObject Relationships - two has_many that relate to each other https://www.silverstripe.org/community/forums/data-model-questions/show/120736#post422929 <p>Had to answer this myself, but here is the link, in case it helps anyone else </p><p><a href="https://stackoverflow.com/questions/43721040/silverstripe-dataobject-relationships-two-has-many-that-relate-to-each-other/43744690#43744690">https://stackoverflow.com/questions/43721040/silverstripe-dataobject-relationships-two-has-many-that-relate-to-each-other/43744690#43744690</a></p> <br /> <p data-swiftype-index="false">Posted to: DataObject Relationships - two has_many that relate to each other | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/120736#post422929" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/120736" class="replyLink">Post Reply</a></p> Wed, 03 May 2017 06:21:10 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/120736#post422929 DataObject Relationships - two has_many that relate to each other https://www.silverstripe.org/community/forums/data-model-questions/show/120736 <p>After several hours and some Google Searching, i have run out of steam on this issue and could use some help. </p><p>So, the parent object is called Offer. <br />Each offer has two has_many objects : ItineraryItem and ItineraryTab <br />Now, the main issue i have is the relationship between these two objects. <br />I am trying to get it so that each Itinerary Item can have more than one Itinerary Tab, as I am trying to render the items in a tabbed list. </p><p>I have tried the following (which is constantly giving me errors when i try to get the offer content, so i am sure there is something wrong) </p><p><div class="codesnippet"><p>//Offer.php <br />$has_many = array( <br /> "ItineraryItems" =&gt; "ItineraryItem", <br /> "ItineraryTabs" =&gt; "ItineraryTab" <br />); </p><p>// On ItineraryItem <br />$has_one = array( <br /> "Offer" =&gt; "Offer" <br />); <br />$many_many = array( <br /> "ItineraryItems" =&gt; "ItineraryItem" <br />); </p><p>// on ItineraryItem <br />$has_one = array( <br /> "Offer" =&gt; "Offer" <br />); <br />$belongs_many_many = array( <br /> "ItineraryTabs" =&gt; "ItineraryTab" <br />);</p></div> </p><p>Now, i am sure that there is a simple solution here, and i have simply been looking at it too long to see it. Please help! </p><p>Thanks in advance</p> <br /> <p data-swiftype-index="false">Posted to: DataObject Relationships - two has_many that relate to each other | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/120736" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/120736" class="replyLink">Post Reply</a></p> Sat, 29 Apr 2017 12:04:41 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/120736 Re: Remove/hide delete button from admin edit form section https://www.silverstripe.org/community/forums/data-model-questions/show/120046#post422799 <p>Hi, </p><p>OK I've solved it now using just canDelete() function, so the code should look like this: </p><p><div class="codesnippet"><p>class PackageBuilderProduct extends DataObject { </p><p> public static $db = array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'SortOrder' =&gt; 'Int', <br /> 'Title' =&gt; 'Varchar(128)', <br /> 'Description' =&gt; 'Varchar(255)' <br /> ); </p><p> static $has_one = array( <br /> 'PackageBuilderPage' =&gt; 'PackageBuilderPage' <br /> ); <br />&nbsp;&nbsp;&nbsp; <br /> static $summary_fields = array( <br /> 'Title' =&gt; 'Title', <br /> 'Description' =&gt; 'Description' <br /> ); <br />&nbsp;&nbsp;&nbsp; <br /> public function getCMSFields() { </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields = parent::getCMSFields(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;removeByName("SortOrder"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;addFieldToTab('Root.Main', new TextField('Title', 'Title')); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;addFieldToTab('Root.Main', new TextField('Description', 'Description')); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $fields; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> } </p><p>&nbsp;&nbsp;&nbsp;public function canDelete($member = null) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false; <br />&nbsp;&nbsp;&nbsp;} </p><p>}</p></div> </p><p>It really hard to find any info on this matter in the internet, it's easy to find information on how to remove delte button from grid field: </p><p><div class="codesnippet"><p>removeComponentsByType('GridFieldDeleteAction')</p></div> </p><p>But delete button will still show up on the edit page, above method allows to remove it, hope this will help some more people in the future. </p><p>Thanks, L.</p> <br /> <p data-swiftype-index="false">Posted to: Remove/hide delete button from admin edit form section | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/120046#post422799" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/120046" class="replyLink">Post Reply</a></p> Thu, 06 Apr 2017 20:55:44 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/120046#post422799 Remove/hide delete button from admin edit form section https://www.silverstripe.org/community/forums/data-model-questions/show/120046 <p>Hi, </p><p>I need to remove 'Delete button' from form edit page in admin panel - like the one highlited on the picture below: </p><p><img src="http://i.imgur.com/zijE2F0.png" /> </p><p>I have following code (PackageBuilderProductController) but it doesn't work, any ideas how to do it? </p><p><div class="codesnippet"><p>class PackageBuilderProduct extends DataObject { </p><p> public static $db = array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'SortOrder' =&gt; 'Int', <br /> 'Title' =&gt; 'Varchar(128)', <br /> 'Description' =&gt; 'Varchar(255)' <br /> ); </p><p> static $has_one = array( <br /> 'PackageBuilderPage' =&gt; 'PackageBuilderPage' <br /> ); <br />&nbsp;&nbsp;&nbsp; <br /> static $summary_fields = array( <br /> 'Title' =&gt; 'Title', <br /> 'Description' =&gt; 'Description' <br /> ); <br />&nbsp;&nbsp;&nbsp; <br /> public function getCMSFields() { </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields = parent::getCMSFields(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;removeByName("SortOrder"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;addFieldToTab('Root.Main', new TextField('Title', 'Title')); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;addFieldToTab('Root.Main', new TextField('Description', 'Description')); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $fields; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> } <br />&nbsp;&nbsp;&nbsp; <br />} </p><p>class PackageBuilderProductController extends ModelAdmin { </p><p>&nbsp;&nbsp;&nbsp;public function getEditForm($ID = null, $Fields = null) <br />&nbsp;&nbsp;&nbsp;{ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$form = parent::getEditForm($ID, $Fields); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields = $form-&gt;Fields(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields-&gt;removeByName('action_doDelete'); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $fields; <br />&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp; <br />}</p></div> </p><p>Thanks, L.</p> <br /> <p data-swiftype-index="false">Posted to: Remove/hide delete button from admin edit form section | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/120046" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/120046" class="replyLink">Post Reply</a></p> Thu, 06 Apr 2017 02:03:15 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/120046 Re: Emails not displaying correctly. Suspected Email Function issue. https://www.silverstripe.org/community/forums/data-model-questions/show/119043#post422054 <p>Hello,</p><p>In /framework/email find Mailer.php and change:</p><p>[-] private static $default_message_encoding = 'quoted-printable';<br>[+] private static $default_message_encoding = 'base64';</p><p>save and do ?flush</p><p>Works like charm ;)</p> <br> <p data-swiftype-index="false">Posted to: Emails not displaying correctly. Suspected Email Function issue. | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119043#post422054" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119043" class="replyLink">Post Reply</a></p> Wed, 05 Apr 2017 01:34:19 +1200 https://www.silverstripe.org/community/forums/data-model-questions/show/119043#post422054 Define a relationship to a many_many relationship https://www.silverstripe.org/community/forums/data-model-questions/show/119942 <p>In summary, I have 3 models here: </p><p>- Level (Primary, Secondary and University etc... A level can have many subjects) <br />- Subject (Science, English, Mandarin, Chemistry and etc... A Subject belongs to many Level) <br />- Tutor (The tutor... A Tutor can teach many subject on different Level) </p><p><div class="codesnippet"><p>class Level extends DataObject <br />{ <br /> private static $db = array( <br /> 'Title' =&gt; 'VARCHAR(50)', <br /> ); <br /> private static $many_many = array( <br /> 'Subjects' =&gt; 'Subject', <br /> ); <br />} </p><p>class Subject extends DataObject <br />{ <br /> private static $db = array( <br /> 'Title' =&gt; 'VARCHAR(50)', <br /> ); </p><p> private static $belongs_many_many = array( <br /> 'Levels' =&gt; 'Level', <br /> ); <br />}</p></div> </p><p>Above is the 2 DataObjects but I am a little stucked on the Tutor DataObject. I don't think I can do a $has_many to Subject reason being, it needs to directly refer to the relationship because a Tutor might be teaching University-Science and Primary-Science, but not Secondary-Science. </p><p>I see my database have a Level_Subject table that acts as the many_many link between the 2 object. But how do I relate Tutor to this?</p> <br /> <p data-swiftype-index="false">Posted to: Define a relationship to a many_many relationship | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119942" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119942" class="replyLink">Post Reply</a></p> Thu, 30 Mar 2017 21:03:58 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119942 SiteTree TreeDropdownField always readonly https://www.silverstripe.org/community/forums/data-model-questions/show/119941 <p>Hello, <br />I have two (separate) DataObject subclasses, each containing a $has_one like this: <br /><div class="codesnippet"><p>private static $has_one = array( <br />&nbsp;&nbsp;&nbsp;'PageLink'=&gt;'SiteTree', <br />&nbsp;&nbsp;&nbsp;'Picture'=&gt;'Image' <br />);</p></div> <br />and in getCMSFields, <br /><div class="codesnippet"><p>TreeDropdownField::create('PageLinkID', 'Optional page to link to', 'SiteTree'),</p></div> <br />but in the CMS, it always appears as readonly (i.e. just the name of what it's linking to, and viewing source shows "treedropdownfield_readonly"). Even when I explicitly make it not readonly afterwards. <br />What's really weird is that if I change $has_one to <br /><div class="codesnippet"><p>private static $has_one = array( <br />&nbsp;&nbsp;&nbsp;'PageLink'=&gt;'SiteTree', <br />&nbsp;&nbsp;&nbsp;'Dummy'=&gt;'SiteTree', <br />&nbsp;&nbsp;&nbsp;'Picture'=&gt;'Image' <br />);</p></div> <br />it is no longer readonly (but creating a TreeDropdownField for Dummy is readonly). Any ideas what the problem could be? This is driving me partially insane. </p><p>On a secondary note, having <div class="codesnippet"><p>'Picture.SetWidth(100)'=&gt;'Picture',</p></div> in my $summary_fields doesn't make it display, but using a custom method does. Is this related? </p><p>All help is greatly appreciated.</p> <br /> <p data-swiftype-index="false">Posted to: SiteTree TreeDropdownField always readonly | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119941" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119941" class="replyLink">Post Reply</a></p> Thu, 30 Mar 2017 19:40:55 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119941 Re: Versioned DataObjects not deleted from all Stages when DataObject->delete() is called https://www.silverstripe.org/community/forums/data-model-questions/show/111738#post421998 <p>Can't fully remember what the solution was here I'm afraid! I think we probably came up with a workaround.</p> <br /> <p data-swiftype-index="false">Posted to: Versioned DataObjects not deleted from all Stages when DataObject-&gt;delete() is called | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/111738#post421998" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/111738" class="replyLink">Post Reply</a></p> Mon, 20 Mar 2017 13:33:31 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/111738#post421998 Re: Versioned DataObjects not deleted from all Stages when DataObject->delete() is called https://www.silverstripe.org/community/forums/data-model-questions/show/111738#post421988 <p>Hi @nzphoenix, </p><p>Do you get any solution on that, I am facing the same problem when I tried to delete dataobject from model admin. <br />Silverstripe version 3.5</p> <br /> <p data-swiftype-index="false">Posted to: Versioned DataObjects not deleted from all Stages when DataObject-&gt;delete() is called | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/111738#post421988" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/111738" class="replyLink">Post Reply</a></p> Fri, 17 Mar 2017 20:19:23 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/111738#post421988 Re: [SOLVED] URL slug instead of ID on DataObject? https://www.silverstripe.org/community/forums/data-model-questions/show/8526?start=8#post421850 <p>I <em>think</em> it should be SiteTree::create()-&gt;<br>eg.<br></p><div class="codesnippet"><p>public function onBeforeWrite () {<br>      parent::onBeforeWrite ();<br>      if($this-&gt;Title) { $this-&gt;Fieldname = SiteTree::create()-&gt;generateURLSegment($this-&gt;Title); }<br>   }</p></div> <br> <p data-swiftype-index="false">Posted to: [SOLVED] URL slug instead of ID on DataObject? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/8526?start=8#post421850" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/8526" class="replyLink">Post Reply</a></p> Wed, 08 Mar 2017 03:50:22 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/8526?start=8#post421850 Is not created new page type https://www.silverstripe.org/community/forums/data-model-questions/show/119789 <p>A new page type is not created. My code: <br /><div class="codesnippet"><p>&lt;?php <br />/** <br /> * Defines the SimplePage page type <br /> */ <br />class SimplePage extends Page { <br />&nbsp;&nbsp;&nbsp;public $image_sizes = array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'qatestlab' =&gt; array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AnonsImage'&nbsp;&nbsp;&nbsp;=&gt;&nbsp;&nbsp;&nbsp;array('x'=&gt;83, 'y'=&gt;83, 'fn'=&gt;'SetCroppedSize'), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'web100' =&gt; array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AnonsImage'&nbsp;&nbsp;&nbsp;=&gt;&nbsp;&nbsp;&nbsp;array('x'=&gt;300, 'y'=&gt;130, 'fn'=&gt;'SetCroppedSize'), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;), <br />&nbsp;&nbsp;&nbsp;); </p><p>&nbsp;&nbsp;&nbsp;static $default_sort = 'Created DESC'; </p><p>&nbsp;&nbsp;&nbsp;function getCMSFields() { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields = parent::getCMSFields(); </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$img_field = $fields-&gt;dataFieldByName('BigAnonsImage'); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$img_field-&gt;SetSizes(array('x'=&gt;200, 'y'=&gt;136, 'fn'=&gt;'SetCroppedSize')); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$img_field-&gt;setTitle('Will be displayed on the page itself: &lt;a target="_blank" href="/'.$this-&gt;owner-&gt;Link().'/"&gt;'.$this-&gt;owner-&gt;ClassName.'&lt;/a&gt;'); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $fields; <br />&nbsp;&nbsp;&nbsp;} <br />} </p><p>class SimplePage_Controller extends Page_Controller { <br />&nbsp;&nbsp;&nbsp;function EditURL(){ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "/admin/pages/show/".$this-&gt;ID."/"; <br />&nbsp;&nbsp;&nbsp;} </p><p>}</p></div> </p><p>Next I do site.com/dev/build and site.com?flush=all But there is no new page type in the admin panel and in the database</p> <br /> <p data-swiftype-index="false">Posted to: Is not created new page type | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119789" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119789" class="replyLink">Post Reply</a></p> Wed, 08 Mar 2017 00:21:31 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119789 Re: How to Sort Includes using a loop https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421828 <p>If the control works but the loop doesn't, then maybe it's this typo in the end tag? <br /><div class="codesnippet"><p>&lt;% end_loop%&gt;</p></div> </p><p>edit: Nope. The space does not seem to matter for the loop.</p> <br /> <p data-swiftype-index="false">Posted to: How to Sort Includes using a loop | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421828" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119773" class="replyLink">Post Reply</a></p> Sat, 04 Mar 2017 05:16:29 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421828 Re: How to Sort Includes using a loop https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421827 <p>Is there anyone that can help me with this? I have been browsing weeks through the SS forum, but I am still not able to find a solution. It is probably very easy, but I am still learning. </p><p>Thank you! </p><p>Wesley</p> <br /> <p data-swiftype-index="false">Posted to: How to Sort Includes using a loop | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421827" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119773" class="replyLink">Post Reply</a></p> Fri, 03 Mar 2017 21:46:07 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421827 Migrating to MySQL 5.7 https://www.silverstripe.org/community/forums/data-model-questions/show/119774 <p>Hi all,</p><p>We have been trying to migrate one of our Silverstripe websites to a new server running MySQL 5.7. We have already updated our SS version to 3.5.3.</p><p>We've been experiencing issues with the <strong>sql_mode=only_full_group_by</strong>, example of error below:</p><p></p><div class="codesnippet"><p>[User Error] Uncaught SS_DatabaseException: Couldn't run query: SELECT DISTINCT "Download"."ClassName", "Download"."LastEdited", "Download"."Created", "Download"."Title", "Download"."ShowOnInstruments", "Download"."Restricted", "Download"."Index", "Download"."Slug", "Download"."FileID", "Download"."InstrumentID", "Download"."CategoryID", "Download"."ID", CASE WHEN "Download"."ClassName" IS NOT NULL THEN "Download"."ClassName" ELSE 'Download' END AS "RecordClassName" FROM "Download" WHERE ("CategoryID" = ?) GROUP BY FileID ORDER BY "Download"."Index" ASC, "Download"."Title" ASC Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'bolton-surgical.Download.ClassName' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by<br>GET /downloads/<br>Line 55 in /srv/users/bolton/apps/bolton-surgical/public/framework/model/connect/DBConnector.php</p></div><p>We have already disabled strict sql mode in MySQL 5.7 on our server, which points to something inside SS overriding this setting. </p><p>Has anyone had experience with this issue? I did notice this page on the SS GitHub page: <a href="https://github.com/silverstripe/silverstripe-framework/issues/5451">https://github.com/silverstripe/silverstripe-framework/issues/5451</a> but I don't think it actually shares a solution?</p><p>thanks</p><p>Matt.</p> <br> <p data-swiftype-index="false">Posted to: Migrating to MySQL 5.7 | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119774" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119774" class="replyLink">Post Reply</a></p> Fri, 03 Mar 2017 00:40:22 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119774 Re: How to Sort Includes using a loop https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421814 <p>Hi dhensby, </p><p>None of the includes are currently being displayed. </p><p>The funny thing is when I do: </p><p><div class="codesnippet"><p>&lt;% control $Children.Sort(OrderHomePage, ASC) %&gt; <br />&nbsp;&nbsp;&nbsp; &lt;h1&gt;What is the order&lt;/h1&gt; $OrderHomePage &lt;h2&gt;$Title&lt;/h2&gt; <br />&lt;% end_control %&gt;</p></div> <br />It nicely outputs the Order and the Correct Page name. So the Sort seems to work, but somehow it does not sort the blocks with the includes of the Page Types.</p> <br /> <p data-swiftype-index="false">Posted to: How to Sort Includes using a loop | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421814" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119773" class="replyLink">Post Reply</a></p> Thu, 02 Mar 2017 05:22:17 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421814 Re: How to Sort Includes using a loop https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421813 <p>From first glance it looks like this should work. What aspect isn't working? Is there an error does the sort just not change? </p><p>You could start by debugging the SQL queries being made to see if the sort clause is being correctly added. </p><p>Alternatively you could make a function on your controller to return the ordered children rather than calling sort in the template.</p> <br /> <p data-swiftype-index="false">Posted to: How to Sort Includes using a loop | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421813" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119773" class="replyLink">Post Reply</a></p> Thu, 02 Mar 2017 05:02:49 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119773#post421813 How to Sort Includes using a loop https://www.silverstripe.org/community/forums/data-model-questions/show/119773 <p>Hi, </p><p>I am currently working on a one page website. I would like to order the different content blocks in the cms. So I made for all page types an Integer field "OrderHomePage" where I can set the order of the section. </p><p>On the homepage (homepage.ss) I have included all Page Types and added a Loop. I was expecting that the includes would in the correct order according to the value that was set for "OrderHomePage", but this does not work. Is there another easy way how to sort these sections? </p><p><div class="codesnippet"><p>&lt;% loop $Children.Sort(OrderHomePage, ASC) %&gt; </p><p> &lt;% if $SliderHomePageCheck == "1" %&gt; <br /> &nbsp;&nbsp;&nbsp;&lt;% include SliderPage %&gt; <br /> &lt;% end_if %&gt; </p><p> &nbsp;&nbsp;&nbsp;&lt;!--************************************ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Main Start <br /> &nbsp;&nbsp;&nbsp;*************************************--&gt; <br /> &nbsp;&nbsp;&nbsp; &lt;main id="tg-main" class="tg-main tg-haslayout"&gt; </p><p> &nbsp;&nbsp;&nbsp;&lt;% if $NewsHomePageCheck == "1" %&gt; <br /> &lt;!--Start News Page with general info!--&gt; <br /> &lt;% include NewsPage %&gt; <br /> &lt;!--End NewsPage with general info!--&gt; <br />&nbsp;&nbsp;&nbsp;&lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $EventHomePageCheck == "1" %&gt; <br /> &lt;!--Start Event Page with general info!--&gt; <br /> &lt;% include EventPage %&gt; <br /> &lt;!--End Event Page with general info!--&gt; <br /> &lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $EventDetailHomePageCheck == "1" %&gt; <br /> &lt;!--Start Event Page with detailed info!--&gt; <br /> &lt;% include EventDetailPage %&gt; <br /> &lt;!--End Event Page with detailed info!--&gt; <br /> &lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $MatchMakingHomePageCheck == "1" %&gt; <br /> &lt;!--Start Match Making Page!--&gt; <br /> &lt;% include MatchMakingPage %&gt; <br /> &lt;!--End Match Making Page!--&gt; <br /> &lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $MediaTeaserHomePageCheck == "1" %&gt; <br /> &lt;!--Start Media Teaser!--&gt; <br /> &lt;% include MediaTeaserPage %&gt; <br /> &lt;!--End Media Teaser!--&gt; <br /> &lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $FighterHomePageCheck == "1" %&gt; <br /> &lt;!--Start Fighter Page!--&gt; <br /> &lt;% include FighterPage %&gt; <br /> &lt;!--End Fighter Page!--&gt; <br /> &lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $FighterStatsHomePageCheck == "1" %&gt; <br /> &lt;!--Start Fighter Stats Page!--&gt; <br /> &lt;% include FighterStatsPage %&gt; <br /> &lt;!--End Fighter Stats Page!--&gt; <br /> &lt;% end_if %&gt; </p><p>&nbsp;&nbsp;&nbsp;&lt;% if $PartnerHomePageCheck == "1" %&gt; <br /> &lt;!--Start Partner Page!--&gt; <br /> &lt;% include PartnerPage %&gt; <br /> &lt;!--End Partner Page!--&gt; <br /> &lt;% end_if %&gt; </p><p> &lt;/main&gt; </p><p> &lt;% end_loop%&gt;&nbsp;&nbsp;&nbsp;</p></div></p> <br /> <p data-swiftype-index="false">Posted to: How to Sort Includes using a loop | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119773" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119773" class="replyLink">Post Reply</a></p> Thu, 02 Mar 2017 03:26:12 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119773 Re: Sub-query, group and having in SilverStripe ORM https://www.silverstripe.org/community/forums/data-model-questions/show/119606#post421648 <p>Answer is here <br /><a href="http://stackoverflow.com/questions/42346419/sub-query-group-and-having-in-silverstripe-orm">http://stackoverflow.com/questions/42346419/sub-query-group-and-having-in-silverstripe-orm</a></p> <br /> <p data-swiftype-index="false">Posted to: Sub-query, group and having in SilverStripe ORM | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119606#post421648" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119606" class="replyLink">Post Reply</a></p> Sat, 25 Feb 2017 01:25:07 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119606#post421648 Groupwise max queries done nicely? https://www.silverstripe.org/community/forums/data-model-questions/show/119608 <p>HI ORM gurus, I have a BlogPostEvent that has many EventObjects, each representing an actual event session date and time. </p><p>I'm looking for a way to select all BlogPostEvents that have at least one EventObject in the future. </p><p>At the moment I'm doing it like so: </p><p><div class="codesnippet"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = DataObject::get('BlogPostEvent') <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;leftJoin('EventObject', '"EventObject"."BlogPostEventID" = "BlogPost"."ID"') <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;where('EventStartDate = ( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT MAX(EventStartDate) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM "EventObject" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE "EventObject"."BlogPostEventID" = "BlogPostEvent"."ID" AND "EventObject"."EventStartDate" &gt; NOW() <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)' <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);</p></div> </p><p>Which is working fine but doesn't feel very ORMish. Is there a nicer way of doing this? </p><p>Cheers. <br />G</p> <br /> <p data-swiftype-index="false">Posted to: Groupwise max queries done nicely? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119608" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119608" class="replyLink">Post Reply</a></p> Tue, 21 Feb 2017 11:32:01 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119608 Silverstripe Data Object specify table name https://www.silverstripe.org/community/forums/data-model-questions/show/119607 <p>Is there a way to override the default behavior of SS Data Objects such that when I assign a static $table_name property to my DataObject the dev/build does not create a table name with the DO name like it normally does? </p><p>For example I have this very small Data Object <br /> <div class="codesnippet"><p>&lt;?php <br /> class SalesRep extends DataObject { </p><p> private static $table_name = 'tbl_users'; </p><p> }</p></div> <br />I am trying to prevent creation of table salesrep on dev/build and also I would like the ORM to know that when I do a $Model-&gt;write(); I'm writing to the table tbl_users instead of table salesrep</p> <br /> <p data-swiftype-index="false">Posted to: Silverstripe Data Object specify table name | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119607" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119607" class="replyLink">Post Reply</a></p> Tue, 21 Feb 2017 05:40:54 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119607 Sub-query, group and having in SilverStripe ORM https://www.silverstripe.org/community/forums/data-model-questions/show/119606 <p>I'm using SilverStripe ORM.</p><p>I need to get all companies that are at least in ALL of the desired Specializing (no less):<br></p><div class="codesnippet"><p>class CompanyPage extends Page { <br> private static $many_many = [<br> "Specializings" =&gt; "Specializing",<br> ];<br>}</p><p>class Specializing extends DataObject {<br> private static $belongs_many_many = [<br> "CompanyPages" =&gt; "CompanyPage",<br> ];<br>}</p></div><br>I have an array filled with desiring specializing ids ( $specIds ).<br>This gets companies that are at at least in one of the desired specializing, but it isn't that I need.<br><div class="codesnippet"><p>$companyPages = CompanyPage::get()-&gt;filter([<br> "Specializings.ID:ExactMatch" =&gt; $specIds,<br>]);</p></div><br>I can achive my task with this SQL-query<br><div class="codesnippet"><p>select * from CompanyPage c1 join (<br> select c.ID from CompanyPage c <br> join CompanyPage_Specializings cs on cs.CompanyPageID = c.ID<br> where cs.SpecializingID in (14,15)<br> group by c.ID having count(c.ID) = 2<br>) c2 on c1.ID = c2.ID</p></div><br>But how can I achive it with SilverStripe ORM?<br>I can't find anything about having by aggregated functions in ORM <br> <p data-swiftype-index="false">Posted to: Sub-query, group and having in SilverStripe ORM | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119606" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119606" class="replyLink">Post Reply</a></p> Tue, 21 Feb 2017 03:07:33 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119606 ModelAdmin / LeftAndMain - Question regarding a Dashboard https://www.silverstripe.org/community/forums/data-model-questions/show/119332 <p>Hi, </p><p>I have a ModelAdmin (and also a LeftAndMain as I tried out several things) which contains several DataObjects. In the ModelAdmin this works absolutely as it should. </p><p>As the ModelAdmin manages several DataObjects I had the Idea of something like a Dashboard which I want to display, once a Backend User clicks on my ModelAdmin. </p><p>On this Dashboard I want to display for example some data from the DataObjects and give the user the possibility via a click to get directly to this DataObject. </p><p>But now the struggle start. What is a good way to implement this? <br />So far the only (and not nice way) i got it working, was to implement it via a new DataObject. </p><p>When I tried it via LeftAndMain I run into the issue that I had to overwrite the getEdit form and run then later into problems when I tried to access the geteditforms of the dataobject (which sub-urls which cant be handled). </p><p>I guess that there is already some kind of solution to this, but I was not able to really find something which gave me a good starting point. <br />Any Ideas are welcome. </p><p>Best regards, </p><p>Armin</p> <br /> <p data-swiftype-index="false">Posted to: ModelAdmin / LeftAndMain - Question regarding a Dashboard | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119332" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119332" class="replyLink">Post Reply</a></p> Thu, 16 Feb 2017 00:32:31 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119332 SQL error when GridField sorts on <DedrivedClassName>.<BaseClassField> https://www.silverstripe.org/community/forums/data-model-questions/show/119325 <p>Before posting an issue on GitHub, i just wanted a sanity check to make sure there isn't a workaround on my end.</p><p>Given this class Structure:<br></p><div class="codesnippet"><p>class Pocketable extends DataObject {<br>   private static $db = array(<br>      'Title' =&gt; 'Varchar(128)'<br>   );<br>}</p><p>class FeedParser extends Pocketable {}</p><p>class Blueprint extends Pocketable {<br>   private static $has_one = array(<br>      'FeedParser' =&gt; 'FeedParser'<br>   );<br>   static $field_labels = array(<br>      'FeedParser.Title' =&gt; 'Feed Parser'<br>   );<br>   static $summary_fields = array(<br>      'FeedParser.Title'<br>   );<br>}</p></div><p>Blueprint is a managed model in a Model Admin and the GridField generated by ModelAdmin automatically makes the <strong>Feed Parser</strong> column sortable. However, if the user clicks on that column to actually attempt to sort based on that column, this error is returned (line numbers apply to 3.5.2):</p><p></p><div class="codesnippet"><p>SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"</p><p>FROM "Pocketable"<br>LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID"<br>LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"</p><p>WHERE ("Pocketable"."ClassName" IN (?))</p><p>ORDER BY "_SortColumn0" ASC</p><p>LIMIT 500</p><p>Unknown column 'FeedParser.Title' in 'field list'<br>IN POST /admin/template/Blueprint/EditForm/field/Blueprint<br>Line 55 in \framework\model\connect\DBConnector.php</p><p>Source<br>======<br> 46:       if (!empty($sql)) {<br> 47:          $formatter = new SQLFormatter();<br> 48:          $formattedSQL = $formatter-&gt;formatPlain($sql);<br> 49:          $msg = "Couldn't run query:\n\n{$formattedSQL}\n\n{$msg}";<br> 50:       }<br> 51: <br> 52:       if($errorLevel === E_USER_ERROR) {<br> 53:          // Treating errors as exceptions better allows for responding to errors<br> 54:          // in code, such as credential checking during installation<br>* 55:          throw new SS_DatabaseException($msg, 0, null, $sql, $parameters);<br> 56:       } else {<br> 57:          user_error($msg, $errorLevel);<br> 58:       }<br> 59:    }<br> 60: <br> 61:    /**</p><p>Trace<br>=====<br>DBConnector-&gt;databaseError(Unknown column 'FeedParser.Title' in 'field list',256,SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Blueprint"."UploadFolderID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"<br> FROM "Pocketable" LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID" LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"<br> WHERE ("Pocketable"."ClassName" IN (?))<br> ORDER BY "_SortColumn0" ASC<br> LIMIT 500,Array)<br>MySQLiConnector.php:249</p><p>MySQLiConnector-&gt;preparedQuery(SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Blueprint"."UploadFolderID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"<br> FROM "Pocketable" LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID" LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"<br> WHERE ("Pocketable"."ClassName" IN (?))<br> ORDER BY "_SortColumn0" ASC<br> LIMIT 500,Array,256)<br>Database.php:143</p><p>SS_Database-&gt;{closure}(SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Blueprint"."UploadFolderID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"<br> FROM "Pocketable" LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID" LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"<br> WHERE ("Pocketable"."ClassName" IN (?))<br> ORDER BY "_SortColumn0" ASC<br> LIMIT 500)<br>Database.php:193</p><p>SS_Database-&gt;benchmarkQuery(SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Blueprint"."UploadFolderID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"<br> FROM "Pocketable" LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID" LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"<br> WHERE ("Pocketable"."ClassName" IN (?))<br> ORDER BY "_SortColumn0" ASC<br> LIMIT 500,Closure,Array)<br>Database.php:146</p><p>SS_Database-&gt;preparedQuery(SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Blueprint"."UploadFolderID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"<br> FROM "Pocketable" LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID" LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"<br> WHERE ("Pocketable"."ClassName" IN (?))<br> ORDER BY "_SortColumn0" ASC<br> LIMIT 500,Array,256)<br>DB.php:365</p><p>DB::prepared_query(SELECT DISTINCT "Pocketable"."ClassName", "Pocketable"."LastEdited", "Pocketable"."Created", "Pocketable"."Title", "Blueprint"."FeedParserID", "Blueprint"."UploadFolderID", "Pocketable"."ID", <br>         CASE WHEN "Pocketable"."ClassName" IS NOT NULL THEN "Pocketable"."ClassName"<br>         ELSE 'Pocketable' END AS "RecordClassName", "FeedParser"."Title" AS "_SortColumn0"<br> FROM "Pocketable" LEFT JOIN "Blueprint" ON "Blueprint"."ID" = "Pocketable"."ID" LEFT JOIN "FeedParser" ON "FeedParser"."ID" = "Blueprint"."FeedParserID"<br> WHERE ("Pocketable"."ClassName" IN (?))<br> ORDER BY "_SortColumn0" ASC<br> LIMIT 500,Array)<br>SQLExpression.php:121</p><p>SQLExpression-&gt;execute()<br>DataList.php:666</p><p>DataList-&gt;toArray()<br>DataList.php:760</p><p>DataList-&gt;getIterator()<br>GridField.php:404</p><p>GridField-&gt;FieldHolder()<br>GridField.php:888</p><p>GridField-&gt;gridFieldAlterAction(Array,CMSForm,SS_HTTPRequest)<br>GridField.php:120</p><p>GridField-&gt;index(SS_HTTPRequest)<br>RequestHandler.php:288</p><p>RequestHandler-&gt;handleAction(SS_HTTPRequest,index)<br>RequestHandler.php:200</p><p>RequestHandler-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>GridField.php:1019</p><p>GridField-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>RequestHandler.php:222</p><p>RequestHandler-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>RequestHandler.php:222</p><p>RequestHandler-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>Controller.php:158</p><p>Controller-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>LeftAndMain.php:464</p><p>LeftAndMain-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>AdminRootController.php:92</p><p>AdminRootController-&gt;handleRequest(SS_HTTPRequest,DataModel)<br>Director.php:385</p><p>Director::handleRequest(SS_HTTPRequest,Session,DataModel)<br>Director.php:149</p><p>Director::direct(/admin/template/Blueprint/EditForm/field/Blueprint,DataModel)<br>main.php:191</p></div><p>It appears that the query builder is not taking into account that the <strong>Title</strong> field is in the <strong>Pocketable</strong> Table rather than the derived class <strong>FeedParser</strong> table.<br>Experienced this issue in builds 3.3.2 and 3.5.2<br>[Edited for code syntax]</p> <br> <p data-swiftype-index="false">Posted to: SQL error when GridField sorts on &lt;DedrivedClassName&gt;.&lt;BaseClassField&gt; | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119325" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119325" class="replyLink">Post Reply</a></p> Fri, 10 Feb 2017 09:05:18 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119325 Re: Unable to reproduce template public method in ORM https://www.silverstripe.org/community/forums/data-model-questions/show/119142#post421151 <p>I'm not sure what the actual problem is, but the bit here, where you're defining the same relation twice, doesn't seem right to me: </p><p><div class="codesnippet"><p>private static $has_one = array ( <br /> 'StaffHolder' =&gt; 'StaffHolder' <br /> ); </p><p> private static $belongs_many = array ( <br /> 'StaffHolder' =&gt; 'StaffHolder' <br /> );</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Unable to reproduce template public method in ORM | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119142#post421151" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119142" class="replyLink">Post Reply</a></p> Mon, 06 Feb 2017 06:37:57 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119142#post421151 Unable to reproduce template public method in ORM https://www.silverstripe.org/community/forums/data-model-questions/show/119142 <p>Hello all, I have an issue that's probably very simple to solve, but has been driving me mad for weeks. </p><p>I have a Staff section with the following elements: </p><p>StaffProfile (Page - displays individual staff member details) <br />StaffHolder (Page - list all the staff profiles) <br />StaffDepartment (Dataobject - staff member departments, functioning as DataObject as page) </p><p>I call the method StaffMembers in the various templates to loop the StaffProfiles and this works as I want. <br />Called on StaffHolder I get all profiles, called on StaffDepartment (StaffHolder_show.ss) I get the profile from that Department. </p><p>However, I'm stretching the limits of template-based filtering/sorting and want to manipulate the data in the ORM. <br />No matter what I've tried, I can't re-produce what I'm able to do template-side. </p><p>I.e. if I create a simple function to get StaffMembers on StaffHolder, it will work on the holder page but the StaffMembers will not filter by their departments on StaffDepartment/StaffHolder_show.ss. </p><p>If I put the function on StaffDepartment, it does filter staff members on StaffHolder_show.ss. Only if I loop StaffDepartments on Staffholder, then StaffMembers do I get all the departments with their staff, which I don't want - as I don't want them broken down into departments on this page, and it retrieves duplicates where staff have multiple departments. I'm using the DataObjectAsPage module, but got the same results when I coded the page functionality from scratch from UncleCheese's video. </p><p>Any pointers on where I'm going wrong would be greatly appreciated. </p><p>Class/Controller Structure below: </p><p><strong>StaffHolder.php</strong> <br /><div class="codesnippet"><p>class StaffHolder extends DataObjectAsPageHolder { </p><p>&nbsp;&nbsp;&nbsp;private static $allowed_children = array ( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'StaffProfile', <br />&nbsp;&nbsp;&nbsp;); </p><p>&nbsp;&nbsp;&nbsp;private static $has_many = array ( <br /> 'Departments'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 'StaffDepartment', <br /> 'StaffMembers'&nbsp;&nbsp;&nbsp;=&gt; 'StaffProfile' <br /> ); </p><p> private static $has_one = array ( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'StaffPlaceHolder'&nbsp;&nbsp;&nbsp;=&gt; 'Image' <br />&nbsp;&nbsp;&nbsp;); <br /> ........... <br />} </p><p>class StaffHolder_Controller extends DataObjectAsPageHolder_Controller { <br />&nbsp;&nbsp;&nbsp;public static $item_class = 'StaffDepartment'; </p><p> ........... <br />}</p></div> </p><p><strong>StaffProfile.php</strong> <br /><div class="codesnippet"><p>class StaffProfile extends Page { </p><p> private static $belongs_many_many = array ( <br /> 'Departments'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 'StaffDepartment', <br /> ); <br /> // I have tried the reverse relationship to StaffProfile and produces same results <br />........ <br />}</p></div> </p><p><strong>StaffDepartment.php</strong> <br /><div class="codesnippet"><p>class StaffDepartment extends DataObjectAsPage { </p><p>&nbsp;&nbsp;&nbsp;public static $listing_page_class = 'StaffHolder'; </p><p>&nbsp;&nbsp;&nbsp;public static $item_sort = 'Title ASC'; </p><p>&nbsp;&nbsp;&nbsp;public static $plural_name = 'Departments'; </p><p> public static $singular_name = 'Department'; </p><p> private static $has_one = array ( <br /> 'StaffHolder' =&gt; 'StaffHolder' <br /> ); </p><p> private static $belongs_many = array ( <br /> 'StaffHolder' =&gt; 'StaffHolder' <br /> ); </p><p> private static $many_many = array ( <br /> 'StaffMembers' =&gt; 'StaffProfile' <br /> ); <br /> .........</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Unable to reproduce template public method in ORM | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119142" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119142" class="replyLink">Post Reply</a></p> Mon, 23 Jan 2017 23:40:07 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119142 is it possible to make Diff::compareHTML() to ignore HTML attributes? https://www.silverstripe.org/community/forums/data-model-questions/show/119137 <p>First of all, I'm not sure if this is the correct forum section for this question or not, or if I should actually start a discussion about this in GitHub. </p><p>We have a website that uses the SilverStripe's Diff class to show changes between content versions in the frontend for users who need to see the history of the content provided by the website. However, sometimes there are meaningless changes between the content versions. </p><p>For example, a paragraph might have a class called "left" in the old version, but in the new version the class name could have been replaced with "center". The content of the paragraph stays the same. So, <em>&lt;p class="left"&gt;Hello World!&lt;/p&gt;</em> becomes <em>&lt;p class="center"&gt;Hello World!&lt;/p&gt;</em>. Literally speaking, the paragraph _has_ changed, and the Diff class notices the change, but on the other hand there is no real changes in the _content_. Meta data changes are not important for the users of this website. </p><p>In fact, we have already modified the class a little bit to change a few things, for example to ignore certain tags that are only used for styling (i.e. &lt;strong&gt; and &lt;em&gt;) so adding/removing those tags in the content does not trigger a detectable change in the content. We have also made it to ignore whitespace changes. </p><p>And we have also tried to make it to ignore attributes, but now I see that it doesn't always succeed on that. I'm not even 100% sure if our other modifications work every time, but at least they usually do. Our customised class might be a little bit hard to read as it's not the cleanest code, so I would first like to ask you some general advices about how would you do it. I don't think that I need precise step by step instructions. I don't know how the diff algorithm work deep inside. </p><p>Of course, I can show the customised code if needed. And if it's useful (or becomes useful after more development), perhaps it could be merged to the core framework or could be converted to a module. I understand that the current Diff works now as it should work and if I ever suggest changes to that, those shouldn't affect the default behaviour, but rather be something that developers could toggle on when they use the Diff class for their own purposes. </p><p>Thank you for your support! </p><p>P.S. Oh, and please fix the forum session timeout issue. It's still logging me out when writing a long post like this. One solution would be to raise a JavaScript popup which would ask if the user still wants to keep the session alive after a certain amount of time. If the user hits yes, JavaScript would send an AJAX ping request that would just update the session's timestamp.</p> <br /> <p data-swiftype-index="false">Posted to: is it possible to make Diff::compareHTML() to ignore HTML attributes? | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119137" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119137" class="replyLink">Post Reply</a></p> Fri, 20 Jan 2017 08:22:17 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119137 Re: Loop children https://www.silverstripe.org/community/forums/data-model-questions/show/119093#post421033 <p>I would not even use a custom method as you can loop through the children directly in the template </p><p><div class="codesnippet"><p>&lt;% loop $Children.Sort(Sort ASC) %&gt; <br />&lt;% end_loop %&gt;</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Loop children | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119093#post421033" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119093" class="replyLink">Post Reply</a></p> Thu, 15 Dec 2016 15:58:21 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119093#post421033 Loop children https://www.silverstripe.org/community/forums/data-model-questions/show/119093 <p>After updating from 3.1 to 3.5 this function will output even draft pages </p><p><div class="codesnippet"><p>function FilteredChildren($filter = '"SiteTree"."Sort" ASC') { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return DataObject::get('Page', "ParentID = {$this-&gt;ID}", $filter); <br />&nbsp;&nbsp;&nbsp;}</p></div> </p><p>I tried $this-&gt;Children(); as well, but it only displays two of 8 pages. </p><p>The template has just a &lt;% loop FilteredChildren %&gt; in it.</p> <br /> <p data-swiftype-index="false">Posted to: Loop children | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119093" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119093" class="replyLink">Post Reply</a></p> Sat, 10 Dec 2016 02:15:15 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119093 many_many relationship (between "Task" and "Member") with editing in two places https://www.silverstripe.org/community/forums/data-model-questions/show/119075 <p>Hi everyone </p><p>I've recently been working on understanding SilverStripe but I've encountered an issue I couldn't solve so far. </p><p>It basically involves 3 classes: <br /><ul><li>Task <br /></li><li>Member Extension <br /></li><li>MemberTask <br /></li></ul> </p><p>The idea is to be able to have an editable list of tasks through TaskAdmin. When creating/editing a task through the TaskAdmin it should not only be possible to change name/description etc, but also to assign/remove them to/from a Member. (which is working) </p><p>The problem is that I also want to be able to see (and edit) the assigned Tasks when looking at a Member. This doesn't work and I'm not sure why. </p><p>My Task DataObject in its simplest form: <br /><div class="codesnippet"><p>class Task extends DataObject <br />{ </p><p> private static $db = array ( <br /> 'Name' =&gt; 'Varchar', <br /> 'Description' =&gt; 'Text', <br /> ); </p><p> private static $has_one = array ( <br /> 'TaskImage' =&gt; 'Image' <br /> ); </p><p> private static $many_many = array ( <br /> 'Members' =&gt; 'Member' <br /> ); <br />}</p></div> </p><p>So far so good. </p><p>MyMemberExtension and TaskMember is where I don't seem to get it working: </p><p>MyMemberExtension: <br /><div class="codesnippet"><p>&lt;?php </p><p>class MyMemberExtension extends DataExtension { </p><p> private static $many_many = array ( <br /> 'Tasks' =&gt; 'Task' <br /> ); </p><p> public function updateCMSFields(FieldList $fields) { </p><p> $source = Task::get()-&gt;map('ID','Title')-&gt;toArray(); </p><p> $fields-&gt;addFieldsToTab('Root.Main', array( <br /> TextField::create('Name'), <br /> TextField::create('Description'), <br /> ListBoxField::create('Tasks', 'Tasks')-&gt;setMultiple(true)-&gt;setSource($source) <br /> )); </p><p> } <br />} </p><p>}</p></div> </p><p>MemberTask: <br /><div class="codesnippet"><p>class MemberTask extends DataObject <br />{ </p><p> private static $has_one = array ( <br /> 'Member' =&gt; 'Member', <br /> 'Task' =&gt; 'Task', </p><p> ); </p><p> private static $belongs_many_many = array ( <br /> 'Members' =&gt; 'Member', <br /> 'Task' =&gt; 'Task', </p><p> ); </p><p>}</p></div> </p><p>Anyone has an idea what I'm doing wrong? My suspicion is that I messed up MemberTask and the updateCMSFields in the Member Extension.</p> <br /> <p data-swiftype-index="false">Posted to: many_many relationship (between &quot;Task&quot; and &quot;Member&quot;) with editing in two places | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119075" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119075" class="replyLink">Post Reply</a></p> Tue, 29 Nov 2016 09:03:31 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119075 Re: Linking to a page based on page ID https://www.silverstripe.org/community/forums/data-model-questions/show/119022?start=8#post420942 <p>This code makes no sense, have you have trimmed out a heap of lines? <br />There is nowhere that you have built the data to be returned, you are returning $ID, the foreach loop is doing nothing. <br />Maybe you need to be using a join between your page and PageVew to get what you're after rather than a for loop. <br />Either that or the for loop needs to build an array to return.</p> <br /> <p data-swiftype-index="false">Posted to: Linking to a page based on page ID | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119022?start=8#post420942" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119022" class="replyLink">Post Reply</a></p> Thu, 24 Nov 2016 17:44:22 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119022?start=8#post420942 Re: Linking to a page based on page ID https://www.silverstripe.org/community/forums/data-model-questions/show/119022?start=8#post420941 <p>This is the code here, it is grabbing records from the pageview table that records page views. Its returning the id fine, now I just need to get the url and page name so I can use them in the view. </p><p>Sorry I should have started with this... </p><p><div class="codesnippet"><p>public function MostViewed($limit = 5) { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Returns a list of page id's <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ID = PageView::get() </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;sort('Count', 'DESC'); </p><p> /*loop through each of the records retrieved and grab the link by matching the page id to the <br /> * corresponding data object. <br /> */ <br /> foreach ($ID as $id){ </p><p> //get the page id from the retrieved record <br /> $PageId = $id-&gt;PageID; </p><p> $DataObject = DataObject::get("Page", "`ID` = '$PageId'"); </p><p> } </p><p> //should be returning the page url here or object to retrieve the url from <br /> return $ID; </p><p>&nbsp;&nbsp;&nbsp;}</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Linking to a page based on page ID | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119022?start=8#post420941" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119022" class="replyLink">Post Reply</a></p> Thu, 24 Nov 2016 12:29:29 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119022?start=8#post420941 Re: Linking to a page based on page ID https://www.silverstripe.org/community/forums/data-model-questions/show/119022#post420940 <p>How about posting the code that $dataO is part of, show some class :).</p> <br /> <p data-swiftype-index="false">Posted to: Linking to a page based on page ID | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119022#post420940" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119022" class="replyLink">Post Reply</a></p> Thu, 24 Nov 2016 12:20:36 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119022#post420940 Re: Linking to a page based on page ID https://www.silverstripe.org/community/forums/data-model-questions/show/119022#post420939 <p>Still having issues with this :/ Thanks for the help so far. </p><p>If I var dump $dataO I get the object but if I vardump $dataO-&gt;AbsoluteLink() I receive a Server Error Page.I receive the same error with -&gt;RelativeLink()</p><p>This is the vardump from $dataO</p><p></p><div class="codesnippet"><p>{ <br> [ <br> "dataClass":protected<br> ] =&gt; string(4) "Page" [ <br> "dataQuery":protected<br> ] =&gt; object(DataQuery)#422 (8) { <br> [ <br> "dataClass":protected<br> ] =&gt; string(4) "Page" [ <br> "query":protected<br> ] =&gt; object(SQLQuery)#93 (12) { <br> [ <br> "isDelete":protected<br> ] =&gt; bool(false) [ <br> "select":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "groupby":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "having":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "distinct":protected<br> ] =&gt; bool(true) [ <br> "orderby":protected<br> ] =&gt; array(1) { <br> [ <br> "" Sort""<br> ] =&gt; string(3) "ASC"<br> } [ <br> "limit":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "where":protected<br> ] =&gt; array(1) { <br> [ <br> 0<br> ] =&gt; array(1) { <br> [ <br> "`ID` = '15'"<br> ] =&gt; array(0) { </p><p> }<br> }<br> } [ <br> "connective":protected<br> ] =&gt; string(3) "AND" [ <br> "from":protected<br> ] =&gt; array(1) { <br> [ <br> "SiteTree"<br> ] =&gt; string(10) ""SiteTree""<br> } [ <br> "replacementsOld":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "replacementsNew":protected<br> ] =&gt; array(0) { </p><p> }<br> } [ <br> "collidingFields":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "queriedColumns": "DataQuery":private<br> ] =&gt; NULL [ <br> "queryFinalised": "DataQuery":private<br> ] =&gt; bool(false) [ <br> "querySubclasses":protected<br> ] =&gt; bool(true) [ <br> "filterByClassName":protected<br> ] =&gt; bool(true) [ <br> "queryParams": "DataQuery":private<br> ] =&gt; array(2) { <br> [ <br> "Versioned.mode"<br> ] =&gt; string(5) "stage" [ <br> "Versioned.stage"<br> ] =&gt; string(4) "Live"<br> }<br> } [ <br> "model":protected<br> ] =&gt; object(DataModel)#3 (1) { <br> [ <br> "customDataLists":protected<br> ] =&gt; array(0) { </p><p> }<br> } [ <br> "inAlterDataQueryCall":protected<br> ] =&gt; bool(false) [ <br> "failover":protected<br> ] =&gt; NULL [ <br> "customisedObject":protected<br> ] =&gt; NULL [ <br> "objCache": "ViewableData":private<br> ] =&gt; array(0) { </p><p> } [ <br> "class"<br> ] =&gt; string(8) "DataList" [ <br> "extension_instances":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "beforeExtendCallbacks":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "afterExtendCallbacks":protected<br> ] =&gt; array(0) { </p><p> }<br>}object(DataList)#427 (11){ <br> [ <br> "dataClass":protected<br> ] =&gt; string(4) "Page" [ <br> "dataQuery":protected<br> ] =&gt; object(DataQuery)#424 (8) { <br> [ <br> "dataClass":protected<br> ] =&gt; string(4) "Page" [ <br> "query":protected<br> ] =&gt; object(SQLQuery)#432 (12) { <br> [ <br> "isDelete":protected<br> ] =&gt; bool(false) [ <br> "select":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "groupby":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "having":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "distinct":protected<br> ] =&gt; bool(true) [ <br> "orderby":protected<br> ] =&gt; array(1) { <br> [ <br> "" Sort""<br> ] =&gt; string(3) "ASC"<br> } [ <br> "limit":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "where":protected<br> ] =&gt; array(1) { <br> [ <br> 0<br> ] =&gt; array(1) { <br> [ <br> "`ID` = '15'"<br> ] =&gt; array(0) { </p><p> }<br> }<br> } [ <br> "connective":protected<br> ] =&gt; string(3) "AND" [ <br> "from":protected<br> ] =&gt; array(1) { <br> [ <br> "SiteTree"<br> ] =&gt; string(10) ""SiteTree""<br> } [ <br> "replacementsOld":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "replacementsNew":protected<br> ] =&gt; array(0) { </p><p> }<br> } [ <br> "collidingFields":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "queriedColumns": "DataQuery":private<br> ] =&gt; NULL [ <br> "queryFinalised": "DataQuery":private<br> ] =&gt; bool(false) [ <br> "querySubclasses":protected<br> ] =&gt; bool(true) [ <br> "filterByClassName":protected<br> ] =&gt; bool(true) [ <br> "queryParams": "DataQuery":private<br> ] =&gt; array(2) { <br> [ <br> "Versioned.mode"<br> ] =&gt; string(5) "stage" [ <br> "Versioned.stage"<br> ] =&gt; string(4) "Live"<br> }<br> } [ <br> "model":protected<br> ] =&gt; object(DataModel)#3 (1) { <br> [ <br> "customDataLists":protected<br> ] =&gt; array(0) { </p><p> }<br> } [ <br> "inAlterDataQueryCall":protected<br> ] =&gt; bool(false) [ <br> "failover":protected<br> ] =&gt; NULL [ <br> "customisedObject":protected<br> ] =&gt; NULL [ <br> "objCache": "ViewableData":private<br> ] =&gt; array(0) { </p><p> } [ <br> "class"<br> ] =&gt; string(8) "DataList" [ <br> "extension_instances":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "beforeExtendCallbacks":protected<br> ] =&gt; array(0) { </p><p> } [ <br> "afterExtendCallbacks":protected<br> ] =&gt; array(0) { </p><p> }<br>}</p></div> <br> <p data-swiftype-index="false">Posted to: Linking to a page based on page ID | <a href="https://www.silverstripe.org/community/forums/data-model-questions/show/119022#post420939" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/data-model-questions/reply/119022" class="replyLink">Post Reply</a></p> Thu, 24 Nov 2016 08:14:58 +1300 https://www.silverstripe.org/community/forums/data-model-questions/show/119022#post420939