# |
Jun 25th 2019, 08:54 |
ra7bi |
Hello , i've `Report` and `Users` and `UserPhotos` tables , Users belong to `Reports` and `Userphotos` belong To `Users` now i want to insert a data into all table from Users/add |
# |
Jun 25th 2019, 08:45 |
neon1024 |
Morning everyone |
# |
Jun 25th 2019, 08:00 |
madbbb |
@steinkel I got it. This happens on tests where I have more than one $this->post or $this->get method. The configuration is kept somehow in new version that is why my tests fail. |
# |
Jun 25th 2019, 08:00 |
imonsei |
i really appreciate it |
# |
Jun 25th 2019, 08:00 |
imonsei |
thanks for your help so far |
# |
Jun 25th 2019, 08:00 |
admad |
gtg |
# |
Jun 25th 2019, 07:59 |
admad |
that's where the `actions` var comes from https://github.com/cakephp/bake/blob/master/src/Shell/Task/ControllerTask.php#L144 |
# |
Jun 25th 2019, 07:57 |
imonsei |
i'm not at all home in the twig language. and i couldn't figure out where the actual strings for the variables that go into action were being pulled from |
# |
Jun 25th 2019, 07:55 |
madbbb |
@steinkel Thank you. Problem solved |
# |
Jun 25th 2019, 07:55 |
admad |
* `actions` var |
# |
Jun 25th 2019, 07:54 |
imonsei |
oh shit. i was looking a long time at that file yesterday too. |
# |
Jun 25th 2019, 07:54 |
admad |
if you want to use a separate element as you are trying then you have to modify the `action` var to include your method name. For which you will need custom task |
# |
Jun 25th 2019, 07:53 |
admad |
now you could just stick your isAuthorised in there.. |
# |
Jun 25th 2019, 07:53 |
admad |
this is the primary template for controller generation |
# |
Jun 25th 2019, 07:53 |
admad |
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Controller/controller.twig |
# |
Jun 25th 2019, 07:52 |
admad |
wishful thinking doesn't help :slightly_smiling_face: |
# |
Jun 25th 2019, 07:51 |
admad |
what makes you think it should work like that? |
# |
Jun 25th 2019, 07:51 |
imonsei |
but i placed a isauthorized.twig in "plugins\MyBakeTemplate\src\Template\Bake\Element\Controller". but when i bake a controller, the isauthorized function i defined in the twig file is not appearing in the controller |
# |
Jun 25th 2019, 07:51 |
admad |
so either way first get a custom theme working.. then if needed create a custom task |
# |
Jun 25th 2019, 07:50 |
admad |
if the contents of your `isAuthorized() {}` method are going to be "static" then all you need is a new theme |
# |
Jun 25th 2019, 07:49 |
imonsei |
well i initially thought it was just a new theme |
# |
Jun 25th 2019, 07:48 |
admad |
*is deciding |
# |
Jun 25th 2019, 07:48 |
admad |
imonsei: 1st step if deciding whether you actually need a new bake task or just a new theme |
# |
Jun 25th 2019, 07:48 |
imonsei |
i'm pretty sure i'm thinking about it in the wrong way |
# |
Jun 25th 2019, 07:47 |
imonsei |
admad, that's the exact page i'm reading through to try and understand. i'm stuck on how to get the cake bake command to list the foo example. and i feel kinda dense because i spent all day yesterday reading and testing and getting a bit frustrated |
# |
Jun 25th 2019, 07:46 |
steinkel |
@madbbb `TableRegistry::getTableLocator()->clear();` |
# |
Jun 25th 2019, 07:44 |
admad |
imonsei: you obviously didnt read the link i provided :slightly_smiling_face: |
# |
Jun 25th 2019, 07:44 |
steinkel |
*TableLocator |
# |
Jun 25th 2019, 07:44 |
steinkel |
I fixed that one before clearing the TableRegistry |
# |
Jun 25th 2019, 07:44 |
imonsei |
so i shouldn't place my files for FooTask.php and foo.twig inside my plugin folder, but in the vendor file area? |
# |
Jun 25th 2019, 07:43 |
steinkel |
the table class is being configured twice |
# |
Jun 25th 2019, 07:42 |
slackebot |
/var/www/html/vendor/phpunit/phpunit/phpunit(53): PHPUnit\TextUI\Command::main() #19 {main} ``` It is some how related to CakeDC/Users plugin. Any help on debugging is appreciated |
# |
Jun 25th 2019, 07:42 |
slackebot |
/var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(545): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult)) #16 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(195): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true) #17 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(148): PHPUnit\TextUI\Command->run(Array, true) #18 |
# |
Jun 25th 2019, 07:42 |
slackebot |
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php(698): PHPUnit\Framework\TestCase->runBare() #13 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(894): PHPUnit\Framework\TestResult->run(Object(App\Test\TestCase\Controller\ContactsControllerTest)) #14 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult)) #15 |
# |
Jun 25th 2019, 07:42 |
slackebot |
Cake\Http\Server->run(Object(Cake\Http\ServerRequest)) #6 /var/www/html/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php(517): Cake\TestSuite\MiddlewareDispatcher->execute(Array) #7 /var/www/html/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php(397): Cake\TestSuite\IntegrationTestCase->_sendRequest('/contacts/add', 'GET') #8 /var/www/html/tests/TestCase/Controller/ContactsControllerTest.php(85): |
# |
Jun 25th 2019, 07:42 |
slackebot |
Cake\TestSuite\IntegrationTestCase->get('/contacts/add') #9 [internal function]: App\Test\TestCase\Controller\ContactsControllerTest->testAdd() #10 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1071): ReflectionMethod->invokeArgs(Object(App\Test\TestCase\Controller\ContactsControllerTest), Array) #11 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(939): PHPUnit\Framework\TestCase->runTest() #12 |
# |
Jun 25th 2019, 07:42 |
slackebot |
require('/var/www/html/v...') #2 /var/www/html/vendor/cakephp/cakephp/src/Http/BaseApplication.php(161): Cake\Core\BasePlugin->bootstrap(Object(App\Application)) #3 /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php(124): Cake\Http\BaseApplication->pluginBootstrap() #4 /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php(82): Cake\Http\Server->bootstrap() #5 /var/www/html/vendor/cakephp/cakephp/src/TestSuite/MiddlewareDispatcher.php(201): |
# |
Jun 25th 2019, 07:42 |
madbbb |
my tests failed after upgrading CakePHP 3.5 to 3.7. got this cryptic error: ``` 1) App\Test\TestCase\Controller\ContactsControllerTest::testAdd Possibly related to RuntimeException: "You cannot configure "Users", it has already been constructed." #0 /var/www/html/vendor/cakedc/users/config/bootstrap.php(25): Cake\ORM\Locator\TableLocator->setConfig('Users', Array) #1 /var/www/html/vendor/cakephp/cakephp/src/Core/BasePlugin.php(239): |
# |
Jun 25th 2019, 07:42 |
imonsei |
ooh |
# |
Jun 25th 2019, 07:42 |
admad |
creating a new command and creating a new theme are 2 different things |
# |
Jun 25th 2019, 07:41 |
admad |
imonsei: https://book.cakephp.org/bake/1.x/en/development.html#creating-a-bake-theme |