Here is an uncomplete patch from the code sprint! Uncomplete as I have to get som air and then go to the airport, and I need some help on a few parts. I did test everything that I changed though, and I think everything is running as it should.
All parts that are either not ported yet or have other problems are marked with TODO:.
– In block_user() and _block_load_blocks() there are two dynamic queries with joins that I can't convert without either some more documentation or some more help.
– block_admin_display_form_submit() isn't working.
I'll try to finish the rest of the trivial stuff on the train. So long!
Comments
Comment #1
zoo33 commentedOK, block_admin_display_form_submit() wasn't working simply because I had left out execute().
More thougths:
Crell says we should the default object fetch mode as much as possible. There are at least two places in this patch where I override that and use arrays, since it seemed like a pretty big job to change every occurrence of the retrieved variable from arrays to objects ($box and $old_block). So I wanted to check first to see if people think we should actually do that.
Also:
Since there are still few examples to look at I'm not sure how to format this code: chained method calls, wrapping long statements etc. I seem to remember Crell showing something similar to this:...or even:
The fields array works good this way I think, but I don't particularly like the condition() clutter in any of these two examples. Thoughts?I'll be back later with an updated patch.
Comment #2
zoo33 commentedAh, so this it probably what we should do:
Wasn't aware of that possibility. Looks a lot better.
Comment #3
zoo33 commentedHere comes a new patch. All tests pass!
It's been pretty easy to port this moule once I got the hang of it.
Just a couple of questions (as above):
– is db_last_insert_id() used in the new API?
– are there any query results that should be converted to objects (instead of using PDO::FETCH_ASSOC)?
– coding style OK?
Comment #4
zoo33 commentedOh, and of course, there are still two complicated dynamic queries marked TODO.
Comment #5
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #6
zoo33 commentedGreetings from Drupalcamp Copenhagen!
Here is a new patch which is updated to reflect recent changes in HEAD, such as changed table names.
I also had to add a couple of (int) casts as PDO was complaining about wrong data types.
The TODO items are still there.
Comment #7
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #8
zoo33 commented#337212: DBTNG: Block module
Comment #9
moshe weitzman commentedAdd tag. I would like to see a tag on the key queries for loading blocks so that modules can alter the query. That means using db_select() instead of db_query().
Comment #10
berdirClosing as duplicate of #337212-10: DBTNG: Block module. That one also contains a block_load tag for loading query...