# |
May 1st 2019, 08:56 |
voycey |
you would just specify it in the association definition |
# |
May 1st 2019, 08:56 |
voycey |
I guess you would need to define a parent_id or however else you want to self join |
# |
May 1st 2019, 08:56 |
noel |
@voycey I saw that in the docs but it didn’t make sense to me. I mean what SQL changes / create would go along with that to enable the data to be saved? |
# |
May 1st 2019, 08:54 |
sam.parsons |
Hi, using CakePHP 3, I removed a parameter from my index function in a plugin controller, then got missing route error: Missing Route Cake\Routing\Exception\MissingRouteException Reverted all changes, deleted my cache folder, and now every page is giving this, any ideas? Thanks |
# |
May 1st 2019, 07:57 |
slackebot |
->contain( ['CompanyBooks'] ); ``` |
# |
May 1st 2019, 07:57 |
willem |
@admad any idea why the ORM istn using the Table class in my query from yesterday? If i add the type explicitly to the where it is working as it should, so i believe you are correct in saying it doesn’t load the schema. ``` $this->Transactions->find() ->where([ 'CompanyBooks.is_import_book_type' => true, ], ['CompanyBooks.is_import_book_type' => 'boolean'] ) |
# |
May 1st 2019, 07:55 |
ra7bi |
@admad Yes , i know it's not possible but i thought there is a way in somehow @mrfeedback this is what im doing now ,thnaks |
# |
May 1st 2019, 07:14 |
megan |
Sure no prob! |
# |
May 1st 2019, 07:14 |
kiwi_81 |
A thanks. I was abusing the Google cache, but that's better. :) |
# |
May 1st 2019, 07:13 |
roel |
@megan Oh, ok :slightly_smiling_face: Thanks :+1: |
# |
May 1st 2019, 07:13 |
megan |
in the meantime you could use https://book.cakephp.org/3.next/en/index.html in the meantime |
# |
May 1st 2019, 07:13 |
kiwi_81 |
Yep, it's only cakebook 3 |
# |
May 1st 2019, 07:13 |
megan |
Yupp - the team was working on the book last night, so prob related and hopefully up soon! |
# |
May 1st 2019, 07:12 |
roel |
It's only the 3.0 cook book, I guess? |
# |
May 1st 2019, 07:11 |
megan |
kiwi_81 - checking it out! |
# |
May 1st 2019, 06:58 |
kiwi_81 |
*down |
# |
May 1st 2019, 06:58 |
kiwi_81 |
It seems the whole Cake cookbook doc is done with a 404? |
# |
May 1st 2019, 06:54 |
mrfeedback |
@ra7bi you should define a global javascript var in your view and then check and access it in your javascript |
# |
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 |