# |
May 5th 2021, 14:34 |
greg138 |
The attribute is showing as dirty? Are changes to the main entity saved? Are there errors noted in any of the entities or your logs? Does the save function return false? |
# |
May 5th 2021, 14:22 |
devito |
after i patch the entity i see the attribute populated with individual records its jus tnot saving. a real head scratcher this oen is |
# |
May 5th 2021, 14:19 |
devito |
hello everyone. I am having a wierd problem. My BTM relationship isnt saving. Im converting my ids into _ids array and then passing it to patchentity on the main model but when it saves the junction table does not reflect the associated items. anyone have any ideas why this would happen? Im also setting ids only in the patchentity options to true |
# |
May 5th 2021, 14:11 |
me1367 |
yea, just lookup each package, slap the versions that should be compatible (or in the case with the ones I'm trying to fix, want to make compatible) and then run the command |
# |
May 5th 2021, 14:08 |
kevin.pfeifer |
“working” versions depend on what cakephp base version you are using |
# |
May 5th 2021, 14:07 |
me1367 |
I'll try what Kevin said... |
# |
May 5th 2021, 14:04 |
kevin.pfeifer |
you need to adjust the composer.json to the “working” version strings and the perform `composer update --with-dependencies` |
# |
May 5th 2021, 14:04 |
ndm |
Well somewhere there's still a reference to an old bake that needs to be updated |
# |
May 5th 2021, 14:02 |
me1367 |
Which is what I'm trying to do but it won't let me (due to this error) |
# |
May 5th 2021, 14:00 |
ndm |
You need to update all your dependencies to compatible versions at once, cakephp, plugins, etc. |
# |
May 5th 2021, 13:55 |
me1367 |
*mild internal annoyance* |
# |
May 5th 2021, 13:40 |
me1367 |
Well, I'm trying to update CakePHP of my main project (my website) to CakePHP 4.x but for that I need to also update some plugins I maintain but it gets all blocked because those plugins rely on CakePHP 3.x and Composer refuses to update to the correct branches (which increase the constraint to `^4.2.5` |
# |
May 5th 2021, 13:37 |
slackebot |
your requirements or minimum-stability. - Installation request for admiral/admiral (locked at dev-master, required as dev-77-make-compatible-with-cakephp-4-x) -> satisfiable by admiral/admiral[dev-master].``` I need to update the package to branch version `dev-77-make-compatible-with-cakephp-4-x` so that I can actually start making it compatible with CakePHP 4.x... |
# |
May 5th 2021, 13:37 |
slackebot |
3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7, 3.6.8, 3.6.9, 3.7.0, 3.7.0-RC1, 3.7.0-RC2, 3.7.0-RC3, 3.7.0-beta1, 3.7.1, 3.7.2, 3.7.3, 3.7.4, 3.7.5, 3.7.6, 3.7.7, 3.7.8, 3.7.9, 3.8.0, 3.8.0-RC1, 3.8.0-RC2, 3.8.0-RC3, 3.8.0-beta1, 3.8.1, 3.8.10, 3.8.11, 3.8.12, 3.8.13, 3.8.2, 3.8.3, 3.8.4, 3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.9.0, 3.9.0-RC1, 3.9.0-RC2, 3.9.1, 3.9.2, 3.9.3, 3.9.4, 3.9.5, 3.9.6, 3.9.7, 3.9.8, 3.9.9, 3.x-dev] but these conflict with |
# |
May 5th 2021, 13:37 |
slackebot |
3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.9.0, 3.9.0-RC1, 3.9.0-RC2, 3.9.1, 3.9.2, 3.9.3, 3.9.4, 3.9.5, 3.9.6, 3.9.7, 3.9.8, 3.9.9, 3.x-dev] but these conflict with your requirements or minimum-stability. - admiral/admiral dev-master requires cakephp/cakephp ^3.6 -> satisfiable by cakephp/cakephp[3.10.0-RC1, 3.6.0, 3.6.0-RC1, 3.6.0-RC2, 3.6.0-beta1, 3.6.0-beta2, 3.6.0-beta3, 3.6.1, 3.6.10, 3.6.11, 3.6.12, 3.6.13, 3.6.14, 3.6.15, 3.6.2, |
# |
May 5th 2021, 13:37 |
slackebot |
cakephp/cakephp[3.10.0-RC1, 3.6.0, 3.6.0-RC1, 3.6.0-RC2, 3.6.0-beta1, 3.6.0-beta2, 3.6.0-beta3, 3.6.1, 3.6.10, 3.6.11, 3.6.12, 3.6.13, 3.6.14, 3.6.15, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7, 3.6.8, 3.6.9, 3.7.0, 3.7.0-RC1, 3.7.0-RC2, 3.7.0-RC3, 3.7.0-beta1, 3.7.1, 3.7.2, 3.7.3, 3.7.4, 3.7.5, 3.7.6, 3.7.7, 3.7.8, 3.7.9, 3.8.0, 3.8.0-RC1, 3.8.0-RC2, 3.8.0-RC3, 3.8.0-beta1, 3.8.1, 3.8.10, 3.8.11, 3.8.12, 3.8.13, 3.8.2, 3.8.3, 3.8.4, |
# |
May 5th 2021, 13:37 |
slackebot |
3.7.5, 3.7.6, 3.7.7, 3.7.8, 3.7.9, 3.8.0, 3.8.0-RC1, 3.8.0-RC2, 3.8.0-RC3, 3.8.0-beta1, 3.8.1, 3.8.10, 3.8.11, 3.8.12, 3.8.13, 3.8.2, 3.8.3, 3.8.4, 3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.9.0, 3.9.0-RC1, 3.9.0-RC2, 3.9.1, 3.9.2, 3.9.3, 3.9.4, 3.9.5, 3.9.6, 3.9.7, 3.9.8, 3.9.9, 3.x-dev] but these conflict with your requirements or minimum-stability. - admiral/admiral dev-master requires cakephp/cakephp ^3.6 -> satisfiable by |
# |
May 5th 2021, 13:37 |
me1367 |
Anyone who knows how I can get around this error: ```Problem 1 - admiral/admiral dev-master requires cakephp/cakephp ^3.6 -> satisfiable by cakephp/cakephp[3.10.0-RC1, 3.6.0, 3.6.0-RC1, 3.6.0-RC2, 3.6.0-beta1, 3.6.0-beta2, 3.6.0-beta3, 3.6.1, 3.6.10, 3.6.11, 3.6.12, 3.6.13, 3.6.14, 3.6.15, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7, 3.6.8, 3.6.9, 3.7.0, 3.7.0-RC1, 3.7.0-RC2, 3.7.0-RC3, 3.7.0-beta1, 3.7.1, 3.7.2, 3.7.3, 3.7.4, |
# |
May 5th 2021, 12:43 |
richard |
also can you not just use if logic blocks - kind of messy i know, but in this case maybe just practical |
# |
May 5th 2021, 12:39 |
richard |
@np some more code would prob be helpful, why are you having trouble over-riding ex, does it not make sense to just create a new controller? can both controllers just rely on a trait that has some logic, can the models just use traits? |
# |
May 5th 2021, 12:24 |
np |
S.O.S => https://discourse.cakephp.org/t/cakephp-4-2-how-to-override-the-mvc-with-the-mvc-from-other-plugin/9308 |
# |
May 5th 2021, 12:15 |
eax |
I’ll check out the PHP Session timeout, thanks! |
# |
May 5th 2021, 08:49 |
rightscoreanalysis |
got it thanks |
# |
May 5th 2021, 08:29 |
kevin.pfeifer |
and if you get inside the if you know that you created an entry and not updating one |
# |
May 5th 2021, 08:29 |
kevin.pfeifer |
correct |
# |
May 5th 2021, 08:28 |
slackebot |
<rightscoreanalysis> |
# |
May 5th 2021, 08:27 |
rightscoreanalysis |
I think this does the same as you're doing in principle: |
# |
May 5th 2021, 08:26 |
rightscoreanalysis |
I mean you can't just throw the data at Cake and it will figure whether to save or update based on what exists in the db? |
# |
May 5th 2021, 08:24 |
kevin.pfeifer |
I dont know what you mean by manual switch |
# |
May 5th 2021, 08:21 |
rightscoreanalysis |
so you are doing a manual switch |
# |
May 5th 2021, 08:17 |
slackebot |
anything with that ID `$entity = $this->MyTable->newEmptyEntity();` The rest is the default patchEntity and save procedure of CakePHP |
# |
May 5th 2021, 08:17 |
slackebot |
{ $entity = $result[0]; } elseif( sizeof( $result ) == 0 ) { $entity = $this->MyTable->newEmptyEntity(); } $entity = $this->MyTable->patchEntity( $entity, $data ); if( $this->MyTable->save( $entity ) ) { // Yay, it saved } else { // Something went wrong }``` As you can see, I first check my Database if I have any entries with `'some_id' => $some_id` If there is one, use that entity `$entity = $result[0];` If I don’t have |
# |
May 5th 2021, 08:17 |
kevin.pfeifer |
you need some sort of ID which identifies each entry in your database. Here is a part of how I sync things with an external API ```$result = $this->MyTable->find() ->where( [ 'some_id' => $some_id ] ) ->toArray(); $data = [ 'data_field1' => $data_field_1, 'data_field2' => $data_field_2, 'data_field3' => $data_field_3, ]; // Update or create depending if the entry is already in DB if( sizeof( $result ) == 1 ) |
# |
May 5th 2021, 08:10 |
rightscoreanalysis |
may I make a save I am getting Integrity constraint violation: 1062 Duplicate entry '1' for key 'type_id' |
# |
May 5th 2021, 08:04 |
rightscoreanalysis |
my data contains an indexed field but not the primary |
# |
May 5th 2021, 08:04 |
rightscoreanalysis |
I am guessing I don't have to do a find and update if records exists |
# |
May 5th 2021, 08:03 |
rightscoreanalysis |
if I am saving data to my model how can ensure records are updated and not new created |
# |
May 5th 2021, 08:02 |
rightscoreanalysis |
I created another project and fixed it - not sure what the issue was |
# |
May 5th 2021, 05:40 |
mehov |
@rightscoreanalysis what do the logs say? |
# |
May 4th 2021, 22:18 |
rightscoreanalysis |
even pages |
# |
May 4th 2021, 22:18 |
rightscoreanalysis |
what's up with a brand new cake4 install - controllers cannot be found |