# |
Jul 19th 2018, 15:06 |
neon1024 |
If you use `$entity->set()` then it will not be ;) |
# |
Jul 19th 2018, 15:06 |
itmpls |
it's already the instance. so do it after patch? |
# |
Jul 19th 2018, 15:06 |
neon1024 |
If it’s been built from request data, then it’s validated too, as `newEntity()` will validate the array passed into it |
# |
Jul 19th 2018, 15:06 |
itmpls |
yeh |
# |
Jul 19th 2018, 15:06 |
neon1024 |
If `$companyEntity` is already an instance of `App\Model\Entity\Company` then it’s already okay |
# |
Jul 19th 2018, 15:05 |
itmpls |
and thus validated.. |
# |
Jul 19th 2018, 15:05 |
neon1024 |
Perhaps somethign like that, but better ;) |
# |
Jul 19th 2018, 15:05 |
itmpls |
but i should probably merge it so it can be patched properly |
# |
Jul 19th 2018, 15:05 |
neon1024 |
`$post->set('authors', array_merge($post->authors, [new Author(['name' => 'medes',])]))` |
# |
Jul 19th 2018, 15:04 |
itmpls |
currently I'm doing something like $user = $this->Users->patchEntity($userEntity, $this->getRequest()->getData()); etc and then $user->companies[0] = $companyEntity; for example |
# |
Jul 19th 2018, 15:04 |
neon1024 |
..then just set that to the parent entity |
# |
Jul 19th 2018, 15:04 |
neon1024 |
Which means you could create a new entity instance of the association, which will get your request data validation |
# |
Jul 19th 2018, 15:03 |
neon1024 |
Well if you’re adding a new BelongsToMany, then you’re probably going to write an entity into another entities associated property |
# |
Jul 19th 2018, 15:01 |
itmpls |
dynamically -> not through the origin html form |
# |
Jul 19th 2018, 15:01 |
itmpls |
i figure since it'd be wise to validate and what not, versus afterwards even if you *think* it'll be right |
# |
Jul 19th 2018, 15:00 |
itmpls |
if i want to dynamically add in a belongsToMany to a record to save, where's the proper place to do it? before patchEntity, which means merging it with the get request data array? |
# |
Jul 19th 2018, 14:59 |
james.phillips |
its ok ive fixed it...need to send data in this format { "data": { "type": "countries", "id": "10", "attributes": { "name": "My new name" } } } |
# |
Jul 19th 2018, 14:51 |
james.phillips |
anyone know about patching data to json-api? |
# |
Jul 19th 2018, 14:11 |
flavius |
i think that when you test a single file, the structure for that file is ignored |
# |
Jul 19th 2018, 14:10 |
flavius |
File uploaded https://cakesf.slack.com/files/U75U0UMR9/FBUPMAAF8/image.png / https://slack-files.com/T053DPNCM-FBUPMAAF8-8d9923d3b6 - <@U052SF4V6> the coverage directory looks like this for me, it doesn't have `/src/Controller/IndexController.php.html` it's in the root of `/coverage` |
# |
Jul 19th 2018, 14:09 |
graziel |
schrodinger topic |
# |
Jul 19th 2018, 14:04 |
flavius |
sometimes it's at 0 |
# |
Jul 19th 2018, 14:04 |
flavius |
sometimes it has 1 upvote |
# |
Jul 19th 2018, 14:01 |
dereuromark |
transparency |
# |
Jul 19th 2018, 14:01 |
itmpls |
@dereuromark for?? |
# |
Jul 19th 2018, 14:01 |
dereuromark |
yeah it is a good idea actually |
# |
Jul 19th 2018, 14:00 |
graziel |
quite silly that reddit doesnt show who voted how, it would show whos laravel lover |
# |
Jul 19th 2018, 14:00 |
dereuromark |
need my own russian botnet army :P |
# |
Jul 19th 2018, 14:00 |
dereuromark |
:slightly_smiling_face: hating needs no comment |
# |
Jul 19th 2018, 14:00 |
graziel |
yeah and still no comments |
# |
Jul 19th 2018, 13:59 |
dereuromark |
hehe, got already downvoted quite a bit on reddit :slightly_smiling_face: as expected |
# |
Jul 19th 2018, 13:48 |
itmpls |
yup |
# |
Jul 19th 2018, 13:32 |
abdualelah.mdy |
ok thanks @neon1024 @itmpls |
# |
Jul 19th 2018, 13:31 |
itmpls |
key should be 'username', not 'team_id' ? |
# |
Jul 19th 2018, 13:28 |
abdualelah.mdy |
:thinking_face: |
# |
Jul 19th 2018, 13:28 |
abdualelah.mdy |
i am sorry but i cant see the error |
# |
Jul 19th 2018, 13:26 |
neon1024 |
https://book.cakephp.org/3.0/en/controllers/components/authentication.html#configuring-authentication-handlers |
# |
Jul 19th 2018, 13:26 |
neon1024 |
The error is on line 11 |
# |
Jul 19th 2018, 13:25 |
abdualelah.mdy |
File uploaded https://cakesf.slack.com/files/UBSRFQFLP/FBTD6JM2N/-.php / https://slack-files.com/T053DPNCM-FBTD6JM2N-3c90fc7db8 |
# |
Jul 19th 2018, 13:25 |
neon1024 |
Or read the component source code, which has handy docblocks |
# |
Jul 19th 2018, 13:25 |
neon1024 |
Time to check the book then I’d say ;) |