# |
Sep 21st 2019, 08:14 |
adam282 |
When submitted, provided the data is formatted properly and the associations are set up in the model, it should just work. |
# |
Sep 21st 2019, 08:14 |
jotpe |
There's on form to add a talk, within this form you can add Authors, Speakers, ... |
# |
Sep 21st 2019, 08:14 |
adam282 |
So, in one of my apps I have an option for a subscription to be part of multiple distribution lists. To select distribution lists, there’s a multiple select box: ``` <?php echo $this->Form->input('DistributionList', array('type' => 'select', 'empty' => false, 'options' => $lists, 'class' => 'form-control selectpicker', 'id' => 'distribution_list', 'multiple' => true, 'size' => '10')); ?> ``` |
# |
Sep 21st 2019, 08:13 |
adam282 |
Hm, I don’t quite understand. |
# |
Sep 21st 2019, 08:13 |
jotpe |
I add a talk and from this form the user can add authors |
# |
Sep 21st 2019, 08:12 |
adam282 |
Hm, what do you mean? How’s the interface designed? Are you going to a talk and adding people from there or are you going to people and adding talks? I mean, either way, it shouldn’t be that difficult. |
# |
Sep 21st 2019, 08:11 |
jotpe |
Yes, I ended up having some model associations like this. But When I want to add a talk by form it gets messy. Can't just add $requestdata = ['talk.title' ='XYZ', 'authors => ['first_name' => 'Test', ...] |
# |
Sep 21st 2019, 08:09 |
adam282 |
And this is only if `people` can belong to more than one `talk`. If not, you can simply this by removing `talks_peoples` and adding a `talk_id` to the `peoples` table. |
# |
Sep 21st 2019, 08:08 |
adam282 |
Disclaimer: I have done this in CakePHP 2.x but not 3.x so there might be some differences. |
# |
Sep 21st 2019, 08:08 |
adam282 |
Then, `talks_peoples` (not sure those are named according to conventions so verify them) would contain the `talk_id` and the `people_id` and then the `people` would be tied back to a role via their `people_role_id` which comes from `people_roles` |
# |
Sep 21st 2019, 08:07 |
adam282 |
Should be something like that |
# |
Sep 21st 2019, 08:07 |
slackebot |
`people_roles` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(32) DEFAULT NULL, `description` longtext DEFAULT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ``` |
# |
Sep 21st 2019, 08:07 |
slackebot |
DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `peoples` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `people_role_id` int(11) unsigned NOT NULL DEFAULT '1', `first_name` varchar(32) DEFAULT NULL, `last_name` varchar(32) DEFAULT NULL, `organization` varchar(96) DEFAULT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE |
# |
Sep 21st 2019, 08:07 |
adam282 |
``` CREATE TABLE `talks` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `call_for_paper_id` int(11) unsigned NOT NULL DEFAULT '1', `category_id` int(11) unsigned NOT NULL DEFAULT '1', `title` varchar(255) DEFAULT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `talks_peoples` ( `people_id` int(11) DEFAULT NULL, `talk_id` int(11) |
# |
Sep 21st 2019, 08:05 |
jotpe |
I tried with a person Model and add a Role to that person. But I can't use save it from the form then. |
# |
Sep 21st 2019, 08:03 |
adam282 |
Hm, shouldn’t be that difficult. |
# |
Sep 21st 2019, 08:03 |
jotpe |
In my Controller I need to save a talk with the corresponding Authors. |
# |
Sep 21st 2019, 08:03 |
jotpe |
Since Author, Spaker and Submitter share the same Information i tried to add a role, but it didn't work that well. |
# |
Sep 21st 2019, 08:02 |
slackebot |
<jotpe> |
# |
Sep 21st 2019, 08:01 |
jotpe |
Morning, folks. I_ve got a problem with associations: |
# |
Sep 21st 2019, 07:59 |
adam282 |
There, got it. |
# |
Sep 21st 2019, 07:59 |
adam282 |
Hm |
# |
Sep 21st 2019, 07:59 |
slackebot |
Action: admad yawns |
# |
Sep 21st 2019, 07:57 |
adam282 |
I might make this kick out an automated e-mail when a new build/release is uploaded as well. |
# |
Sep 21st 2019, 07:56 |
adam282 |
Right now, I upload them to S3 and then give them the link to S3 and then make the item private once downloaded but that sucks. |
# |
Sep 21st 2019, 07:56 |
adam282 |
This app should be a quick build. Very simple. Users, Applications, Application Builds, Application Releases, Clients. Tie a Client to an App and Builds/Releases to an App, upload the Build/Release to S3 and then be able to provide the Client a link that is not directly to S3 so they can download their mobile app builds/releases |
# |
Sep 21st 2019, 07:55 |
adam282 |
Haha, nah, decided not to |
# |
Sep 21st 2019, 07:55 |
adam282 |
Guessing that’s an `innerAttrs` |
# |
Sep 21st 2019, 07:55 |
admad |
i thought you were making an API for js frontend :slightly_smiling_face: |
# |
Sep 21st 2019, 07:54 |
adam282 |
Now if I could figure out how to set `itemWithoutLink`, I’d be good |
# |
Sep 21st 2019, 07:54 |
adam282 |
Haha, nice! Thank you. |
# |
Sep 21st 2019, 07:53 |
admad |
or simply call that method after loading method |
# |
Sep 21st 2019, 07:52 |
admad |
use config/options array when loading helper in AppView::initialize() |
# |
Sep 21st 2019, 07:52 |
challgren |
I think you can config it in your appview |
# |
Sep 21st 2019, 07:50 |
adam282 |
Is it possible to set something like this app wide instead of in each view template? ``` $this->Breadcrumbs->setTemplates([ 'wrapper' => '<nav aria-label="breadcrumb"><ol class="breadcrumb">{{content}}</ol></nav>', 'item' => '<li class="breadcrumb-item"><a href="{{url}}">{{title}}</a></li>' ]); ``` |
# |
Sep 21st 2019, 07:37 |
adam282 |
Never mind, guess that’s how MySQL does when `NOT NULL` is set for a `varchar` |
# |
Sep 21st 2019, 07:36 |
adam282 |
Not sure why name has a `DEFAULT ''` because it shouldn’t. |
# |
Sep 21st 2019, 07:36 |
slackebot |
datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `NAME_TYPE` (`name`,`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ``` The `type` describes what it is for. For instance, `system` is for the actual value while `option` is the JSON object with the options available for a certain parameter generally used in a select field. |
# |
Sep 21st 2019, 07:36 |
adam282 |
Ah, yeah, that won’t work. I store the options in a `settings` table with this structure: ``` CREATE TABLE `settings` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'system', `created` |
# |
Sep 21st 2019, 07:34 |
adam282 |
Well now that I have everything working… Haha |
# |
Sep 21st 2019, 07:34 |
admad |
https://book.cakephp.org/3.0/en/orm/database-basics.html#data-types |