Log message #4180223

# At Username Text
# 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?
# Mar 19th 2019, 18:28 ricksaccous oh okay
# Mar 19th 2019, 18:28 jnguyen and yeah I did use migrations to create the table
# Mar 19th 2019, 18:28 jnguyen my mistake it was HealthRecordsTable.php
# Mar 19th 2019, 18:22 ricksaccous @jnguyen also maybe use migrations in this project, after you get more of a hang of things
# Mar 19th 2019, 18:21 ricksaccous based on conventions
# Mar 19th 2019, 18:21 ricksaccous so HealthRecordsTable.php is what the table class should be called
# Mar 19th 2019, 18:20 ricksaccous it's always Table.php
# Mar 19th 2019, 18:20 ricksaccous baked that*
# Mar 19th 2019, 18:20 ricksaccous it should not have backed that
# Mar 19th 2019, 18:20 ricksaccous not Tables.php
# Mar 19th 2019, 18:20 ricksaccous HealthRecordsTable.php
# Mar 19th 2019, 18:20 ricksaccous it should have been called
# Mar 19th 2019, 18:15 jnguyen not sure pasting the code would help because the baking seems to be all correct
# Mar 19th 2019, 18:14 jnguyen ```SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sparkplug.health_record' doesn't exist```
# Mar 19th 2019, 18:14 jnguyen so my exact problem is I made a table called health_records, baked the model and it produced an entity called HealthRecord.php and the table HealthRecordsTables.php. Tried to save data to it and it threw me this error
# Mar 19th 2019, 18:11 ricksaccous ie it's not finding my MagicRunes table
# Mar 19th 2019, 18:11 ricksaccous and stated exactly what the problem was
# Mar 19th 2019, 18:10 ricksaccous prob would be easier if you pasted the code in a gist or something
# Mar 19th 2019, 18:10 jnguyen ah figured