# |
Jul 19th 2018, 15:52 |
cluelessguru |
Is anyone here able to assist me in troubleshooting a cakephp setup? I'm starting out and I'm not sure where to look to start solving issues. |
# |
Jul 19th 2018, 15:43 |
flavius |
disable all extensions and see if it changes |
# |
Jul 19th 2018, 15:42 |
graziel |
no switch here also but im using theme |
# |
Jul 19th 2018, 15:42 |
flavius |
@birdy247 lol, no switch here :slightly_smiling_face: |
# |
Jul 19th 2018, 15:33 |
Diego_ |
I think Auth load the model before initialize() and make the behavior dont work as expected |
# |
Jul 19th 2018, 15:32 |
Diego_ |
is there any way to use Footprint plugin in UsersTable with Auth component? |
# |
Jul 19th 2018, 15:29 |
birdy247 |
File uploaded https://cakesf.slack.com/files/U0T295QA3/FBSQLBKS4/image.png / https://slack-files.com/T053DPNCM-FBSQLBKS4-d26670f237 |
# |
Jul 19th 2018, 15:26 |
birdy247 |
I got a weird "switch" in the top left when opening a new tab |
# |
Jul 19th 2018, 15:26 |
birdy247 |
Is anyone using chrome on here? |
# |
Jul 19th 2018, 15:14 |
dereuromark |
how should it know the type of entity? so at least doc block needs fixing ( https://github.com/dereuromark/cakephp-ide-helper/issues/86 ) |
# |
Jul 19th 2018, 15:14 |
josbeir |
and if you don't go too high in lvl :) |
# |
Jul 19th 2018, 15:14 |
dereuromark |
no, it does not work fine :slightly_smiling_face: |
# |
Jul 19th 2018, 15:13 |
josbeir |
if you include @property stuff that is :P |
# |
Jul 19th 2018, 15:13 |
josbeir |
nah works fine? |
# |
Jul 19th 2018, 15:12 |
neon1024 |
PHP Stan hates CakePHP anyway |
# |
Jul 19th 2018, 15:11 |
dereuromark |
`public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options)` at least the doc block then must be the concrete class `@param \App\Model\Entity\Post $entity The entity that is going to be saved` Otherwise PHPStan and IDE cant work with it inside the callbacks |
# |
Jul 19th 2018, 15:10 |
dereuromark |
Our generated callbacks in e.g. tables are not correct btw |
# |
Jul 19th 2018, 15:07 |
itmpls |
that's why i was going to convert it to an array etc but no need |
# |
Jul 19th 2018, 15:07 |
itmpls |
right |
# |
Jul 19th 2018, 15:07 |
neon1024 |
`patchEntity()` will expect arrays, not EntityInterface instances |
# |
Jul 19th 2018, 15:07 |
itmpls |
cool |
# |
Jul 19th 2018, 15:07 |
neon1024 |
I would, yes. |
# |
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 |