# |
Feb 7th 2018, 19:00 |
diego182 |
maybe you could change the collor? i know you can change the color but never messed with it |
# |
Feb 7th 2018, 18:59 |
spencdev |
But holdling ctrl usually does the trick |
# |
Feb 7th 2018, 18:59 |
spencdev |
Yeah, it’s always hard to tell with PhpStorm. I have difficulty telling apart the blue from the purple |
# |
Feb 7th 2018, 18:58 |
diego182 |
its a good idea to use a IDE with Intelligent code completion, it helps preventing this kind of errors |
# |
Feb 7th 2018, 18:57 |
spencdev |
I’ve found that every time I get that error, I’ve made a typo in one of the function names... Worked for me so far. |
# |
Feb 7th 2018, 18:56 |
diego182 |
that happens, sometimes right after ask something i figure out what was wrong lol |
# |
Feb 7th 2018, 18:54 |
davinci |
ofc that was it |
# |
Feb 7th 2018, 18:54 |
davinci |
@diego182 man it's a rough day. :slightly_smiling_face: Thanks again. |
# |
Feb 7th 2018, 18:53 |
diego182 |
@davinci |
# |
Feb 7th 2018, 18:52 |
diego182 |
$this->_table |
# |
Feb 7th 2018, 18:52 |
diego182 |
did put the underline before table? |
# |
Feb 7th 2018, 18:47 |
davinci |
@diego182 well... maybe not. Now I'm getting `Call to a member function associations() on null` in error log and `Undefined property: App\Model\Behavior\MyBehavior::$table in ...` in the debug log |
# |
Feb 7th 2018, 18:43 |
diego182 |
awesome! |
# |
Feb 7th 2018, 18:38 |
davinci |
@diego182 well that was simple enough. Thanks! |
# |
Feb 7th 2018, 18:37 |
diego182 |
$this->_table @davinci |
# |
Feb 7th 2018, 18:35 |
davinci |
any idea how I access ->associations() within a behavior? |
# |
Feb 7th 2018, 18:03 |
dereuromark |
we probably need better defaults here, shouldnt happen that quick :slightly_smiling_face: |
# |
Feb 7th 2018, 18:00 |
saeideng |
This could be happening because the VPS runs out of memory and has no Swap space enabled. |
# |
Feb 7th 2018, 18:00 |
saeideng |
https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors |
# |
Feb 7th 2018, 17:52 |
dereuromark |
Did you guys get this in cakebox? ``` The following exception is caused by a lack of memory or swap, or not having swap configured Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details [ErrorException] proc_open(): fork failed - Cannot allocate memory ``` |
# |
Feb 7th 2018, 17:49 |
ank068 |
Oh wait i stupid |
# |
Feb 7th 2018, 17:42 |
ank068 |
File uploaded https://cakesf.slack.com/files/U91GR08DV/F95HVB2CV/the_code.txt / https://slack-files.com/T053DPNCM-F95HVB2CV-9c2ba6b741 - So this is the code i have nothing else after that |
# |
Feb 7th 2018, 17:40 |
ank068 |
I am building the function and that is literally the last sentence. But just to be clear no i am not echoing it |
# |
Feb 7th 2018, 17:38 |
diego182 |
areyou trying to echo this? @ank068 |
# |
Feb 7th 2018, 17:36 |
ank068 |
Would it be because of one the fields? |
# |
Feb 7th 2018, 17:35 |
ank068 |
Any reason why i am getting this error "Object of class App\Model\Table\AdminsTable could not be converted to string" on a simple "$this->$admin_table->find('all');"? |
# |
Feb 7th 2018, 17:04 |
diego182 |
the problem is that this data comer from a foreign source, so i cannot guarantee that i have an unique key |
# |
Feb 7th 2018, 17:03 |
neon1024 |
Take a quick look in the EntityTrait to ensure there isn’t a neater way to enumerate it’s properties |
# |
Feb 7th 2018, 17:02 |
diego182 |
humm gonna try something like this |
# |
Feb 7th 2018, 16:58 |
neon1024 |
Or something similar. At least that would be my first attempt approach |
# |
Feb 7th 2018, 16:58 |
neon1024 |
Then you could just use `new MyEntity(array_merge($oldEntity->toArray(), $arrayOfNewThings))` |
# |
Feb 7th 2018, 16:58 |
neon1024 |
If you want to kind of patch it, hmm, I’d think about trying `array_merge`, but you might need to implement a `toArray()` method in the entity, unless it implements the `ArrayAccess` interface |
# |
Feb 7th 2018, 16:57 |
neon1024 |
So you could just assign the new data to it directly, without any issue. `$entity->set('diego182', true);` |
# |
Feb 7th 2018, 16:56 |
neon1024 |
Well an entity is a standard PHP class |
# |
Feb 7th 2018, 16:46 |
diego182 |
Hello, when i have a update... when i patch entity i have to set the ID(PK) of the entity. Now lets assume that i have an array with data to update that entity This array has an combination of values on where i can decide weather its a new entity or update Is there an way to patch an entity without this ID? |
# |
Feb 7th 2018, 16:43 |
neon1024 |
If you want to check, have a look at the Session tab in DebugKit |
# |
Feb 7th 2018, 16:43 |
ank068 |
Okay cool thanks :slightly_smiling_face: |
# |
Feb 7th 2018, 16:43 |
neon1024 |
Yup |
# |
Feb 7th 2018, 16:43 |
ank068 |
So even write and read are access through that? |
# |
Feb 7th 2018, 16:41 |
diego182 |
sessions are on the request and response objects |
# |
Feb 7th 2018, 16:41 |
neon1024 |
@ank068 No you don’t, as the Session is part of the request. `$this->request->getSession()` |