Logs for #cakephp

Page 9 of 36,387, showing 100 records out of 3,638,688 total, starting on record 801, ending on 900

# At Username Text
# Nov 6th, 09:08 markwendelson getting error when doing this in a controller
# Nov 6th, 08:58 pidlo ok i get this $query->newExpr('DATE_ADD(dfrom, INTERVAL - @num MONTH)')
# Nov 6th, 08:50 kgb.acct.personal It's not that inconvenient to be honest.
# Nov 6th, 08:48 conehead That might be true. Not as convinient as it could be :P
# Nov 6th, 08:44 admad `'comment_id' => 1` is the same as saving any other field. There's no special handling there. While `_ids` is a special convention
# Nov 6th, 08:42 conehead just to save it the same way. I get your point. But both are associations and the way they are stored are different
# Nov 6th, 08:41 conehead I am just saying: you set a `belongsTo` as `'comment_id' => 1`, but a `belongsToMany` as `'comment' => ['_ids' => [1,2,3]]. why not save a `belongsToMany` as `'comment_ids' => [1,2,3]` or a `belongsTo` as `'comment' => ['_id' => 1]` imho that would be more convinient
# Nov 6th, 08:38 admad that's a hasMany, not belonsTo
# Nov 6th, 08:37 conehead Or the other way around would be to allow for multiple associations to set e.g. `new Post(['comment_ids' => [1,2,3])`
# Nov 6th, 08:35 conehead Think it would be common sense that you could handle different associations similar
# Nov 6th, 08:33 admad why? there's only a single fK value for belongsTo
# Nov 6th, 08:31 conehead @admad Yes thanks. That works. Just wondering if this example is not a little bit confusing then: https://book.cakephp.org/3/en/orm/saving-data.html#saving-belongsto-associations Something similar like `_ids` would be great I think
# Nov 6th, 08:28 pidlo something like this? $query->func()->dateAdd('dfrom', @num, 'MONTH') ???
# Nov 6th, 08:28 pidlo howto do this 'DATE_ADD(dfrom, INTERVAL - @num MONTH)'
# Nov 6th, 08:28 pidlo hello all i have registred variable in sql '@num:=CAST(period AS UNSIGNED)',
# Nov 6th, 08:26 admad @conehead to associate with existing record just set the foreign key, `attachement_id` in your case
# Nov 6th, 08:24 scuadra Hello everyone. In Cake 3 is it possible to define the fields to be fetched in belongsTo association in the initialize() method?
# Nov 6th, 08:21 conehead Still thinks that the created entity is "new". Doesn't seem to recognize the id
# Nov 6th, 08:21 conehead Good morning
# Nov 6th, 08:20 rudy1976s good morning to all !!!
# Nov 6th, 08:18 conehead Hm I'll give it a shot. But it is not a new entity and it works with other `belongs to many` without `associated` as well
# Nov 6th, 08:16 dereuromark Uppercase first char usually as those are the model names.
# Nov 6th, 08:14 karmicdice `'associated' => ['attachments']`
# Nov 6th, 08:14 karmicdice maybe parameter 2 should be `'associated'` ?
# Nov 6th, 08:13 conehead All I want to do is save an association. It even saves null, when I do ``` $attachment = $this->Attachments->get(1); $post = $this->Posts->newEntity([ 'name' => 'newPost', 'attachment' => $attachment, ]);
# Nov 6th, 08:11 karmicdice I reckon, it saves a null when you do not add an attachment? For situations like these, have you considered writing a behaviour and utilizing `beforeSave()`. What is the exact scenario and what are you trying to achieve?
# Nov 6th, 08:10 conehead according to this: https://book.cakephp.org/3/en/orm/saving-data.html#saving-belongsto-associations it should work just fine
# Nov 6th, 08:09 conehead What could be the reason my existing `belongsTo` association is not saved? I have an existing association that works for reading data. When I try ``` $post = $this->Posts->newEntity([ 'name' => 'newPost', 'attachment' => [ 'id' => 1 // my existing attachment ] ]); ``` Always thinks that it is a new attachment instead of using the existing one. Even loading the attachment in a variable and set it explicitly does not save the
# Nov 6th, 08:09 slackebot1 association. Just says `null`. If I set the `attachment_id` manually in the `posts` table, I can load the data with `contain` just fine.
# Nov 6th, 07:53 kgb.acct.personal Don't forget to put `use App\Constant\FileTypes;`
# Nov 6th, 07:53 karmicdice or outside using what @kgb.acct.personal suggested.
# Nov 6th, 07:52 karmicdice using self::
# Nov 6th, 07:52 kgb.acct.personal FileTypes::IMAGE
# Nov 6th, 07:50 markwendelson how will i use this constant in my controller?
# Nov 6th, 07:46 javier.villanueva morning
# Nov 6th, 07:43 markwendelson good day!
# Nov 6th, 07:07 alexdd55976 morning
# Nov 6th, 07:04 jotpe Morning
# Nov 6th, 06:51 conehead Yeh, was a true pain in the ass. But good to know!
# Nov 6th, 06:49 admad Cake doesn't have any such "compiled" code
# Nov 6th, 06:42 conehead Don't need typed properties in core (yet) ;) But absolutely love the idea
# Nov 6th, 06:42 conehead Had problems once with another framework. Couldn't use type hints because somewhere the code was "compiled", but without the typehints. This resulted in errors
# Nov 6th, 06:19 admad you can do whatever you want in your app code. Can't add typed properties in 3.x core and it needs to support older php versions
# Nov 6th, 05:58 conehead Any1 tried cake 3.x with php 7.4 already? Would be so glad to use typed properties
# Nov 6th, 03:13 liaogz82 any examples I can look up to?
# Nov 6th, 03:13 liaogz82 I need to mock a local S3 server for a cakephp bash job
# Nov 6th, 03:12 liaogz82 hi guys
# Nov 6th, 02:25 daniel.upshaw Anyone using Cake 4 in production?
# Nov 6th, 00:51 daniel.upshaw And thank you for the info @dereuromark
# Nov 6th, 00:51 daniel.upshaw Will look into another time
# Nov 6th, 00:51 daniel.upshaw Lol interestingly this: `bin/cake bake migration_diff TableName` Is still recognized as a command, but it's not listed... will have to dig further soon... I'm just getting started with v4 today
# Nov 6th, 00:50 daniel.upshaw Makes sense
# Nov 6th, 00:50 daniel.upshaw Ah got it!
# Nov 6th, 00:47 dereuromark phinx sure also could need some love, after all migrations depends on that directly.
# Nov 6th, 00:47 daniel.upshaw And if so, wonder why
# Nov 6th, 00:46 daniel.upshaw I hope it's not losing too much steam
# Nov 6th, 00:46 daniel.upshaw Okay got it
# Nov 6th, 00:45 dereuromark if there is no current commits, most likely no one currently is
# Nov 6th, 00:43 daniel.upshaw Is there some place to find out if anyone's currently working on [x feature] though?
# Nov 6th, 00:43 daniel.upshaw Ah alright
# Nov 6th, 00:43 dereuromark you can just PR towards 4.x branch there
# Nov 6th, 00:39 daniel.upshaw Hoping to get an idea of the push on `4.x` and where it's feasible to contrib etc
# Nov 6th, 00:39 daniel.upshaw And `bin/cake migrations create` doesn't do it (yet)
# Nov 6th, 00:38 daniel.upshaw But that's the output I have in `bin/cake --help`
# Nov 6th, 00:38 daniel.upshaw ```Bake: - bake - bake all - bake behavior - bake cell - bake command - bake component - bake controller - bake controller all - bake fixture - bake fixture all - bake form - bake helper - bake mailer - bake middleware - bake model - bake model all - bake plugin - bake shell - bake shell_helper - bake task - bake template - bake template all - bake test Migrations: - migrations - migrations create -
# Nov 6th, 00:38 slackebot1 migrations dump - migrations mark_migrated - migrations migrate - migrations orm-cache-build - migrations orm-cache-clear - migrations rollback - migrations seed - migrations status```
# Nov 6th, 00:38 daniel.upshaw Yep. I see they're still in the `Task` folder: https://github.com/cakephp/migrations/tree/4.x/src/Shell/Task
# Nov 6th, 00:36 dereuromark bake part? snapshot etc? very much possible
# Nov 6th, 00:34 daniel.upshaw Perusing that at the moment
# Nov 6th, 00:34 daniel.upshaw Looks like the `4.x` Migrations still needs the functionality to generate from existing schemas, yes?
# Nov 6th, 00:04 daniel.upshaw No, more likely my config :,)
# Nov 6th, 00:04 daniel.upshaw Oh, interesting
# Nov 6th, 00:03 daniel.upshaw Lol
# Nov 6th, 00:03 daniel.upshaw Oops
# Nov 6th, 00:02 daniel.upshaw ```/* * The actual directory name for the application directory. Normally * named 'src'. */ define('APP_DIR', 'src'); /* * Path to the application's directory. */ define('APP', CMS_CORE_PATH . DS . APP_DIR . DS);```
# Nov 6th, 00:02 daniel.upshaw Yes it appears to be in the code
# Nov 5th, 23:53 daniel.upshaw Fair
# Nov 5th, 23:53 dereuromark still alpha
# Nov 5th, 23:53 dereuromark u never know
# Nov 5th, 23:53 daniel.upshaw Yah, I mean it's such a basic thing I'm sure it won't be present in a fresh app install
# Nov 5th, 23:51 dereuromark verified in minutes, and then hopefully it becomes a bit easier to track down the rest
# Nov 5th, 23:51 dereuromark still good to exclude such things as core bugs
# Nov 5th, 23:50 daniel.upshaw This is really bare bones though.. I'm trying to work with a basic `require cakephp/cakephp`
# Nov 5th, 23:50 daniel.upshaw That'll be the way to go
# Nov 5th, 23:50 daniel.upshaw Oddly, it's only some of the templates, specifically Error templates
# Nov 5th, 23:50 dereuromark see if you can replicate with fresh 4.x app
# Nov 5th, 23:49 daniel.upshaw I wouldn't put it past a config issue... but I did normalize things to Cake4 as closely as I could
# Nov 5th, 23:45 dereuromark sounds like a config issue, or a bug
# Nov 5th, 23:42 daniel.upshaw Any ideas offhand why Cake4 branch would look for any templates in `src/templates`?
# Nov 5th, 23:19 slackebot1 ->like( $conc2, "%$search%" ) ->like( $conc3, "%$search%" ) ->like( $conc4, "%$search%" ); } ); } ``` But all I get is a ``` Column not found: 1054 Unknown column 'Table2.first_name' in 'where clause' ``` due to the fact, that the Query doesn't join. This functions resides in my index() function of my Table1Controller and the initialization of the $query
# Nov 5th, 23:19 slackebot1 variable does have the contain ``` $query = $this->Table->find( 'all' ) ->contain( ['Table2'] ); ``` The contain also works if i remove my function from above (to show related information in my index page) but i dont know how i can perform a custom where in which both my tables are being searched with concatinated fields
# Nov 5th, 23:19 slackebot1 'Table2.last_name' => 'literal' ] ); $conc4 = $q->func() ->concat( [ 'Table2.last_name' => 'literal', ' ', 'Table2.first_name' => 'literal' ] ); return $exp->or( [ 'Table1.company LIKE'
# Nov 5th, 23:19 slackebot1 */ // Concatenated EasybillCustomers Name $conc1 = $q->func() ->concat( [ 'Table1.first_name' => 'literal', ' ', 'Table1.last_name' => 'literal' ] ); $conc2 = $q->func() ->concat( [
# Nov 5th, 23:19 slackebot1 'Table1.last_name' => 'literal', ' ', 'Table1.first_name' => 'literal' ] ); // Concatenated EasybillCustomersContacts Name $conc3 = $q->func() ->concat( [ 'Table2.first_name' => 'literal', ' ',
# Nov 5th, 23:19 kevin.pfeifer i try to do something like that ``` // Change query if a search parameter is given in GET data if ( $search ) { // Search for concat fields in cakephp >=3 // https://stackoverflow.com/questions/35405261/search-with-concat-fields-in-cakephp-3 $query->where( function( $exp, $q ) use ( $search ) { /** * @var QueryExpression $exp * @var Query $q
# Nov 5th, 23:19 slackebot1 => "%$search%", 'Table1.first_name LIKE' => "%$search%", 'Table1.last_name LIKE' => "%$search%", 'Table1.city LIKE' => "%$search%", 'Table2.first_name LIKE' => "%$search%", 'Table2.last_name LIKE' => "%$search%" ] ) ->like( $conc1, "%$search%" )
# Nov 5th, 21:56 phantomwatson Ah, nevermind for my question. `Table::getDependent()` was right in front of me the whole time.
# Nov 5th, 21:50 phantomwatson I might be misunderstanding what you're trying to do.
# Nov 5th, 21:49 phantomwatson @kevin.pfeifer, does it work to specify a join and include the table name in the field name, e.g. `concat(['title' => 'Articles.title', 'author' => 'Authors.name'])`?
# Nov 5th, 21:47 phantomwatson Does anyone happen to know how to query a table or entity and determine which associations are marked as dependent?