# |
Feb 25th 2018, 20:10 |
Sigfried84 |
how? |
# |
Feb 25th 2018, 20:10 |
savant |
can you show the exact schema for your tables? |
# |
Feb 25th 2018, 20:08 |
Sigfried84 |
authority_id). I think this is the best design, is it? CakePHP baked that without problem. The problem I have now is that on the Template/Books/add.ctp I can only see author_id and author_type_id. And I have been a couple of days struggling to see author.name and author_type.name. Is that a matter of the find method? virutalfields? I am completely lost :) |
# |
Feb 25th 2018, 20:08 |
Sigfried84 |
i am make a DB on books. 1 book can have many authors. 1 author can be many types of author. For example, Book 1 is written by Tom and drawn by Jane. Book 2 is written and drawn by Jane and translated by Tom. So I have: books, authors, author_types. I did this: authors table (id, name) - author_types table (id, name) - authorities table (id, author_id, author_type_id) - authorities_books table (id, book_id, |
# |
Feb 25th 2018, 19:59 |
savant |
but you’d be treating the authors as a pivot table in a sense |
# |
Feb 25th 2018, 19:59 |
savant |
You _can_ use `hasMany through`, as mentioned in the docs here: https://book.cakephp.org/3.0/en/orm/associations.html#using-the-through-option |
# |
Feb 25th 2018, 19:58 |
savant |
If you can explain what exactly you’re trying to do there, maybe someone can help with that specific problem |
# |
Feb 25th 2018, 19:58 |
savant |
there isnt a way to create a join table two models deep |
# |
Feb 25th 2018, 19:57 |
savant |
the answer is “no” |
# |
Feb 25th 2018, 19:57 |
savant |
Sigried84: for your question “Does a model authors_author_types_books work?” |
# |
Feb 25th 2018, 19:52 |
savant |
I can help you for money |
# |
Feb 25th 2018, 19:52 |
savant |
hi! |
# |
Feb 25th 2018, 19:51 |
Sigfried84 |
Hello! I need someone that could solve my questions on CakePHP. Any idea where I can get help for money? |
# |
Feb 25th 2018, 19:50 |
savant |
no way to “switch” validators like that |
# |
Feb 25th 2018, 19:50 |
savant |
@mdotobie you’d need to check the value before calling newEntity |
# |
Feb 25th 2018, 19:44 |
iqu |
my god. found the bud. it was mine :) |
# |
Feb 25th 2018, 19:38 |
iqu |
same with 3.5.12 |
# |
Feb 25th 2018, 19:33 |
iqu |
cake3.5.10 |
# |
Feb 25th 2018, 19:30 |
iqu |
already emptied cache |
# |
Feb 25th 2018, 19:29 |
iqu |
even if i remove buildrules |
# |
Feb 25th 2018, 19:29 |
iqu |
found annoying bug: basically same https://stackoverflow.com/questions/46684324/what-happen-to-my-validation-using-cakephp3-4-13 |
# |
Feb 25th 2018, 16:10 |
mdotobie |
Is there a way to conditionally select a validator set used for a newEntity call. I have an object and depending on the value on one of the keys a different validator set should be used. But I’m trying to build this extensibly so I don’t have to hard code all possible validators initially but instead define them on classes that can be dynamically loaded based on that value. |
# |
Feb 25th 2018, 15:20 |
muerte |
have't other way? |
# |
Feb 25th 2018, 15:11 |
dereuromark |
yes |
# |
Feb 25th 2018, 15:10 |
muerte |
? |
# |
Feb 25th 2018, 15:10 |
muerte |
or you mean your app sandbox: https://github.com/dereuromark/cakephp-sandbox |
# |
Feb 25th 2018, 15:10 |
muerte |
where is sandbox? |
# |
Feb 25th 2018, 15:09 |
madrid988 |
that would be an easy rule to remember. |
# |
Feb 25th 2018, 15:08 |
madrid988 |
If I have an array being sent back to an html form, those keys will be sent back as data fields so I use underscore for those? |
# |
Feb 25th 2018, 15:04 |
admad |
if you notice all config keys in options for various core classes are camelCased |
# |
Feb 25th 2018, 15:03 |
admad |
madrid988: yes, underscore only for db fields, else camelCase |
# |
Feb 25th 2018, 15:03 |
madrid988 |
I would like to match the conventions cake used |
# |
Feb 25th 2018, 15:03 |
madrid988 |
Does anyone know the convention CakePHP uses for array key names? Should I only use underscore_case when the key represents a database field, and use titleCase for all other array keys? If I have an array which represents data, should I use underscore_case? |
# |
Feb 25th 2018, 14:51 |
dereuromark |
should work just fine either way, see the sandbox app. |
# |
Feb 25th 2018, 14:51 |
dereuromark |
which is correct, but probably not even needed |
# |
Feb 25th 2018, 14:50 |
muerte |
I think Plugin::load('Calendar'); was is add by bake plugin load |
# |
Feb 25th 2018, 14:34 |
spriz |
#sunday |
# |
Feb 25th 2018, 14:33 |
spriz |
Aye… git reset it is :,) |
# |
Feb 25th 2018, 14:32 |
hmic |
you'll just need the very same beforeFilter() methid in that component too, nothing else |
# |
Feb 25th 2018, 14:31 |
hmic |
well... you might revisit that |
# |
Feb 25th 2018, 14:31 |
spriz |
and also because I thought component was over-engineering it |