/**
* Defines a common interface for entities that have an owner.
*
* An owner is someone who has primary control over an entity, similar to
* owners in Unix file system access. This may or may not be the entity's
* original author. The owner may also have less permissions than other users,
* such as administrators.
*/
interface EntityOwnerInterface {
And the uid field should setDefaultValueCallback.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | interdiff-2625288.txt | 2.19 KB | longwave |
| #14 | entityownerinterface.patch | 34.77 KB | longwave |
Comments
Comment #2
jian he commentedAnd the uid field should setDefaultValueCallback.
Comment #3
tr commentedYes.
The history, if you're interested, is that Order.php was written BEFORE EntityOwnerInterface even existed. Now that we have that core interface we should use it ...
OrderInterface should extend EntityOwnerInterface, and the getUser(), getUserID(), setUser(), setUserID() methods should be renamed to xxxOwner() and xxxOwnerID() to agree with that new interface and of course all uses of those methods in other parts of Ubercart need to be updated.
Comment #4
longwaveThis patch implements EntityOwnerInterface but does not add setDefaultValueCallback to the uid field. This is because we currently always specify the uid whether the order is created on the front or back end, and I think OrderStorage::create() needs refactoring so we have default value callbacks for all the fields - primary_email will be interesting as we need to know the uid in order to discover the email address.
Comment #6
longwaveComment #7
longwaveComment #9
longwaveAlright, stop trying to be clever.
Comment #10
longwaveComment #11
longwaveI think it's safe to move OrderStorage::create() into Order::preCreate() and add the callback. We can also refactor the customer information pane to not set the user ID or email now, and add a test to confirm this all still works as expected.
edit: still need to remove the hidden value from the customer info pane
Comment #13
tr commentedBlocking #2625416: OrderStorage::getSchema() does nothing
Comment #14
longwaveComment #15
longwaveCommitted #14.