# |
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? |
# |
Jan 24th 2020, 21:43 |
wnasich |
@challgren thanks! |
# |
Jan 24th 2020, 21:42 |
challgren |
https://github.com/burzum/cakephp-service-layer might be useful to you @wnasich you might need to update it for cake4 |
# |
Jan 24th 2020, 21:42 |
wnasich |
ops, thanks! |
# |
Jan 24th 2020, 21:32 |
kiwi_74 |
@wnasich Thanks. That's what I was looking for :) |
# |
Jan 24th 2020, 21:30 |
wnasich |
Hello, with CakePHP 4 , is there a easy way to implement a service layer ? |
# |
Jan 24th 2020, 21:30 |
wnasich |
now you have the shell command `cake bake` |
# |
Jan 24th 2020, 21:28 |
wnasich |
maybe that was the 'scaffolding' feature on previous releases |
# |
Jan 24th 2020, 21:16 |
kiwi_74 |
Hello Everyone. I seem to remember cake being able to create default views which showed the rows of a table, but I can't find any info on it. Is there such a thing, or am I just imagining it, lol? |
# |
Jan 24th 2020, 19:51 |
challgren |
Also close https://github.com/UseMuffin/Sti/issues/8 since you figured it out |
# |
Jan 24th 2020, 19:49 |
challgren |
You can do a PR |
# |
Jan 24th 2020, 19:37 |
luizcmarin |
@challgren I find other differences between what is on the website and cake 4. How can I report this? Should I report? for example, on the website it says "$ this-> table ('sti_cooks');" but in cake4 it should be "$ this-> setTable ('sti_cooks');", do you agree? There is no way to suggest the changes I encounter. |
# |
Jan 24th 2020, 19:27 |
luizcmarin |
@challgren Everything is OK. Let's work ..... thanks |
# |
Jan 24th 2020, 19:25 |
luizcmarin |
:hugging_face: |
# |
Jan 24th 2020, 19:25 |
slackebot |
<luizcmarin> |