Added composite primary key support to JTable. #1606
Conversation
Would you mind double checking the code style on this? The pull tester shows 2 more issues than most other ones, and I'd like to be sure. Marked it for 12.3 regardless. I'd also like to leave it open for a few days in case others want to comment. |
I used underscores on protected variables to avoid colliding with columns in the table. |
* Object constructor to set table and key fields. In most cases this will | ||
* be overridden by child classes to explicitly set the table and key fields | ||
* for a particular database table. | ||
* | ||
* @param string $table Name of the table to model. | ||
* @param string $key Name of the primary key field in the table. | ||
* @param array $key Name of the primary key field in the table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should key be mixed
?
You are right @eddieajau. I have changed it to mixed. |
* @param JDatabaseDriver $db JDatabaseDriver object. | ||
* | ||
* @since 11.1 | ||
*/ | ||
public function __construct($table, $key, JDatabaseDriver $db) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason you are dropping the type hinting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To save disk space. :P
Nice -- but as we are on it, I would like to allow one more use case, which is using "foreign key" as a primary key. For example UCM could be implemented by extending a table with another table using the same key. I would also make a small feature to allow table to know if item already exists in the table. We have implementation of this feature in Kunena and it would be really easy to add into here, too. Basically you need to add:
.. and some logic to set the variable when the item gets loaded, saved or removed. Above code also prevents extra lookup to the database if the item was fetched earlier. If you want to handle both, I would set $_exists = null at first and use true/false when you want to know the status of the object (also change the code to make SQL query if state is unknown). |
Fix broken module installation in Postgresql because of NULL constraint
@mahagr Those are good ideas and definitely worth exploring. I'd like to get things in as is first and then we can build on it. I think what is there provides a good foundation that we can build on. |
Correct a class name JLoggerCallback => JLogLoggerCallback
Rebased, squashed and fixed doc block issues. |
Added composite primary key support to JTable.
@mahagr I hope you follow up with a pull request with some of the ideas that you had. |
@ianmacl Our house is currently under repair (water pipes...), which unfortunately has a small distracting effect on everything I (try to) do. Are you coming to world conference? |
doesn't included with Joomla 2.5.7 👎 |
@rashidul04 this is the platform, so the CMS may or may not implement the platform changes back to the CMS. If they do, it usually takes longer, and will not make it into the 2.5.x series. |
It'll be in Platform 12.3's release which will likely be picked up with the Joomla CMS 3.1 release. You can ship it and load it yourself with 2.5/3.0 and just give it another name so that it doesn't conflict. |
Unfortunately, it looks like there was an unintended regression here dealing with the asset handling in |
No description provided.