Logs for #cakephp

Page 5 of 36,389, showing 100 records out of 3,638,823 total, starting on record 401, ending on 500

# At Username Text
# Nov 12th, 11:31 tobse Hi to all, one question about validation of associated models. I'm having a "belongsToMany"-association between "contents" and "semestershelves". "content" belongs to one or many "semestershelves". In my form I have multiple checkboxes of entries of the associated model. What I like to obtain is a validation-error when no checkbox is checked. I tried the following in the default validator of the contents-table: ```
# Nov 12th, 11:31 slackebot1 $validator->isArray('semestershelves') ->requirePresence('semestershelves') ->notEmptyArray('semestershelves', __('Please choose at least one entry.'); ``` Or do I have to run the validation manually before building the entity in the controller? Or put the validation into the associated model? Thanks for any advice.
# Nov 12th, 11:12 hmic val: remove/disable the behavior
# Nov 12th, 11:02 val Hi, what is the proper way to remove unnecessary join to i18n table in models that use TranslateBehavior in 3.x when the translation field is not supposed to be retrieved?
# Nov 12th, 10:37 jotpe Both approaches not working
# Nov 12th, 10:37 slackebot1 <jotpe>
# Nov 12th, 10:36 jotpe I tried this:
# Nov 12th, 10:36 jotpe Anyone knows how to pass cli params to a engine in CakePDF? https://github.com/FriendsOfCake/CakePdf#configuration
# Nov 12th, 10:27 development Didn't know about the symlink option. I will try that, thanks!
# Nov 12th, 10:26 challgren Have you tried https://book.cakephp.org/3/en/console-and-shells/plugin-shell.html#plugin-assets
# Nov 12th, 10:25 development Morning all, could anyone tell me how I can trigger all css/js files within a certain plugin folder with .htaccess? When I use "<FilesMatch "\.(css|js)">" it only triggers files that are in /webroot and not files that are in /plugins/MyPlugin/webroot. I would like to set the cache headers for cetrain js/css files which reside inside a plugin folder.
# Nov 12th, 09:11 challgren @mehov for example LastPass will autofill forms even hidden fields
# Nov 12th, 09:10 challgren evening
# Nov 12th, 07:57 admad moin
# Nov 12th, 07:57 javier.villanueva morning
# Nov 12th, 07:57 jotpe Morning
# Nov 12th, 07:56 admad 3.x csrftoken is per session, so it's always going to remain same either way
# Nov 12th, 07:54 admad @mehov apparently it was required because of some safari shenanigans https://github.com/cakephp/cakephp/commit/27994ab1d8d66d61581ae13f5c5fceb61d36d933
# Nov 12th, 07:52 mehov okay, got it thanks for explaining! :)
# Nov 12th, 07:51 admad maybe someone wanted to be overcareful for no reason :slightly_smiling_face:
# Nov 12th, 07:51 mehov okay then why do all these hashes and tokens have autocomplete="off" even though they're hidden? (not being a dick, just learning)
# Nov 12th, 07:51 admad in 4.x you won't even have the `_method` named input for post forms
# Nov 12th, 07:50 admad there's no need, the input already has a value and is hidden, it's not going to be autocompleted
# Nov 12th, 07:48 mehov I looked at the end of the form and "_Token[unlocked]" has explicit autocomplete="off" as well, even though it's value doesn't seem to be a hash Should I contribute autocomplete="off" to the _method as well to keep it consistent?
# Nov 12th, 07:45 admad it wont
# Nov 12th, 07:44 mehov Hi everyone, When I use FormHelper, it adds these hidden inputs: "_method" and "_csrfToken". The token has autocomplete="off" for obvious reasons, but the method doesn't. Can I be sure it won't interfere with browser remembering the login form data if I use FormHelper there? Source code for the _method here: https://github.com/cakephp/cakephp/blob/9e14905eba24497a26e8ab5bdf192941086385c8/src/View/Helper/FormHelper.php#L479
# Nov 12th, 05:08 admad @spriz you won't have this problem in 4.0 https://github.com/cakephp/cakephp/blob/4.x/src/I18n/functions.php#L29
# Nov 11th, 23:25 cake101 anyone here?
# Nov 11th, 23:13 cake101 I am trying to add to an input with the type of select a class or id and both will not work. I have tried both Form->input and Form->select. cakephp v 2.10. please someone assist
# Nov 11th, 22:44 dereuromark @spriz As long as we dont have a clean __() to always return string, I just https://github.com/spryker/cakephp-statemachine/blob/master/tests/phpstan.neon#L9
# Nov 11th, 21:29 spriz Also do I miss something or do I need to do this? ```
# Nov 11th, 21:26 spriz @admad how about `Parameter #1 $message of method Cake\Controller\Component\FlashComponent::success() expects string, string|null given.` when doing `$this->Flash->succes(__('Great success!'));` ?
# Nov 11th, 21:24 spriz Much love @admad!
# Nov 11th, 19:39 admad @spriz https://github.com/FriendsOfCake/crud/blob/master/phpstan.neon#L4
# Nov 11th, 19:11 spriz and avoid `Access to an undefined property object::$query.`
# Nov 11th, 19:10 spriz How do you make phpstan happy about this one?! :) $this->Crud->on('beforePaginate', function (Event $event) { $event->getSubject()->query->find('NonDraft'); });
# Nov 11th, 13:16 pieceof join /#composer
# Nov 11th, 09:53 conehead Did you try with sudo? Seems to be permissions
# Nov 11th, 09:36 peter349 Hi, When i run the shell command i get this `Warning Error: default cache was unable to write 'test_data' to Cake\Cache\Engine\FileEngine cache in [/home/halftome/PhpstormProjects/name-of the_project/vendor/cakephp/cakephp/src/Cache/Cache.php, line 286] `
# Nov 11th, 08:53 spriz @angelxmoreno Yeah I know that :slightly_smiling_face: But I am using the `Autnetication` plugin :+1:
# Nov 10th, 23:40 angelxmoreno looks like `email` was not a field. all works now!
# Nov 10th, 23:33 ndm Ah, I see. I'm not very familiar with elastic, sorry.
# Nov 10th, 23:31 angelxmoreno whoops, forgot to mention the import part: this is using https://github.com/cakephp/elastic-search
# Nov 10th, 23:28 ndm Anyhow... look at the generated SQL
# Nov 10th, 23:28 ndm `QueryBuilder`? What even is that?
# Nov 10th, 23:18 angelxmoreno Anyone see anything wrong with this? I am not getting results when combining via `or` ``` public function findMatch(Query $query, array $options) { $match = Hash::get($options, 'match'); if ($match) { $query->where(function (QueryBuilder $builder) use ($match) { return $builder->and( $builder->regexp('name', '~.*' . $match . '.*~i'),
# Nov 10th, 23:18 slackebot1 $builder->regexp('email', '~.*' . $match . '.*~i') ); }); } return $query; } ```
# Nov 10th, 23:14 angelxmoreno @spriz `AuthComponent` <> `Authentication Plugin`
# Nov 10th, 22:45 spriz I have a weird issue where `_setCurrentUser` is run twice, second time `$this->request->getAttribute('identity')` returns null :S
# Nov 10th, 22:45 spriz Anyone using https://github.com/UseMuffin/Footprint with Cake 3 and Authentication middleware? :slightly_smiling_face:
# Nov 10th, 18:43 wYm @ndm Oh thinks it works like a charm :)
# Nov 10th, 18:35 ndm You'd have to override the type. Use the second argument of `where()` to supply a type accordingly: `where(['field LIKE' => '%value%'], ['field' => 'string'])`
# Nov 10th, 18:29 wYm hi all, how can I add where clause for Json type column ? I tried 'field LIKE' => '%value%' but I didn't work
# Nov 10th, 16:46 graziel no need for base64 encode
# Nov 10th, 16:45 graziel you can access file with usual cake way `$this->request->getData('cv_file');`
# Nov 10th, 16:45 graziel ```a = new FormData() a.append('cv_file', document.getElementById('main_page').files[0]) a.append('additional_files[]', document.getElementById('id0').files[0]) a.append('additional_files[]', document.getElementById('id1').files[0]) a.append('query', 'mutation { apply(offer_id: "1", cv_file: "cv_file", additional_files: "additional_files") }') axios.post('http://example.com/api', a)```
# Nov 10th, 16:45 graziel @mrfeedback im using combo of vue+axios as front and graphql+jose/upload to handle file upload but same principle
# Nov 10th, 14:52 mrfeedback but im wondering if there is already any plugin which addresses base64 encoded streams yet
# Nov 10th, 14:52 mrfeedback im using it in combination with angular. so at the moment I guet a base64 file stream when the file gets uploaded
# Nov 10th, 14:46 luizcmarin @mrfeedback https://www.startutorial.com/articles/view/how-to-build-a-file-upload-form-using-dropzonejs-and-php maybe...
# Nov 10th, 14:39 mrfeedback or is therer any recommended upload plugin for such a case?
# Nov 10th, 14:35 mrfeedback the upload could be an image, video or pdf
# Nov 10th, 14:34 mrfeedback has anyone a tip/source for me on how to handle fileuploads to an api with cakephp under the hood? I would get a base64 stream via dropzone. But I am not sure how to handle that in a "correct" way
# Nov 10th, 13:38 luizcmarin help please
# Nov 10th, 13:38 luizcmarin good morning everyone I am trying to configure cakephp4 on IIS, windows 10. I have the same issues described here https://stackoverflow.com/questions/30676952/cakephp-3-0-iis-web-config, ie "The content of the pages is rendering fine, just not the images and css. "
# Nov 10th, 09:05 kevin.pfeifer @voycey thx, i just thought there is an "easy" way to adjust the outputed paginator to be in a specific "scope" but doing it per AJAX is definitely better for the UX.
# Nov 10th, 03:21 voycey Especially if you have a lot of different models on the page that need sorting / filtering individually
# Nov 10th, 03:21 voycey Multiple pagination is supported in cake3 but I generally find it better to do this via Ajax
# Nov 9th, 22:51 kevin.pfeifer especially when i have multiple related tables, therefore multiple paginators
# Nov 9th, 22:50 kevin.pfeifer Another Question: Is it possible to use the paginator on related entries inside the view template? Per default CakePHP just puts out all the entries it has found and doesn't allow for sorting or pagination.
# Nov 9th, 21:21 kevin.pfeifer FYI: I created a stackoverflow question with more information about my problem mentioned above https://stackoverflow.com/questions/58783591/cakephp4-concatenated-where-on-connected-table-not-working-as-expected
# Nov 9th, 20:36 mrfeedback ok forget it. I had the same fixture two times but one with a typo....
# Nov 9th, 20:26 mrfeedback contain would give back a result of projects even if there is no connection to projectclosings. And I want to make sure that three isn´t any connection
# Nov 9th, 20:24 hollistergraham123 Why use matching? Why not use contain?
# Nov 9th, 20:21 hollistergraham123 This seems like a real bug
# Nov 9th, 20:21 hollistergraham123 I renamed the association to ProfileImages and it works prefect
# Nov 9th, 20:15 hollistergraham123 Same reult
# Nov 9th, 20:12 mrfeedback Have you tried "Authors.Posts.FeaturedImages" and "Authors.Images" ?
# Nov 9th, 20:11 mrfeedback I have a HABTM relation. And I try to get only results IF there is a link between projcets and projectclosings. like this: ``` $has_projectclosing = $this->find('all') ->matching( 'Projects' , function(Query $q) use($project_id) { return $q->where(['Projects.id' => $project_id]); } ) ->toArray(); debug($has_projectclosing); ``` for some reason I get
# Nov 9th, 20:11 slackebot1 back results with Projects which are not related. In fixture there is no link between these two entries, but I get back a result which is mega weired
# Nov 9th, 20:10 hollistergraham123 Anyone experience something like this>
# Nov 9th, 20:10 hollistergraham123 Hey i’m having an issue where if I include Images in the contain statement for Post it won’t include the Images association on Authors
# Nov 9th, 19:26 mrfeedback if I want to use `matching` with a HABTM relationship, do I need to enter the joinTable for the matching assoc?
# Nov 9th, 18:28 kevin.pfeifer or should i create a simple example and explain everything inside a github issue?
# Nov 9th, 18:27 kevin.pfeifer and in the Table Model for Table 2 ``` $this->belongsTo( 'Table1', [ 'foreignKey' => 'table1_id', ] ); ```
# Nov 9th, 18:11 kevin.pfeifer so therfore my question is: how do i search inside a connnected hasMany connection
# Nov 9th, 18:10 kevin.pfeifer this is inside the Table Model of Table 1 ``` $this->hasMany( 'Table2', [ 'foreignKey' => 'Table2_id' ] ); ```
# Nov 9th, 15:18 ndm @kevin.pfeifer That would only work when `Table2` is associated via `belongsTo` or `hasOne`, using the `join` strategy.
# Nov 9th, 14:27 kevin.pfeifer The Connection in the Model between Table 1 and Table 2 is correct, that is not the problem
# Nov 9th, 14:26 kevin.pfeifer Hey Chat, I have a question (current CakePHP 4 Version): I like to perform a concatinated where search on my base table and a connected table. ``` $query = $this->Table1->find( 'all' ) ->contain( ['Table2',] ); $search = $current_request->getQuery( 'search' ); $query->where( function( $exp, $q ) use ( $search ) { /** * @var
# Nov 9th, 14:26 slackebot1 QueryExpression $exp * @var Query $q */ // Concatenated Table1 Name $conc1 = $q->func() ->concat( [ 'Table1.first_name' => 'literal', ' ', 'Table1.last_name' => 'literal' ] ); $conc2 = $q->func()
# Nov 9th, 14:26 slackebot1 ->concat( [ 'Table1.last_name' => 'literal', ' ', 'Table1.first_name' => 'literal' ] ); // Concatenated Table2 Name $conc3 = $q->func() ->concat( [ 'Table2.first_name' => 'literal', ' ',
# Nov 9th, 14:26 slackebot1 'Table2.last_name' => 'literal' ] ); $conc4 = $q->func() ->concat( [ 'Table2.last_name' => 'literal', ' ', 'Table2.first_name' => 'literal' ] ); return $exp->or( [
# Nov 9th, 14:26 slackebot1 'Table1.company LIKE' => "%$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%" ] )
# Nov 9th, 14:26 slackebot1 ->like( $conc1, "%$search%" ) ->like( $conc2, "%$search%" ) ->like( $conc3, "%$search%" ) ->like( $conc4, "%$search%" ); } ); ``` But when i search something i get the error: ``` Column not found: 1054 Unknown column 'Table2.first_name' in 'where clause' ``` Therefore CakePHP doesnt seem to perform the join between Table1 and Table2. Do i do something wrong?
# Nov 9th, 09:16 alexdd55976 morning
# Nov 9th, 03:12 francisdoydora nevermind, figured it out :slightly_smiling_face:
# Nov 9th, 02:52 francisdoydora good morning everyone :slightly_smiling_face: ```$this->Auth->identify()``` fails when I put it in a Cell. anyway this can be fixed? error returned is ```Error: Method App\View\Cell\SwitchSidebarCell::__toString() must not throw an exception, caught Error: Could not render cell - Call to a member function identify() on null [/var/www/html/juniorhigh/src/View/Cell/SwitchSidebarCell.php, line 39]```
# Nov 8th, 21:09 sdevore > You can use the second parameter of Router::connect() to provide any routing parameters that are composed of the default values of the route: ``` Router::connect( '/government', array('controller' => 'pages', 'action' => 'display', 5) ); ```
# Nov 8th, 21:06 ricksaccous might need the double star i dunno