# |
Jan 25th 2020, 21:47 |
challgren |
@luizcmarin from my understanding you want to have 1 table with 3 different “types” stored? Those types are then converted by the ORM into Entities that are different? Is that correct? |
# |
Jan 25th 2020, 21:32 |
luizcmarin |
STI.... |
# |
Jan 25th 2020, 21:05 |
latenal |
Hi! I am trying to integrate a JWT authentication using the `Authentication` plugin. I read the docs and I don’t quite understand how it works. ``` public function login() { $this->request->allowMethod(['get', 'post']); $result = $this->Authentication->getResult(); if (!$result->isValid()) { throw new ForbiddenException(__('The username and password don\'t match.')); } }``` |
# |
Jan 25th 2020, 20:17 |
luizcmarin |
@challgren Excuse me. I started the STI all over again. It is impossible to continue alone without overloading the support. Difficult to implement with readme.md and does not explain how to continue. I tried every dumb way I know. I will think of alternatives. |
# |
Jan 25th 2020, 12:30 |
alexdd55976 |
its cake 3.6 |
# |
Jan 25th 2020, 12:29 |
alexdd55976 |
`NOT IN`?? |
# |
Jan 25th 2020, 12:29 |
alexdd55976 |
am i wrong with the statement? |
# |
Jan 25th 2020, 12:29 |
alexdd55976 |
there are tracking_ids in the variable. |
# |
Jan 25th 2020, 12:27 |
alexdd55976 |
but get this `Impossible to generate condition with empty list of values for field (tracking_id)`v |
# |
Jan 25th 2020, 12:27 |
alexdd55976 |
trying to do this ```$Times->deleteAll([ 'Times.model_id' => 7, 'Times.model_primary_key' => $entity->id, 'Times.tracking_id NOT IN' => $tracking_ids ]);``` |
# |
Jan 25th 2020, 12:27 |
alexdd55976 |
hey fellows |
# |
Jan 25th 2020, 10:24 |
challgren |
@luizcmarin we updated the README.md to include setTable instead of table. Also you may want to be looking at https://github.com/UseMuffin/Sti/tree/cake-4.x as thats more specific to Cake 4 and the master branch is for 3.6+ |
# |
Jan 25th 2020, 00:27 |
luizcmarin |
very complex, I am confused and tired. Tomorrow I try to start again. The plugin is good, congratulations to those who did it. But my knowledge and ability to understand are greatly reduced. Thanks for the help @challgren. Willing people like you and some of the support is what dignifies the "kitchen of the cake". Good evening. |
# |
Jan 24th 2020, 23:44 |
luizcmarin |
examinando |
# |
Jan 24th 2020, 23:43 |
challgren |
The tests show you how to use it in a more technical sense and what to expect |
# |
Jan 24th 2020, 23:39 |
luizcmarin |
mamma mia.... moment, muuuch moments :tired_face: |
# |
Jan 24th 2020, 23:33 |
challgren |
https://github.com/UseMuffin/Sti/blob/master/tests/TestCase/Model/Behavior/StiBehaviorTest.php#L36 |
# |
Jan 24th 2020, 23:33 |
challgren |
https://github.com/UseMuffin/Sti/blob/master/tests/test_app/Model/Table/CooksTable.php |
# |
Jan 24th 2020, 23:32 |
challgren |
https://github.com/UseMuffin/Sti/blob/master/tests/TestCase/Model/Behavior/StiBehaviorTest.php#L46 |
# |
Jan 24th 2020, 23:30 |
challgren |
Yes, you just need to use the sti_caixas table to do your queries. The find/get will return the corrected entity type |
# |
Jan 24th 2020, 23:29 |
luizcmarin |
but can i create a menu for each type? and the screens too? |
# |
Jan 24th 2020, 23:28 |
challgren |
You wont have tables called caixa, caixapagar, and caixareceber. Those are entities. The sti_caixas table is what holds your data |
# |
Jan 24th 2020, 23:27 |
luizcmarin |
now i'm really confused. Give me time to understand your concept and test it out. |
# |
Jan 24th 2020, 23:24 |
challgren |
and add conditions => [‘type’ => ‘caixa’] to your paginate |
# |
Jan 24th 2020, 23:23 |
challgren |
Yes so you need to change your $modelClass in your controller to be StiCaixas |
# |
Jan 24th 2020, 23:23 |
slackebot |
'caixa' _=>_ 'App\Model\Entity\Caixa', 'caixapagar' _=>_ 'App\Model\Entity\CaixaPagar', 'caixareceber' _=>_ 'App\Model\Entity\CaixaReceber', ] ]); _$this->setEntityClass_('App\Model\Entity\Caixa'); _// default_ |
# |
Jan 24th 2020, 23:23 |
luizcmarin |
it's in StiCaixasTable: _public_ _function_ _initialize_(_array_ _$config_)_:_ _void_ { _parent::initialize_(_$config_); _$this->setTable_('sti_caixas'); _$this->setDisplayField_('id'); _$this->setPrimaryKey_('id'); _// sti_ _$this->addBehavior_('Muffin/Sti.Sti', [ 'typeMap' _=>_ [ |
# |
Jan 24th 2020, 23:22 |
challgren |
You need to use the StiTable you attached the behavior to |
# |
Jan 24th 2020, 23:21 |
luizcmarin |
_public_ _function_ _index_() { _$this->paginate_ _=_ [ 'contain' _=>_ ['Pessoas', 'PlanoContas', 'Pedidos'], ]; _$Caixas_ _=_ _$this->paginate_(_$this->Caixas_); _$this->set_(compact('Caixas')); } |
# |
Jan 24th 2020, 23:21 |
luizcmarin |
I created CaixasController. |
# |
Jan 24th 2020, 23:20 |
challgren |
Ok so your reading data, whats that call to read the data? |
# |
Jan 24th 2020, 23:16 |
luizcmarin |
when I try to access http: // localhost: 8765 / caixas |
# |
Jan 24th 2020, 23:15 |
challgren |
What is causing the error are you trying to save, trying to read? |
# |
Jan 24th 2020, 23:14 |
slackebot |
" Shouldn't he go to sti_caixas? |
# |
Jan 24th 2020, 23:14 |
slackebot |
------> THIS TABLE IS NOT REAL 'caixareceber' => 'App\Model\Entity\CaixaReceber', ------> THIS TABLE IS NOT REAL ] ]); $this->setEntityClass('App\Model\Entity\Caixa'); // default I created the entities box, box, box and box. I created the add, edit, view, index screens. However, I get the following error: " SQLSTATE [42S02]: Base table or view not found: 1146 Table 'ola_ney.caixas' doesn't exist |
# |
Jan 24th 2020, 23:14 |
luizcmarin |
excuse me. I was writing the situation. $this->setTable('sti_caixas'); ------> THIS TABLE IS REAL $this->setDisplayField('id'); $this->setPrimaryKey('id'); // sti $this->addBehavior('Muffin/Sti.Sti', [ 'typeMap' => [ 'caixa' => 'App\Model\Entity\Caixa', ------> THIS TABLE IS NOT REAL 'caixapagar' => 'App\Model\Entity\CaixaPagar', |
# |
Jan 24th 2020, 23:12 |
challgren |
@luizcmarin please stop saying it has errors and not including what the error thats not very conductive to figuring out your issue. |
# |
Jan 24th 2020, 23:11 |
slackebot |
loaded via $this->addPlugin(), you may need to update bin/cake.php to match https://github.com/cakephp/app/tree/master/bin/cake.php In [/home/vagrant/code/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php, line 332]``` The migrations seems to be created successfully but marking it as done generates an error. |
# |
Jan 24th 2020, 23:11 |
cakephp-slack |
I’m having an issue with migrations in a fresh CakePHP 4 install: ```$ bin/cake bake migration_snapshot Initial Creating file /home/vagrant/code/config/Migrations/20200124230841_Initial.php Wrote `/home/vagrant/code/config/Migrations/20200124230841_Initial.php` Marking the migration 20200124230841_Initial as migrated... Exception: Shell class for "Migrations" could not be found. If you are trying to use a plugin shell, that was |
# |
Jan 24th 2020, 22:58 |
luizcmarin |
I followed all the guidelines of the STI. At least, I believe so. But I have doubts because of some errors |
# |
Jan 24th 2020, 22:56 |
luizcmarin |
@challgren disponible? |