# |
Mar 19th 2019, 20:28 |
challgren |
https://book.cakephp.org/3.0/en/migrations.html#using-migrations-in-plugins |
# |
Mar 19th 2019, 20:28 |
challgren |
https://book.cakephp.org/3.0/en/migrations.html |
# |
Mar 19th 2019, 20:27 |
joopm |
how do you mean Migrations? I thought migrations is about conversion from cakephp 2 to cakephp 3 for example |
# |
Mar 19th 2019, 20:26 |
joopm |
hello |
# |
Mar 19th 2019, 20:25 |
challgren |
Migrations |
# |
Mar 19th 2019, 20:07 |
joopm |
and interested in how to pack db files for installing the plugin later |
# |
Mar 19th 2019, 20:07 |
joopm |
i made my first plugin |
# |
Mar 19th 2019, 20:07 |
joopm |
hello |
# |
Mar 19th 2019, 19:41 |
ricksaccous |
actually i didn't, rawrrrrr |
# |
Mar 19th 2019, 19:26 |
ricksaccous |
got it working, was simpler than that |
# |
Mar 19th 2019, 19:26 |
ricksaccous |
nevermind |
# |
Mar 19th 2019, 19:05 |
ricksaccous |
in a hasOne |
# |
Mar 19th 2019, 19:05 |
ricksaccous |
i would have just used sortConditions but they seem to be ignored |
# |
Mar 19th 2019, 19:00 |
ricksaccous |
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /vagrant/nflf/httpdocs/vendor/cakephp/cakephp/src/Database/Query.php on line 352 |
# |
Mar 19th 2019, 18:59 |
ricksaccous |
when I'm trying to set up a hasOne relationship of the most recent record of a hasMany I'm getting exceeded memory limits |
# |
Mar 19th 2019, 18:34 |
ricksaccous |
no problem |
# |
Mar 19th 2019, 18:33 |
jnguyen |
thanks @ricksaccous |
# |
Mar 19th 2019, 18:33 |
jnguyen |
its just i had to make it plural on the calls too |
# |
Mar 19th 2019, 18:33 |
jnguyen |
ahhh okay that was it |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
that will help you i think |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
you can think of entities as just bags of data |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
and you use the table class to create and patch new entities |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
can be kind of confusing |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
loadModel() corresponds to the table class not to the entity |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
yeah |
# |
Mar 19th 2019, 18:31 |
ricksaccous |
you just need to add an s in your controller |
# |
Mar 19th 2019, 18:31 |
jnguyen |
ah okk |
# |
Mar 19th 2019, 18:30 |
ricksaccous |
etc etc |
# |
Mar 19th 2019, 18:30 |
ricksaccous |
$healthRecord = $this->HealthRecords->newEntity(); |
# |
Mar 19th 2019, 18:30 |
ricksaccous |
$this->loadModel('HealthRecords); |
# |
Mar 19th 2019, 18:30 |
jnguyen |
its being called within another controller |
# |
Mar 19th 2019, 18:30 |
ricksaccous |
you are calling it wrong |
# |
Mar 19th 2019, 18:30 |
slackebot2 |
dd($HealthRecord); //$this->HealthRecord->save($healthRecord); }``` |
# |
Mar 19th 2019, 18:30 |
jnguyen |
```public function test() { $this->loadModel('HealthRecord'); $HealthRecord =$this->HealthRecord->newEntity(); $data = [ 'user_id' => $this->Auth->user('id'), 'type' => 'test', 'entry' => ['test' => '1'], 'meta' => json_encode(['test' => '1']), ]; $HealthRecord = $this->HealthRecord->patchEntity($HealthRecord,$data); |
# |
Mar 19th 2019, 18:30 |
jnguyen |
it isnt |
# |
Mar 19th 2019, 18:29 |
ricksaccous |
this code isn't in a plugin is it? |
# |
Mar 19th 2019, 18:29 |
jnguyen |
ah |
# |
Mar 19th 2019, 18:29 |
ricksaccous |
in the controller |
# |
Mar 19th 2019, 18:29 |
ricksaccous |
i mean |
# |
Mar 19th 2019, 18:29 |
jnguyen |
health_records |
# |
Mar 19th 2019, 18:29 |
ricksaccous |
so how are you calling the table? |