Log message #4264652

# At Username Text
# Jun 2nd 2021, 09:42 k4t thank you
# Jun 2nd 2021, 09:42 k4t understand
# Jun 2nd 2021, 09:40 philo.hamel and the theme is part of the view
# Jun 2nd 2021, 09:39 philo.hamel that's the purpose of the helper: it's view context aware
# Jun 2nd 2021, 09:37 k4t no... Assets class, with helpr this is ok...
# Jun 2nd 2021, 09:36 philo.hamel using the helper?
# Jun 2nd 2021, 09:36 k4t the same problem when it is also used directly in the view
# Jun 2nd 2021, 09:34 philo.hamel unless there's a good reason to keep the view code in the entity, I'd try to move it into the view
# Jun 2nd 2021, 09:30 k4t and in the view.php it is called in that way: <?= $article->imageUrlForSharing; ?>
# Jun 2nd 2021, 09:30 k4t ``` protected function _getImageUrl() { return Asset::imageUrl('sharing-fallback.png', ['fullBase' => true, 'plugin' => true]); }```
# Jun 2nd 2021, 09:29 k4t to be honest inside of entity
# Jun 2nd 2021, 09:27 philo.hamel inside a template? https://api.cakephp.org/4.0/class-Cake.View.Helper.UrlHelper.html#image()
# Jun 2nd 2021, 09:23 k4t I even tried tto add plugin = true to the options but it did not solve the problem
# Jun 2nd 2021, 09:21 k4t In latest CakePHP I am using: https://api.cakephp.org/4.0/class-Cake.Routing.Asset.html#imageUrl() but it look like that function does not take active theme into account so all urls generated by it does not contain active theme prefix. Is this bug or I missed something?
# Jun 2nd 2021, 07:19 kgb.acct.personal Good day. Is it possible for the bake migration snapshot command to include the index names?
# Jun 2nd 2021, 06:16 thomas465 yeah, that’s what i’m thinking too, as a stopgap at least, but i’m just wondering if this is something that should be fixed either in the ORM or in `TimeStampBehavior` ?
# Jun 2nd 2021, 02:35 khalil Solved it :)
# Jun 2nd 2021, 02:17 slackebot the relationship to hasMany, and I change the form field to array (shops.0.name) the company saves properly, is this a bug or am I missing something?
# Jun 2nd 2021, 02:17 slackebot belongsTo users and users belongsTo company. Everything is set properly and following the documentation and the conventions, but when I try to save, only the user is getting saved, the shop is not even appearing in the request, unless I change the form field name from for example shop.name to shops.name - even though in the documentation it's clearly stated that in the case of belongsTo you should use singular not plural. If I change
# Jun 2nd 2021, 02:17 khalil Not sure if it's a bug or something I'm doing wrong In my DB schema, I have "Users" and "Shops", the users table has a shop_id field, and the shops table has a user_id (doing this to make querying easier in some complicated cases I have) The issue is happening when trying to add a new user, when a new user is getting added, I want to also create a record in the companies table. The relationships are belongsTo, companies
# Jun 2nd 2021, 02:12 khalil Hey guys
# Jun 1st 2021, 21:35 corey.taylor.fl test
# Jun 1st 2021, 21:30 greg138 Would your encoded JSON not have something more like `"first_name":"John"` in it anyway?
# Jun 1st 2021, 21:19 tyler.adam.lazenby Thank you for that solution
# Jun 1st 2021, 21:17 tyler.adam.lazenby That is really very helpful thank you
# Jun 1st 2021, 21:17 tyler.adam.lazenby very interesting
# Jun 1st 2021, 21:16 thomas465 ```$responseData = json_decode((string)$this->_response->getBody(), true)```
# Jun 1st 2021, 21:15 kevin.pfeifer and assert that with some json you expect
# Jun 1st 2021, 21:15 kevin.pfeifer after the `$this->post`
# Jun 1st 2021, 21:15 kevin.pfeifer try ```$response = $this->_response->getBody()->__toString();```
# Jun 1st 2021, 21:14 tyler.adam.lazenby but the third assertion fails even though the fixture is set to have the first name as John
# Jun 1st 2021, 21:13 tyler.adam.lazenby this is my test right now
# Jun 1st 2021, 21:13 tyler.adam.lazenby ```public function testAddToExisting(): void { $data = ['account_id' => 1]; $this->enableCsrfToken(); $this->post('/accounts/add-to-existing/1', $data); $this->assertResponseOk(); $this->assertResponseNotEmpty(); $this->assertResponseContains('first_name: John'); }```
# Jun 1st 2021, 21:13 tyler.adam.lazenby Let me make my question more specific. If I expect to json_encode a user entity with a first_name property valued as "john", how would I unit test that?
# Jun 1st 2021, 21:09 greg138 I've done that. This is what `removeBehavior` is for. :)
# Jun 1st 2021, 21:08 kevin.pfeifer sorry, haven’t dealt with that till now. Can’t answer that right now ,:)
# Jun 1st 2021, 21:06 thomas465 tags is linked to products with a `through` class, that class is also defined. again, everything works, but i’d like it not update the modified field :)
# Jun 1st 2021, 21:04 thomas465 but tag_id = 10 will also have it’s modified date updated (TimeStampBehavoir)
# Jun 1st 2021, 21:03 thomas465 and its creating a tag_id = 10, product_id = 99 in the link table along with the comment (and other cols for the join table)
# Jun 1st 2021, 21:03 tyler.adam.lazenby On unit tests, I want to test to see if the response contains a new account id, since I return it in application/json form. How can I do that?
# Jun 1st 2021, 21:02 thomas465 well, here the tag id is 10