#silverstripe IRC Log

IRC log for 14 December 2016

All timestamps are in UTC.

1: [00:08:06] * Azure quit (Remote host closed the connection)
2: [00:21:37] <neomang> Sorry, I wasn't clear. The Topics one is showing up fine, it's the resources one
3: [00:21:43] <neomang> that isn't appearing
4: [00:22:36] <neomang> even without the "after" field
5: [00:22:50] <neomang> so if I just put nothing instead of "Topic" it still didnt appear
6: [00:23:46] * Azure has joined #silverstripe
7: [00:23:55] * neomang quit (Quit: Page closed)
8: [00:26:26] * micmania1 quit (Quit: micmania1)
9: [00:55:57] * Stomach quit (Quit: bye)
10: [01:02:00] * Stomach has joined #silverstripe
11: [01:02:33] * micmania1 has joined #silverstripe
12: [01:12:13] * darianno quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13: [01:14:10] * zippy quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14: [01:27:27] <samsam> in case anyone has a clue: http://stackoverflow.com/questions/41133337/silverstripe-overwriting-urlsegmentfilter-static
15: [01:30:05] <ss-helper> SilverStripe overwriting URLSegmentFilter static - http://stackoverflow.com/questions/41133337/silverstripe-overwriting-urlsegmentfilter-static
16: [01:36:59] <Nightjar> samsam, told ya, use the Config!
17: [01:37:07] <Nightjar> You're thinking in the wrong place ;)
18: [01:38:56] <Nightjar> mysite/_config/urls.yml
19: [01:39:01] <Nightjar> UrlSegmentFilter:
20: [01:39:05] <samsam> Nightjar: yes indeed, but can you use the _t() function in a yml file?
21: [01:39:08] <Nightjar> default_replacements:
22: [01:39:49] <samsam> the translation of the ampersand should be based on current locale in the back-end
23: [01:39:51] <Nightjar> '/&amp;/u': '-en-'
24: [01:40:02] <samsam> lol how did you know im dutch
25: [01:40:13] <Nightjar> I'm magic
26: [01:40:27] <samsam> if you’re magic, try applying _t() in a yml file :p
27: [01:40:39] <Nightjar> Why would I do that?
28: [01:40:50] <Nightjar> can just apply it in mysite/_config.php
29: [01:41:03] <samsam> how would that work? :o
30: [01:41:57] <Nightjar> https://silverstripe.logged.nz/index.php?date=2016-10-31#log_1904737
31: [01:42:24] <samsam> lol you’re sharp mate
32: [01:42:51] <Nightjar> Config::inst()->update('URLSegmentFilter', '/&amp;/u', '-en-')
33: [01:43:07] <Firesphere> Nah, make it "und" :D
34: [01:43:16] <Nightjar> i
35: [01:43:41] <samsam> if this works, i will leave it “und” forever
36: [01:46:20] <samsam> hmm, that didn’t work. Perhaps because you need to address the static array too
37: [01:47:04] <samsam> .
38: [01:47:23] <samsam> &amp;/u is inside private static $default_replacements = array()
39: [01:52:11] <samsam> I found it yaay
40: [01:53:41] <Nightjar> yeah, which means it's a "default" config option.
41: [01:54:03] <Nightjar> and you need to ?flush, when you update the config (yml files).
42: [01:54:50] <Nightjar> if you do it via PHP then it's an active system change, so no flush needed.
43: [01:59:00] <Nightjar> samsam, this may interest you.
44: [01:59:00] <Nightjar> https://docs.silverstripe.org/en/3/developer_guides/configuration/configuration/
45: [02:00:25] <samsam> I just finished reading that I came up with this solution: http://www.sspaste.com/paste/show/5850a7ab05dc6
46: [02:00:43] <samsam> changing the string to another string works, but the _t function doesnt seem to work in config.php
47: [02:00:57] <samsam> it’s a config.php in one of my own mods, but that shouldnt make a diff
48: [02:01:27] <Nightjar> yeah, but that might be because it's _config.php
49: [02:01:34] <Nightjar> and must be in the module root
50: [02:02:04] <Nightjar> _t _should_ work, afaik.
51: [02:02:21] <Nightjar> I've not had much cause to play with translations though, Firesphere might be of more help here :)
52: [02:03:27] <Firesphere> _t(); isn't available in _config.php
53: [02:03:32] <Nightjar> oh
54: [02:03:35] <Nightjar> :(
55: [02:03:44] <Firesphere> the configs are loaded too early in the manifest
56: [02:03:46] <Nightjar> Was it ever? I seem to think it was
57: [02:04:04] <Firesphere> That's how I remember it
58: [02:04:23] <samsam> I see! Hmm back to the drawing board
59: [02:04:39] <Nightjar> you could hack, :<
60: [02:04:59] <Nightjar> check locale, read in a file wiht the translations (like, include()) :<
61: [02:05:16] <Nightjar> terrorbad
62: [02:15:02] <samsam> sounds like headache :p
63: [02:15:18] <Nightjar> Sounds like too hard basket, do you need to support more than Dutch? :P
64: [02:15:39] <samsam> well yes
65: [02:17:34] <Nightjar> not sure how out of date this is, but it could be helpful: http://www.balbuss.com/internationalize
66: [02:20:18] <Nightjar> Because this seems... a decent but not entirely complete. https://docs.silverstripe.org/en/3.4/developer_guides/i18n
67: [02:21:26] * micmania1 quit (Quit: micmania1)
68: [02:21:51] <Nightjar> Although... that said... !
69: [02:21:52] <Nightjar> https://docs.silverstripe.org/en/3.4/developer_guides/i18n#i18n-in-urls
70: [02:25:53] * janneklouman-- has joined #silverstripe
71: [02:26:17] <samsam> interesting
72: [02:26:30] * micmania1 has joined #silverstripe
73: [02:30:34] * janneklouman-- quit (Ping timeout: 252 seconds)
74: [02:33:02] * zippy has joined #silverstripe
75: [02:34:53] * zippy quit (Client Quit)
76: [02:40:47] <samsam> off to bed, later mates
77: [02:42:33] <Firesphere> You've stayed up quite late
78: [02:50:17] * janneklouman-- has joined #silverstripe
79: [02:50:31] <Nightjar> quite. Ciao
80: [02:54:49] * janneklouman-- quit (Ping timeout: 258 seconds)
81: [03:01:23] * Stomach quit (Quit: zzz)
82: [03:05:39] * Stomach has joined #silverstripe
83: [03:10:50] * shlinx has joined #silverstripe
84: [03:12:46] <shlinx> Hi, I'm writing unit testing following this doc: https://docs.silverstripe.org/en/3.4/developer_guides/testing/fixtures/. However I'm keep getting error message: InvalidArgumentException: No fixture definitions found for "=>Team.crusaders. Anyone got idea why this could happen?
85: [03:15:33] <Nightjar> didn't load the file?
86: [03:15:38] <Nightjar> file in wrong place?
87: [03:15:42] <Nightjar> something to do with the file?
88: [03:15:44] <Nightjar> :>
89: [03:16:03] <Nightjar> Not sure myself, just thinking out loud what I would look at first :>
90: [03:21:08] <shlinx> File should be correct, coz' if I remote the relation line in fixture ymal file, it can correctly get the object, returns the correct name of object
91: [03:27:04] <shlinx> This makes me suspect if this syntax is correct
92: [03:27:05] <shlinx> Team: =>Team.crusaders
93: [03:27:18] * pippy has joined #silverstripe
94: [03:29:28] <Firesphere> I'm guessing, the teamname is "Crusaders" instead of "crusaders"?
95: [03:30:09] <shlinx> Nope. As defined:
96: [03:30:09] <shlinx> Team: hurricanes: Name: The Hurricanes Origin: Wellington crusaders: Name: The Crusaders Origin: Canterbury
97: [03:30:22] <shlinx> In the document page
98: [03:30:26] <Firesphere> Ok, that's not it then I guess :P
99: [03:31:41] <Firesphere> Wait... Flip Team and Player definitions around
100: [03:31:48] <Firesphere> Team first, Players second
101: [03:36:47] <shlinx> That fixed the issue!
102: [03:37:06] <shlinx> The document page is incorrect ...
103: [03:37:09] <Nightjar> lulz
104: [03:37:23] <Nightjar> I PR'd that recently, but it was to correct the team locations xD
105: [03:37:24] <Nightjar> hahaha
106: [03:37:50] <Firesphere> Took me a while to realize, PHP is an interpreter, not a compiler, so order matters :D
107: [03:38:17] <shlinx> OK, that spent me more than 2 hours. But thanks guys that really helps.
108: [03:41:13] <Nightjar> Yeah, I remember thinking it was odd at the time, but I wasn't actually using/testing the docs, just changing "Otago" to "Canterbury" :P
109: [03:43:58] <Firesphere> Wait, I saw that commit, was marked as "most important one to date" or something
110: [03:44:33] <Nightjar> haha, something like that. Doing my not-so-unusual full cheeky mode.
111: [03:46:09] <Firesphere> https://github.com/silverstripe/silverstripe-framework/commit/89351e6c31805688b3da9c23868708179fbcbdf8
112: [03:48:58] <Nightjar> aahahahah "Everyone knows the internet is no place for misinformation!" :P
113: [03:50:37] <Nightjar> chillu did tell me it brightened up his day, so it was taken in the correct light :P
114: [03:50:53] <Nightjar> (very toungue in cheek)
115: [03:53:57] <DanaeNZ> self::config()->get('image_sizes') is not returning the config settings from mysite/_config/config.yml
116: [03:54:00] <DanaeNZ> agh
117: [03:59:32] <Firesphere> Is it actually set and in the manifest?
118: [03:59:57] <Nightjar> what is self?
119: [04:00:03] <Nightjar> correct thing?
120: [04:00:08] <Nightjar> wrong thing?
121: [04:00:15] <Firesphere> Manifest flushed?
122: [04:00:25] <DanaeNZ> self is correct thing. I think it might be a Before / After business
123: [04:00:55] <DanaeNZ> The manifest is returning the default from the modules
124: [04:00:57] <DanaeNZ> module*
125: [04:01:10] <DanaeNZ> But ignoring mysite
126: [04:01:25] <DanaeNZ> I've attempted to force it Before and After and all of that.
127: [04:01:30] <Nightjar> after *
128: [04:01:47] <Nightjar> check module isn't also after *
129: [04:02:03] <DanaeNZ> mysite is - After: 'framework/*','cms/*','shopapiconfig/*'
130: [04:02:13] <DanaeNZ> shopapiconfig is - After: 'framework/*','cms/*'
131: [04:02:19] <Nightjar> so config is returning _something_, just not _yourthing_?
132: [04:02:34] <DanaeNZ> Yes. Something being the default from the module config.yml
133: [04:02:53] <DanaeNZ> Being an identical array with the default values, not the mysite values
134: [04:03:29] <Nightjar> Right, well, good luck with that, I'm going home.
135: [04:03:48] <DanaeNZ> Hahah
136: [04:03:51] <DanaeNZ> Thanks XD
137: [04:03:56] <DanaeNZ> laters
138: [04:04:12] <DanaeNZ> It's definitely odd because the same setup works fine on another project
139: [04:05:03] <Nightjar> flaaaaaaaarsh
140: [04:05:36] <DanaeNZ> done that from command line. May as well try from frontend
141: [04:05:51] <Nightjar> Yeh, cos they're different manifests :>
142: [04:05:54] <Nightjar> you should do that
143: [04:06:16] <DanaeNZ> dev/build?flush is different from sake dev/build flush=1 ?
144: [04:06:26] <Nightjar> yes
145: [04:06:32] <Nightjar> two separate manifests.
146: [04:06:35] <DanaeNZ> Hot damn
147: [04:06:45] <Nightjar> cli f-up won't rek yo site
148: [04:07:02] <Nightjar> since like, 3.2 or something
149: [04:07:07] <DanaeNZ> oh it still didn't work
150: [04:07:08] <Firesphere> You didn't know that DanaeNZ?
151: [04:07:22] <Firesphere> You should always treat different ways to get something, as also different manifests
152: [04:07:25] <Nightjar> do it a-GEEEEEEEEEEEEEEEEEEEEEEEN
153: [04:07:38] <Nightjar> do it properly this time!
154: [04:07:41] <Nightjar> -.-
155: [04:07:42] <DanaeNZ> I thought it was just based on the running user
156: [04:07:43] <Nightjar> :P
157: [04:07:47] <Nightjar> and good luck, bye :D'
158: [04:07:53] <DanaeNZ> Also I tried through the brwoser and it still dindn't work
159: [04:09:13] <Nightjar> idk
160: [04:09:26] <DanaeNZ> I'm going to keep at it
161: [04:10:10] <Nightjar> let us know!
162: [04:10:18] <Nightjar> Tomorrow's another day
163: [04:10:45] <DanaeNZ> Hopefully I learn more about the config manifest while I'm at it
164: [04:16:21] * micmania1 quit (Quit: micmania1)
165: [04:35:56] * Stomach quit (Read error: Connection reset by peer)
166: [04:36:07] * Stomach_ has joined #silverstripe
167: [04:41:20] * DanaeNZ quit (Quit: TIME TO FEED)
168: [04:48:31] * shlinx quit (Ping timeout: 260 seconds)
169: [05:18:58] * Stomach_ quit (Quit: zzz)
170: [05:22:19] * samsam quit (Quit: samsam)
171: [05:24:01] * Stomach has joined #silverstripe
172: [06:49:21] * terryapodaca has joined #silverstripe
173: [06:51:58] <terryapodaca> ok everyone, I know this will sound like a big request, but it's kind of urgent. I need a Staff page that has different Roles (Board of Directors, Executive Committee, Officers, and then your normal positions like Marketing, Administration, etc) and then I need a Description for each of these roles and THEN....
174: [06:52:18] <terryapodaca> they need to be shown separately on the front end
175: [06:52:59] <terryapodaca> this will replace the hard coded (tables in the content wysiwyg): http://texasbeefcheckoff.com/about/board-of-directors/
176: [06:59:33] <terryapodaca> anyone have a tutorial or a couple pins/pastes with code that does similar to this?
177: [07:01:25] * wmk has joined #silverstripe
178: [07:11:06] * terryapodaca1 has joined #silverstripe
179: [07:11:42] * aron has joined #silverstripe
180: [07:11:42] <ss-helper> aron: Welcome to #silverstripe! Please ask your questions but don't leave too soon, we are a busy lot.
181: [07:11:59] <aron> hi how can I loop over records returned from DB::query
182: [07:12:03] <aron> in template
183: [07:12:27] <terryapodaca> <% loop objectname %>
184: [07:13:19] <terryapodaca> well, first off, is that DB::query in a function in your page.php (or respected page)?
185: [07:14:26] <terryapodaca> something like public function getDataObjectName() { return DataObjectName::get(); }
186: [07:15:23] <terryapodaca> then in template <% loop $DataObjectName %><% end_loop %>
187: [07:18:00] * Shrike_Finland has joined #silverstripe
188: [07:23:01] <aron> ok one qustion how can I use this query DB::query('SELECT * FROM Ecards WHERE ID IN (2,3)')
189: [07:23:14] <aron> like Ecards::get()->fliter()?
190: [07:25:34] <terryapodaca> ummm Ecards::get()->byId(2); will get you one of them
191: [07:25:50] * micmania1 has joined #silverstripe
192: [07:27:50] <wmk> aron, ::get()->filter(['ID' => [2,3]]);
193: [07:28:31] <terryapodaca> not sure if you can do Ecards::get()->filter('ID', array(2, 3));
194: [07:28:47] <terryapodaca> lol, sorry wmk
195: [07:29:07] <terryapodaca> I think mine is more SS synthetically correct?
196: [07:29:34] <wmk> see https://docs.silverstripe.org/en/3.1/developer_guides/model/data_model_and_orm/#filtering-results
197: [07:29:47] <wmk> terryapodaca, ->byID() gets you ONE
198: [07:30:09] <terryapodaca> wmk: look just below your reply
199: [07:30:26] <wmk> if you want to do a IN (2,3) query you can use filter('Col' => ['val1','val2...])
200: [07:30:49] <wmk> ah..
201: [07:31:00] <wmk> terryapodaca, well, filter takes either two arguments or an array of arguments
202: [07:31:22] <wmk> i like one array more, it's more verbose (and you can create it beforehands and pass to filter())
203: [07:32:19] <terryapodaca> developer preference...both should work, but if he's new to SS, I recommend using SS suggested syntax to learn from and then experiment later
204: [07:32:33] <wmk> terryapodaca, see docs...
205: [07:33:12] <wmk> ah, yup, two params in docs...
206: [07:33:30] <wmk> but it's confusing that filter takes either one or two params...
207: [07:34:31] <terryapodaca> I did, I'm just saying you used =>[2,3] instead of ('ID', array(2,3));
208: [07:34:59] <terryapodaca> which to me, both should work, but if I were a noob, the later makes more sense faster
209: [07:35:10] <terryapodaca> but then again, developer preference
210: [07:35:19] <wmk> ack
211: [07:36:12] <aron> its working thanks you all
212: [07:36:28] <wmk> terryapodaca, aron that's most important in this discussion *G*
213: [07:36:37] <terryapodaca> yep
214: [07:36:43] <terryapodaca> glad we could help
215: [07:39:35] * Stomach quit (Quit: zzz)
216: [07:40:02] * terryapodaca1 quit (Quit: Later fellas......I'm out.)
217: [07:40:26] * terryapodaca1 has joined #silverstripe
218: [07:40:40] * terryapodaca1 quit (Client Quit)
219: [07:41:04] <terryapodaca> damn client
220: [07:41:06] * terryapodaca1 has joined #silverstripe
221: [07:41:15] * terryapodaca1 quit (Client Quit)
222: [07:50:50] * Eliseth has joined #silverstripe
223: [08:03:33] * pweh has joined #silverstripe
224: [08:05:34] * darianno has joined #silverstripe
225: [08:11:55] <Firesphere> Yeah, it's always the client :P
226: [08:12:45] <aron> i have a question
227: [08:12:59] <aron> how can I remove a record from dataobject
228: [08:13:31] <wmk> aron, a record is one line in DB? Though it's a DO instance
229: [08:14:14] <aron> I tried this but doesn't work $d = Fav::get()->filter(array("UserID",$m->ID,"EcardID"=>$ecard)); $d->delete();
230: [08:14:43] <wmk> aron, filter(array('key' => 'value', 'key2 => 'value2))
231: [08:15:01] <wmk> will give you a DataList
232: [08:15:23] <wmk> you can loop over this list, so foreach($d as $item) {$item->delete(); } should work
233: [08:15:39] <aron> ok thanks a lot
234: [08:15:39] <wmk> afaik DataList remove() also deletes from DB
235: [08:16:11] <wmk> foreach($d as $item) {$d->remove($item); //carefully, delets from DB, not just from the returned list}
236: [08:16:41] <wmk> http://api.silverstripe.org/3.4/class-DataList.html#_remove
237: [08:17:03] <wmk> aron, common problem: http://api.silverstripe.org/3.4/class-DataList.html#_removeAll
238: [08:17:32] <wmk> so as a oneliner: Fav::get()->filter($bulletProofFilterArray)->removeAll(); //be careful!!!
239: [08:18:09] <wmk> terryapodaca, should we discuss again about filter() syntax? *cough*
240: [08:19:53] <terryapodaca> wmk: hey, you are the SS guru, so I'll leave that all up to you
241: [08:20:12] <terryapodaca> I'm usually asking most of the questions, so I was just happy that I could answer a couple this time
242: [08:20:29] <wmk> just kidding
243: [08:20:40] * wmk feels kinda honoured for the term "guru"
244: [08:21:32] <terryapodaca> so manyh on here, I can't remember who all actually work for ss
245: [08:21:38] <terryapodaca> at one point I though tyou did
246: [08:22:18] <wmk> nope. I'm localted in that Austria without Kangoroos
247: [08:22:43] <wmk> but Kuhlimuhs (child term for cows)
248: [08:23:15] <terryapodaca> are you the one in that cozy little mountain town with a big lake just out the window?
249: [08:23:36] <wmk> yup.
250: [08:23:53] <wmk> and now with translated weather forecast: http://www.silverstrip.es/blog/translatable-controller-urls/
251: [08:24:41] <wmk> but unfortunately too many tourist in front of our famous webcam, so it's switched off right now :(
252: [08:25:41] <terryapodaca> does it scare you being so close to ISIS, etc?
253: [08:26:29] <wmk> for us it's far away
254: [08:26:44] <wmk> guess 5-6k km
255: [08:30:15] <terryapodaca> what's the name of the town?
256: [08:30:22] <wmk> Hallstatt
257: [08:32:23] <terryapodaca> I'm gonna come visit in a year, you give me a place to stay for a few days?
258: [08:32:51] <wmk> well, my flat is quite small...
259: [08:32:58] <aron> hey another question is there any star rating module is for ss
260: [08:33:19] <wmk> aron, yes
261: [08:33:29] <wmk> i used it on silverstrip.es
262: [08:36:10] <terryapodaca> I need a star rating system too, I was going to use the Browser Poll on the SS website for tutorials, but if you got a module for it...
263: [08:36:12] <terryapodaca> link?
264: [08:38:47] <wmk> terryapodaca, aron https://github.com/sheadawson/silverstripe-rateable
265: [09:01:31] * kinglozzer has joined #silverstripe
266: [09:04:09] * irogue has joined #silverstripe
267: [09:14:38] * janneklouman-- has joined #silverstripe
268: [09:19:44] * pweh quit (Read error: Connection reset by peer)
269: [09:49:58] * micmania1 quit (Quit: micmania1)
270: [09:50:03] <terryapodaca> If I have one ModelAdmin managing two dataobjects, how can I make the tabs across the top have a custom title/name
271: [09:50:38] <terryapodaca> like I have a DO of Staff and one for Role and I want the Role tab to say Roles (plural)
272: [09:55:27] * micmania1 has joined #silverstripe
273: [09:56:40] <wmk> terryapodaca, i guess you need to overwrite getManagedModels() in your modeladmin subclass
274: [09:56:56] <wmk> there it grabs singularname of the managed DO
275: [09:57:06] * aron quit (Ping timeout: 260 seconds)
276: [10:03:51] <kinglozzer> Yo, anyone know if spamprotection works with userforms out of the box?
277: [10:04:29] <kinglozzer> Oh, never mind, found it
278: [10:08:27] <terryapodaca> wmk: looks like it's undocumented, but I can do: 'Role' => array('title' => 'Roles') in the $managed_models array
279: [10:12:23] <wmk> terryapodaca, oh, it's documented in source code for private static $managed_models...
280: [10:12:55] <wmk> terryapodaca, btw: a good IDE where you can jump to source / classes etc. helps a lot exploring the inner stuff of SilverStripe
281: [10:13:26] <terryapodaca> which IDE is that?
282: [10:13:37] <wmk> i use phpstorm / intellij
283: [10:14:17] <wmk> though other IDEs that understand the code should work also.
284: [10:14:37] <terryapodaca> yeah, I am still old schooling it with notepad++
285: [10:14:46] <wmk> "jump to class", "jump to file", "class hierarchy (see all parent and subclasses)"
286: [10:14:52] <wmk> that are really cool features.
287: [10:15:06] <wmk> auto-complete according to docblocks
288: [10:15:26] <terryapodaca> yeah, I use those cool functions in Visual Studio for all my .NET work
289: [10:16:01] <terryapodaca> haven't tried to integrate any of PHP/SS projects into VS though...and haven't forked out the $$$ for a PHP IDE
290: [10:16:34] * agent44 has joined #silverstripe
291: [10:25:44] * irogue quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
292: [10:34:56] * irogue has joined #silverstripe
293: [10:44:34] * agent44 quit (Quit: zzz)
294: [10:44:50] * agent44 has joined #silverstripe
295: [10:51:54] * micmania1 quit (Quit: micmania1)
296: [10:53:42] <terryapodaca> Any idea why I am getting this: http://texasbeefcheckoff.com/admin/staff/
297: [10:53:46] <terryapodaca> error
298: [10:54:39] <kinglozzer> terryapodaca: What error?
299: [10:55:02] <kinglozzer> Because you're viewing it in dev mode and I'm not? :D
300: [10:55:09] <terryapodaca> [User Error] Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'Role'
301: [10:55:23] <terryapodaca> yeah, you probably have to be logged in to the CMS as well
302: [10:55:49] <wmk> you try to output a DO / Object directly somewhere
303: [10:56:05] <wmk> e.g. if you call it like $Me ...
304: [10:56:48] <wmk> do you have xdebug installed? It gives you a nice backtrace of your error
305: [10:57:34] <terryapodaca> $summary_fields I am trying to display the "Role" from a $has_one
306: [10:57:38] <terryapodaca> I think that's the error
307: [10:58:01] <terryapodaca> is that even possible?
308: [10:58:20] <kinglozzer> terryapodaca: It'd need to be Role.Title or something
309: [10:58:28] <kinglozzer> If 'Role' is the name of the relation
310: [10:58:44] <wmk> terryapodaca, a horrible site when you're just about taking lunch and hungry
311: [10:58:57] <terryapodaca> so I had the wrong context
312: [10:59:08] <terryapodaca> wmk: and this isn't even the main site.
313: [10:59:31] <terryapodaca> wmk: if you are hungry, don't look at this page http://beeflovingtexans.com
314: [10:59:31] <wmk> lunch time, weisswurst and brezeln!
315: [11:00:42] <terryapodaca> kinglozzer: thanks, that was it
316: [11:02:46] * agent44 quit (Quit: zzz)
317: [11:02:59] <terryapodaca> how do I populate a dropdownfield from a $has_one relation to another DO?
318: [11:05:53] <terryapodaca> never mind, think I have found the short hand way to do this
319: [11:06:10] * agent44 has joined #silverstripe
320: [11:22:38] * neilf__ has joined #silverstripe
321: [11:33:52] * kinglozzer quit ()
322: [11:36:25] * irogue quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
323: [11:56:54] * samsam has joined #silverstripe
324: [12:03:32] * madmatt_ is now known as madmatt
325: [12:03:47] * madmatt quit (Changing host)
326: [12:03:48] * madmatt has joined #silverstripe
327: [12:15:16] <ss-helper> Adding a parameter before the page name in Silverstripe 3.x - http://stackoverflow.com/questions/41142111/adding-a-parameter-before-the-page-name-in-silverstripe-3-x
328: [12:27:49] * Shrike_Finland quit (Quit: Leaving.)
329: [12:28:43] * Shrike_Finland has joined #silverstripe
330: [12:30:51] <terryapodaca> ok, back to my original question from way earlier this morning
331: [12:33:26] <terryapodaca> I have a Staff dataobject that has a $has_one relation to my Role dataobject ($has_many to Staff). So far I am using the build in StaffPage $has_many relation to list them all, but now I need to figure out how to group them by Role (like this: http://texasbeefcheckoff.com/about/board/) but it seams groupby() doesn't work in 3.1 and up
332: [12:42:19] * Ali_Alamshahi has joined #silverstripe
333: [12:44:49] * AliAlamshahi has joined #silverstripe
334: [12:46:34] * Ali_Alamshahi quit (Ping timeout: 250 seconds)
335: [12:51:09] <wmk> terryapodaca, did you see GroupedList in the docs? Grouping is always kinda pita
336: [12:51:41] <terryapodaca> i found this: https://docs.silverstripe.org/en/3.4/developer_guides/model/how_tos/grouping_dataobject_sets/
337: [12:51:54] <terryapodaca> and am trying to get something to work, is taht what you are talking about?
338: [12:52:02] <wmk> yes
339: [12:52:20] <wmk> always kinda pita to get my head around it, though it's not really difficult.
340: [12:54:35] * Shrike_Finland quit (Quit: Leaving.)
341: [12:54:54] * Shrike_Finland has joined #silverstripe
342: [12:55:04] <terryapodaca> so I am going to have to create the "grouping" function in the controller no matter what, even if I have the Staff DO relation to/fro the StaffPage
343: [12:55:38] <terryapodaca> I was trying to avoid more PHP code but I guess the old way is deprecated (or at least just flat out doesn't work anymore)
344: [12:56:18] <wmk> something like that, yes.
345: [12:58:04] * agent44 quit (Quit: Bai!)
346: [12:58:13] * agent44 has joined #silverstripe
347: [13:05:46] <AliAlamshahi> hello all
348: [13:06:45] <AliAlamshahi> I'm trying to collect data from a page type and display it in my homepage
349: [13:07:13] <AliAlamshahi> so I have this code: function LatestProjects() {
350: [13:07:14] <AliAlamshahi> return DataObject::get('CaseStudy');
351: [13:07:14] <AliAlamshahi> }
352: [13:08:29] <AliAlamshahi> and I'm calling it in my template using <% control LatestProjects %> <% loop $LatestProjects %> $Link <% end_loop %> <% end_control %>
353: [13:09:16] <AliAlamshahi> it correctly calls the number of pages with this page type but doesnt show any data
354: [13:10:26] <AliAlamshahi> what did I do wrong?
355: [13:14:27] * toddv has joined #silverstripe
356: [13:16:00] <toddv> We are trying to redis for SS sessions. We are able to get sessions working on front end, but when we try to access admin, sessions are getting lost in AJAX requests
357: [13:16:13] <toddv> Anyone have any thoughts?
358: [13:30:32] * UndefinedOffset has joined #silverstripe
359: [13:30:37] <samsam> AliAlamshahi: try leaving out the <% control %> block
360: [13:32:18] <AliAlamshahi> @samsam Thanks a million
361: [13:38:25] <samsam> AliAlamshahi: welcome m8
362: [13:49:44] * Shrike_Finland quit (Quit: Leaving.)
363: [13:51:01] * Shrike_Finland has joined #silverstripe
364: [13:54:04] * Shrike_Finland quit (Client Quit)
365: [13:59:45] * agent44 quit (Quit: zzz)
366: [14:00:51] * agent44 has joined #silverstripe
367: [14:01:38] * toddv quit (Remote host closed the connection)
368: [14:07:52] <terryapodaca> I am getting super close now...I just can't seem to render the "Role" dataobject Name/Description
369: [14:07:56] <terryapodaca> see http://texasbeefcheckoff.com/about/test/
370: [14:08:10] <terryapodaca> I am sure I have it in the wrong context
371: [14:22:54] * AliAlamshahi quit (Ping timeout: 258 seconds)
372: [14:32:27] <terryapodaca> Anyone know if silversrtipe.com source code is on github or some other place?
373: [14:34:30] * neilf__ quit (Quit: Connection closed for inactivity)
374: [14:48:48] * toddv has joined #silverstripe
375: [14:53:34] * wmk quit (Ping timeout: 268 seconds)
376: [14:54:27] * toddv quit ()
377: [15:20:42] * muskie9 has joined #silverstripe
378: [15:48:18] * darianno quit (Quit: Textual IRC Client: www.textualapp.com)
379: [16:06:20] * kinglozzer has joined #silverstripe
380: [16:08:28] * samsam quit (Quit: samsam)
381: [16:15:02] * Eliseth quit (Ping timeout: 264 seconds)
382: [16:17:05] * samsam has joined #silverstripe
383: [16:18:44] * AliAlamshahi has joined #silverstripe
384: [16:39:10] * agent44 quit (Quit: zzz)
385: [16:41:52] * agent44 has joined #silverstripe
386: [16:46:09] * AliAlamshahi quit (Ping timeout: 246 seconds)
387: [17:02:57] * muskie9 quit (Ping timeout: 246 seconds)
388: [17:18:04] * kinglozzer quit ()
389: [17:34:34] * janneklouman-- quit (Ping timeout: 256 seconds)
390: [17:36:08] * AliAlamshahi has joined #silverstripe
391: [17:36:17] <AliAlamshahi> Hello all
392: [17:36:45] <AliAlamshahi> I have a datefield named $ProjectDate
393: [17:37:47] <AliAlamshahi> how can I customized the way it displays in page? .Nice doesnt work! I want month name and 4 digit year (no days)
394: [17:38:08] <AliAlamshahi> I also did this: ->setConfig('dateformat', 'MMMM/yyyy') but doesnt work
395: [17:51:05] * Eliseth has joined #silverstripe
396: [17:51:54] * Eliseth quit (Client Quit)
397: [18:28:15] * AliAlamshahi quit (Remote host closed the connection)
398: [18:28:26] * AliAlamshahi has joined #silverstripe
399: [18:33:38] * Ali_Alamshahi has joined #silverstripe
400: [18:35:36] * AliAlamshahi quit (Ping timeout: 265 seconds)
401: [18:41:41] <Nightjar> Ali_Alamshahi, change the locale.
402: [18:42:05] <Nightjar> and dateformat takes PHP date() parameters, not jQuery style afaik.
403: [18:42:38] <Ali_Alamshahi> thanks Nightjar, how should I do that?
404: [18:43:53] <Nightjar> By default it uses the config of the user, I believe (if there is one) - otherwise to the default locale of whatever the site is set to (ie. PHP ini value)
405: [18:43:59] <Nightjar> but
406: [18:44:00] <Nightjar> http://api.silverstripe.org/3.5/class-DateField.html#_setLocale
407: [18:47:02] <Nightjar> Ali_Alamshahi, also see https://docs.silverstripe.org/en/3/developer_guides/i18n/
408: [18:47:26] <Ali_Alamshahi> Thanks a million
409: [18:48:01] <Nightjar> http://api.silverstripe.org/3.5/source-class-DateField.html#20
410: [18:48:54] <Nightjar> so basically http://php.net/manual/en/function.date.php#refsect1-function.date-parameters - although Zend Date is slightly different, it's mostly transferrable info.
411: [18:49:42] * muskie9 has joined #silverstripe
412: [18:49:51] <Ali_Alamshahi> Thanks again Nightjar
413: [18:55:53] * Stomach has joined #silverstripe
414: [19:00:44] <Nightjar> You're welcome
415: [19:28:44] * agent44 quit (Quit: zzz)
416: [19:42:05] * Tron_ has joined #silverstripe
417: [19:45:59] * janneklouman-- has joined #silverstripe
418: [20:02:19] * DanaeNZ has joined #silverstripe
419: [20:03:54] <DanaeNZ> Thursday funday!
420: [20:04:05] <DanaeNZ> I went to the Rogue One premiere last night
421: [20:04:07] <DanaeNZ> so rekt now
422: [20:04:11] <Snowman23> lol
423: [20:04:15] <Snowman23> Yeah, someone else on my twitter did that
424: [20:04:18] <Snowman23> you silly people
425: [20:04:27] <Nightjar> I went to the bed time on-time last night
426: [20:04:30] <Nightjar> so rekt now
427: [20:04:45] <Nightjar> woke up at 3:33 -.-
428: [20:15:32] <DanaeNZ> brutal
429: [20:16:09] <Nightjar> yeh, sucked.
430: [20:17:11] * Tron_ quit (Ping timeout: 260 seconds)
431: [20:22:20] * janneklouman-- quit (Ping timeout: 252 seconds)
432: [20:34:57] * micmania1 has joined #silverstripe
433: [20:46:38] * micmania1 quit (Quit: micmania1)
434: [20:47:18] * adrexia has joined #silverstripe
435: [20:47:22] * micmania1 has joined #silverstripe
436: [20:55:25] <samsam> muskie9: have you also used the image optimisation feature of that mod you recommended me? https://github.com/heyday/silverstripe-optimisedimage
437: [20:56:11] <muskie9> samsam we haven't up to this point, been meaning to look into it though
438: [20:57:04] <samsam> it says it’s command-line based, so I think it’s not automated
439: [20:58:14] * janneklouman-- has joined #silverstripe
440: [21:06:13] * muskie9 quit (Ping timeout: 250 seconds)
441: [21:15:26] <ss-helper> Resize images on upload - http://stackoverflow.com/questions/19895497/resize-images-on-upload
442: [21:21:52] * gelignite has joined #silverstripe
443: [21:22:48] <Nightjar> ^ onbeforewrite if(!$this->ID)
444: [21:23:03] <Nightjar> bit hackey, but it'd do the trick I think.
445: [21:23:19] * muskie9 has joined #silverstripe
446: [21:27:55] * DanaeNZ quit (Quit: TIME TO FEED)
447: [21:29:06] * UndefinedOffset quit (Quit: Leaving.)
448: [21:32:30] * DanaeNZ has joined #silverstripe
449: [21:49:42] * janneklouman-- quit (Ping timeout: 250 seconds)
450: [21:56:31] <samsam> Ok so here’s a PHP question. Suppose you have a mod, and because you need to re-use the mod folder dir name, you simply define a constant let’s say MOD_DIR in _config.php
451: [21:57:29] <samsam> Now you need to use the constant in a class property eg: private static $icons = MOD_DIR . “/icons/icon.png”;
452: [21:57:52] <samsam> But you can’t concatenate strings in class properties
453: [21:58:54] <samsam> sooo I need a fix
454: [21:59:35] <muskie9> samsam, why not Config::inst()->update('YourClass', 'icons', MOD_DIR."/icons/icon.png"); in _config.php
455: [21:59:37] <Nightjar> private static == Config default.
456: [21:59:41] <Nightjar> what muskie9 said.
457: [22:00:08] <samsam> ooh right.. so this is basically what everyone does right?
458: [22:00:17] <Nightjar> I mean... I guess?
459: [22:00:40] <muskie9> path of least resistance I think
460: [22:01:50] <Nightjar> It's more ideal when the folder name doesn't change, because then your CSS works.
461: [22:02:05] <Nightjar> ... from the template.
462: [22:05:55] <samsam> true but suppose it’s a public mod, users can name it anything
463: [22:06:26] * janneklouman-- has joined #silverstripe
464: [22:10:23] <terryapodaca> Ok, I've asked this already, and I got a little farther with wmk 's help earlier. But, I want to see what other might have to say or give advice on...I have two DataObjects, Role and Staff. I have a StaffPage that I want to list all Staff members, but groupedby Role (which like I said is it's own DO). I want to see if my code is even remotely close or if this is even possible
465: [22:10:33] <terryapodaca> Role DO: http://www.sspaste.com/paste/show/5851c2d0dc625
466: [22:10:47] * janneklouman-- quit (Ping timeout: 250 seconds)
467: [22:10:48] <Nightjar> GroupedList
468: [22:11:15] <terryapodaca> Staff DO: http://www.sspaste.com/paste/show/5851c377a687e
469: [22:11:19] <Nightjar> http://api.silverstripe.org/3.4/class-GroupedList.html
470: [22:11:57] <Nightjar> :)
471: [22:11:59] <terryapodaca> Nightjar: I am using it, kinda, but I might have my Context mixed up
472: [22:12:44] <terryapodaca> let me show you my StaffPage code: http://www.sspaste.com/paste/show/5851c3d5da2db
473: [22:13:23] * gelignite quit (Quit: http://bit.ly/1kso8Ta)
474: [22:13:44] <terryapodaca> StaffPage template: http://www.sspaste.com/paste/show/5851c40b73e30
475: [22:14:03] * trash__ has joined #silverstripe
476: [22:14:07] <terryapodaca> so, the test page is: http://texasbeefcheckoff.com/about/test/
477: [22:14:08] <Nightjar> GroupedList::create($this->Staff())->GroupBy('RoleID')
478: [22:14:29] <Nightjar> ->sort(...
479: [22:14:49] <Nightjar> err sorry, use GroupedBy (with the d)
480: [22:14:56] <Nightjar> ed*
481: [22:16:15] <terryapodaca> well, the Roles and Staff are being managed by ModelAdmin
482: [22:16:37] <Nightjar> Staff::get then :>
483: [22:22:35] <terryapodaca> ok Nightjar: that all works, so my template, it's grouping by the RoleID, but that's based on the RoleID in the Staff table/DO, how do I get the proper Role.Name and Role.Description in my template now?
484: [22:22:45] <terryapodaca> http://texasbeefcheckoff.com/about/test/
485: [22:23:25] <Nightjar> uhh
486: [22:23:41] <Nightjar> Same way you normally would I believe.
487: [22:24:06] <Nightjar> OR group by Title instead
488: [22:24:15] <Nightjar> Role.Title I mean
489: [22:24:29] <Nightjar> iirc it'll be the thing in the outer list
490: [22:24:51] <Nightjar> otherwise you could use <% if $First %><h2>$Role.Title
491: [22:25:12] <Nightjar> when <% loop $ThatGroupedList%><% loop $Children %>
492: [22:26:40] <muskie9> Nightjar terryapodaca I think the "grouped by" item that has children isn't the actual object, but rather just an index as the grouped list is an ArrayList with "child" ArrayLists
493: [22:27:54] <muskie9> ['Role1.ID' => $children = ArrayList, 'Role2.ID' => $children = ArrayList] type of thing
494: [22:29:32] <terryapodaca> ugh
495: [22:30:08] <Nightjar> muskie9, terryapodaca yeah, there are two very similarly named functions on GroupedList, which do rather different things.
496: [22:30:23] <Nightjar> One bascially modifies the DataQuery for a "GROUPED BY" clause.
497: [22:30:30] <Nightjar> the other is for use in templates.
498: [22:31:01] * muskie9_ has joined #silverstripe
499: [22:31:11] <Nightjar> I can never remember which is which, I think caps in the declaration is Template one
500: [22:31:19] <Nightjar> but you want the template one.
501: [22:31:33] <terryapodaca> so basically the way I have it set up, wont work the way I want it to
502: [22:31:38] <Nightjar> not sure
503: [22:31:42] <Nightjar> skim read
504: [22:31:54] <Nightjar> doing 4 things at once :<
505: [22:32:18] <muskie9_> GroupedBy calls groupBy
506: [22:32:26] <Nightjar> yeah, as I'd expect it to
507: [22:33:54] * muskie9 quit (Ping timeout: 250 seconds)
508: [22:35:55] <terryapodaca> basically what I need is this: https://www.silverstripe.com/who-we-are/our-team/
509: [22:36:16] <terryapodaca> is silverstripe.com code base public some place like on github?
510: [22:36:26] <Nightjar> no, it's .com (not .org)
511: [22:36:43] <Nightjar> ie, Ltd, not OSS project :>
512: [22:36:57] <Nightjar> or err... LLC I think you call them in the states :>
513: [22:38:17] <Nightjar> muskie9_, is correct. The GroupedBy result outter layer isn't the "Role" object.
514: [22:38:59] <Nightjar> It's an ArrayData with the group reference (id/title/whatever you grouped on) and a Children - this holds the list of things in that group.
515: [22:39:11] <Nightjar> so you have two choices terryapodaca, as I said.
516: [22:39:15] <terryapodaca> That makes sense, but I don't know how to make my query correct based on the structure I have been given
517: [22:39:17] <Nightjar> 1) Group by title instead.
518: [22:39:31] <Nightjar> Then you can spit out the title before <% loop Children %>]
519: [22:40:00] <Nightjar> 2)
520: [22:40:39] <Nightjar> <% loop $Children %><% if $First %><h2>$Role.Title</h2><% end_if %>
521: [22:41:13] <Nightjar> That's it chap!
522: [22:41:46] <muskie9_> <% with $Children.First %><h2>$Role.Title</h2><% end_with %> ;P
523: [22:42:14] <Nightjar> Or you could do that, before the <% loop Children %>, yeah.
524: [22:42:27] <Nightjar> a variation of step 2 :P
525: [22:42:36] <Nightjar> err, option* 2
526: [22:44:45] <terryapodaca> ALRIGHT!!!!!!!!!!!!!!!!!!
527: [22:45:03] <terryapodaca> muskie9_ and Nightjar to the rescue!!!!!!!!!!!!
528: [22:45:12] <muskie9_> 👍
529: [22:45:22] <Nightjar> :)
530: [22:45:24] <Nightjar> \o
531: [22:45:45] <Nightjar> muskie9 -> o/\o <- Nightjar
532: [22:45:53] <muskie9_> lol
533: [22:46:04] <Nightjar> \o/ <- terryapodaca
534: [22:46:13] <Nightjar> xD
535: [22:46:14] <terryapodaca> o/\o/\o
536: [22:46:28] <terryapodaca> well, that looks a little odd, but you get it
537: [22:46:46] <terryapodaca> high fives all around
538: [23:00:01] * ss-helper quit (Remote host closed the connection)
539: [23:00:17] * ss-helper has joined #silverstripe
540: [23:03:37] * Ali_Alamshahi quit (Ping timeout: 240 seconds)
541: [23:05:39] * janneklouman-- has joined #silverstripe
542: [23:07:03] * Ali_Alamshahi has joined #silverstripe
543: [23:11:50] * Stomach quit (Quit: zzz)
544: [23:17:47] <Nightjar> high ten terryapodaca :)\
545: [23:25:40] * janneklouman-- quit (Ping timeout: 252 seconds)
546: [23:30:30] * Ali_Alamshahi quit (Quit: Leaving)
547: [23:31:32] * muskie9_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
548: [23:48:08] <terryapodaca> in the template, is there a <% if $RoleID = 1 or $RoleID = 2 %>
549: [23:48:56] * trash__ quit (Ping timeout: 260 seconds)

These logs were automatically created by ss-log on irc.freenode.net.