Log message #4185122

# At Username Text
# May 1st 2019, 06:32 hippo are the docs working
# May 1st 2019, 04:13 admad @ra7bi so you are asking whether you can use PHP code in a static JS file?
# May 1st 2019, 03:48 ra7bi is it possible to use `<?= $this->request->webroot; ?>` in `webroot/js/file.js`
# May 1st 2019, 00:45 voycey https://book.cakephp.org/3.0/en/orm/associations.html ``` class CategoriesTable extends Table { public function initialize(array $config) { $this->hasMany('SubCategories', [ 'className' => 'Categories' ]); $this->belongsTo('ParentCategories', [ 'className' => 'Categories' ]); } }```
# May 1st 2019, 00:41 voycey @noel I think you would just need to create an association back to the same table class with the field that you plan to self join on
# May 1st 2019, 00:40 voycey Was hoping there was some magic to do that - oh well!
# Apr 30th 2019, 23:27 noel Specifically I want to know how to create a schema for a self many to many relationship (i.e. same table with many-to-many to self) so that Bake picks up the schema correctly. I’ve already figured it out for the other types (although some documentation on that would have been helpful.)
# Apr 30th 2019, 23:25 noel Evening. Where can I find examples of schemas for the various relationship types of the ORM?
# Apr 30th 2019, 20:52 rmamba figured it out. CakePHP doesn't like if indexes have same name as columns
# Apr 30th 2019, 19:20 willem No. Normal tables.
# Apr 30th 2019, 19:17 admad @willem it means your table class isnt being used in association hence ORM doesnt have it's schema info. Are those plugin tables?
# Apr 30th 2019, 18:49 willem how could this happen. i have a tinyint (1) field as aboolean in the table. if i directly use the table and set the where to ' => false, the resulting sql is correctly cast to a 0. if i use this table in a joined query using contian and put the same in the where clause, it is cast incorrectly as a ‘ ' (string) ```
# Apr 30th 2019, 18:37 jeremyharris daniel95 yep, people are usually in here to help out. post your question and if someone’s here that can help, they’ll answer! :slightly_smiling_face:
# Apr 30th 2019, 18:25 daniel95 Hello, is it possible to get some support here or not? BR daniel
# Apr 30th 2019, 17:50 rmamba but not with cakephp code
# Apr 30th 2019, 17:50 hollistergraham123 I can access other methods in the same controller that existed yesterday but anything I add I just get that error
# Apr 30th 2019, 17:50 rmamba I looked at logs and if I run sql in the db I get daba back
# Apr 30th 2019, 17:50 rmamba been away from CakePHP since 1.x and now putting 3.7.x app together but I can't get any data from my database
# Apr 30th 2019, 17:49 hollistergraham123 This is the function
# Apr 30th 2019, 17:48 hollistergraham123 This is the error message ` "Action InventorysController::test() could not be found, or is not accessible."`
# Apr 30th 2019, 17:48 hollistergraham123 All of a sudden my cakephp just stopped recognizing new controller methods. Any ideas.
# Apr 30th 2019, 17:40 slackebot property but it doesn't seem to. Ideas? Basically I'm using `$this->$model->associations()->keys()` to build menus for content management and wish to programatically include, say, `User` and `Posts` associations but exclude associations with models like `ImagesArticles`
# Apr 30th 2019, 17:40 this.impetus Searching here: https://api.cakephp.org/3.7/class-Cake.ORM.Association.html Trying to determine from an Association Object whether it the associated model has a HABTM relationship with the current model context. A call to `debug()` on an association object reveals a protected property, `_targetTable` that seems to do for making this inference (only HABTM associations seem to populate it); I'd hoped `getTarget()` would access this
# Apr 30th 2019, 16:11 this.impetus :,)
# Apr 30th 2019, 16:10 ricksaccous if it weren't for you meddling kids
# Apr 30th 2019, 16:10 ricksaccous i would have gotten away with it too
# Apr 30th 2019, 16:10 this.impetus And only a team of unlikely misfits can save me
# Apr 30th 2019, 16:10 this.impetus Hubris will be my downfall, in the end.
# Apr 30th 2019, 16:10 this.impetus I've seen this episode.
# Apr 30th 2019, 16:09 ricksaccous as you keep growing you will achieve super saiyan status
# Apr 30th 2019, 16:09 ricksaccous and then you grow brain cells and your power increases
# Apr 30th 2019, 16:09 this.impetus It's silly, I know, but years ago when I learned cake the first time, this was how I did it; do every irritating little thing as cakey as possible, and the logic absorbs
# Apr 30th 2019, 16:08 ricksaccous lol
# Apr 30th 2019, 16:08 ricksaccous just create a new helper class and use the trait in it
# Apr 30th 2019, 16:08 this.impetus Ah! yep. got it. ty and @admad vm
# Apr 30th 2019, 16:08 ricksaccous and use the helper
# Apr 30th 2019, 16:08 ricksaccous so basically you want to create a helper
# Apr 30th 2019, 16:07 this.impetus I get that—so what I *want* is to leverage a single function in the trait in a template file (I could add the trait to the controller and create the ID list before hand I guess..? seems unwieldy?). At this point it'd be easier to just copy and paste it, haha, but it's worth learning to do properly. Again, if anyone's busy ignore this, I'm just being anal
# Apr 30th 2019, 16:05 ricksaccous @this.impetus you can use the trait in any class
# Apr 30th 2019, 16:03 this.impetus I can see extending a new View class with the trait, i suppose, but that's extremely overkill for my context
# Apr 30th 2019, 16:01 this.impetus @admad Ignore this if you're busy, this is a curiosity/learning thing—I'm not sure how, in the context of a view, to utilize the trait you linked. tried `use Cake\View\Helper\IdGeneratorTrait` coupled with `IdGeneratorTrait::_id()` but it's a protected method; is this a PHP-ignorance or Cake-ignorance thing? :P