Log message #4115381

# At Username Text
# 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()`
# Feb 7th 2018, 16:41 ank068 Do i need to add a "use" statement in controllers to work with sessions?
# Feb 7th 2018, 16:40 neon1024 Man, I still don’t like that `->get()` throws a fatal when stuff isn’t there.
# Feb 7th 2018, 16:25 slackebot !xy
# Feb 7th 2018, 16:25 slackebot Command sent from Slack by neon1024:
# Feb 7th 2018, 16:24 neon1024 It seems an unnecessary thing to want to do
# Feb 7th 2018, 16:24 neon1024 Or should I say why do you need Capitalised entity properties?
# Feb 7th 2018, 16:24 neon1024 What are you trying to achieve?
# Feb 7th 2018, 15:54 devito however virtual properties do the inverse of what I am looking for it seems.
# Feb 7th 2018, 15:52 devito atm im trying to achieve this by setting virtual properties
# Feb 7th 2018, 15:51 devito Right, Im looking to Inflect::classify after I retrieve my records
# Feb 7th 2018, 15:49 neon1024 @devito This is the job of the Inflector class, see https://inflector.cakephp.org/
# Feb 7th 2018, 15:46 devito Hello All. is there a way to Inflect entity property names as class names after find? I looked into map / reduce but I dont think it is nessessarly suited for this situation example I want to make $entity->name become $entity->Name I am setting virtual names but was wondering if theres a better way.
# Feb 7th 2018, 15:35 popperz0r right?
# Feb 7th 2018, 15:35 popperz0r ```use Cake\Event\EventManager; EventManager::instance()->on( new App\Event\UserNotification() ); ```
# Feb 7th 2018, 15:35 popperz0r bootstrap.php