Commit Graph

77 Commits

Author SHA1 Message Date
stozze
499b7c9ff9 BUGFIX Fix to prevent unintended results from getComponentsQuery(...)
Wrapped $filter inside parentheses to prevent unintended results if $filter contains "OR".
2012-09-14 18:31:37 +03:00
Hamish Friedlander
df5a9e087d FIX Cache ClassName enum so we dont query DB every call 2012-09-12 11:14:59 +12:00
Sam Minnée
57ad36e11d Merge pull request #750 from silverstripe-rebelalliance/open/5971
FIX If ClassName read from DB doesnt exist, dont break
2012-08-29 22:48:31 -07:00
Hamish Friedlander
2f00884e79 FIX If ClassName read from DB doesnt exist, dont break
We know the subclass of a record by its ClassName value, but code changes
might have meant that class no longer exists. We used to just break,
but this patch overrides the apparent value of ClassName to be
one that exists in that situation
2012-08-30 11:02:50 +12:00
Ingo Schommer
f070f971cf BUG Allow custom getters in summaryFields() (fixes #7788)
Regression from ca1d38dffd
2012-08-29 13:42:29 +02:00
Ingo Schommer
ca1d38dffd BUG Localize DataObject->summaryFields() 2012-08-10 00:14:02 +02:00
Hamish Friedlander
367c49d6b1 API DataObject#relField now checks for method on model before property 2012-07-27 14:44:38 +12:00
Hamish Friedlander
36c8fc2e93 Merge pull request #660 from silverstripe-rebelalliance/trac/7673
API Prep ArrayList, DataList, forForeignID for immutability in 3.1 per 7673
2012-07-22 21:30:53 -07:00
Hamish Friedlander
b7691077cf API Prep forForeignID for immutability in 3.1 per 7673 2012-07-23 10:31:47 +12:00
Hamish Friedlander
e8cd675c94 BUG trac 7482 couldnt publish composite fields to live
When publishing to live, DataObject#forceChange is called, which wasnt correctly loading
in fields that were lazy (unloaded) if those fields were from composite fields
like Money. The end result is that any Money values would be forced to null on
publish to live

Also changes the API of the (internal, protected) loadLazyFields method so that
not passing a class argument just unlazys all lazy fields regardless of source table
2012-07-18 16:28:24 +12:00
Hamish Friedlander
69928631fe BUG trac 7482, we werent unlazying composite fields right
In getField we check if the field we are getting is currently lazy (unloaded), and
load it if it is. This was only working for simple fields though - composite
fields like Money werent working
2012-07-18 16:25:37 +12:00
Ingo Schommer
712f28bc78 Scoped deprecation messages (fixes #7645) 2012-07-13 11:37:35 +02:00
Hamish Friedlander
890f7e3919 BUG $db in extensions not inited early enough (#7598)
When querying DataObjects by a generic parent class (like SiteTree for instance), fields added via $db
set on child classes wouldnt appear.

This is because Object::__construct wasnt called early enough in DataObject::__construct, so
extensions werent initialised when $db was first accessed
2012-07-02 17:25:14 +12:00
Sean Harvey
0a2e877625 MINOR Remove PostgreSQLDatabase boolean workaround in
DataObject::__construct()

The database adapter uses smallint instead of the boolean datatype,
which works around the issue instead of converting the value.
2012-06-12 14:21:59 +12:00
Sean Harvey
59e68f16da MINOR Remove MSSQLDatabase date/datetime workarounds from DataObject::__construct()
These are being handled by the MSSQLDatabase class in the mssql module
instead, which keeps the workarounds separated from the framework core.
2012-06-12 12:25:15 +12:00
Sam Minnee
f65a7c6b21 API CHANGE: Remove dodgy DataObject::destroy() behaviour, opting instead for using PHP5.3's garbage collector. 2012-06-11 22:41:12 +12:00
Sam Minnee
5499079c1c BUGFIX: Fixed ORM bugs introduced in ec55468932 2012-06-05 11:07:19 +12:00
Sam Minnée
90378b0998 Merge pull request #504 from schmengler/namespace-fixes-rc1
BUGFIX: Handling of classes with namespaces in database
2012-06-04 15:31:26 -07:00
Fabian Schmengler
ec55468932 BUGFIX: Handling of classes with namespaces in database
MySQLDatabase::enumValuesForField() - Added stripslashes because backslashes are escaped in the type description

DataObject::requireTable() - Added double quotes to column names in automatically generated indexes for many_many relationships

DataObject::write() - Escaped class name for DB query

DataQuery::getFinalisedQuery() - Escaped class names for DB query
2012-06-04 20:22:37 +02:00
Marcus Nyeholt
82a1e7d282 MINOR Use injector for creating Member_GroupSet object
MINOR Use injector for creating many many list objects

MINOR Use injector for creating objects from within the DataList

MINOR Use Injector::inst() for creating objects; cannot rely on this->injector being present due to many classes being created with 'new', so use inst() directly

MINOR Remove injector autoset property for now; automatically setting it breaks a few test cases that don't know about it for now, and it's not needed just yet
2012-06-05 01:33:44 +10:00
Sean Harvey
792c89e103 ENHANCEMENT Adding List() in the GenericTemplateGlobalProvider so
templates can use <% cached List(Member).max(LastEdited) %> instead
of deprecated "Aggregate" syntax.
2012-05-29 20:04:51 +12:00
Sean Harvey
862d7f249b MINOR If $containerClass passed in to DataObject::get() isn't DataList,
use Deprecation::notice() instead of throwing a notice
2012-05-28 21:12:06 +12:00
Sean Harvey
b1104dac25 BUGFIX Don't try lazy loading fields when the record ID is set to something non-numeric, otherwise you'll get a SQL error. 2012-05-15 17:18:50 +12:00
Sean Harvey
a53cca8932 MINOR Renaming getFieldSet with getFieldList in FormScaffolder 2012-05-14 15:03:22 +12:00
Sean Harvey
1859070fa9 MINOR Fixing use of deprecated getAllFields(), mark field as deprecated properly. 2012-05-11 11:23:24 +12:00
Sean Harvey
051d9de482 API CHANGE Deprecated internal access to SQLQuery properties, update core code to reflect these changes.
Using set/add instead in accessor methods, and use Database::sql*ToString() to allow easier per-database adapter SQL overloading.
2012-05-07 14:21:44 +12:00
Sean Harvey
0882741f54 API CHANGE Renamed setModel for DataModel instances to setDataModel for
semantics, and also to allow a field name called "Model"
2012-05-01 14:45:44 +12:00
Robert Curry
ff6909df97 ENHANCEMENT: Add lazy loading to DataQuery. 2012-04-30 16:12:15 +12:00
Mateusz Uzdowski
6469d83569 API CHANGE: add a remote relation class getter to DataObject 2012-04-23 15:01:55 +12:00
Sean Harvey
1683299d81 MINOR Ignore any values that come through as arrays in DataObject::cache_composite_fields() 2012-04-20 15:25:52 +12:00
Sam Minnee
8e48e6e231 API CHANGE: Allow <classname>::get(), eg, Member::get()->byID(5) 2012-04-20 14:58:24 +12:00
Sean Harvey
4c6be2931b BUGFIX Removing use of deprecated Object static functions like
get_static(), set_static(), uninherited() etc. Replace with equivalent
Config system get(), update()
2012-04-18 23:10:57 +12:00
Sean Harvey
7d84aff01e Merge pull request #339 from ajoneil/remove-pre-53-support
Remove pre 5.3 support
2012-04-17 16:19:23 -07:00
Andrew O'Neil
fb3b03f38b MINOR: Remove support for PHP <5.3.2 2012-04-18 11:01:03 +12:00
Mateusz Uzdowski
42e6ae2cdf APICHANGE: add validation extension hook to DataExtension 2012-04-18 09:25:48 +12:00
Ingo Schommer
d44f6b3e1f MINOR Removed deprecated usage of $priority argument in _t() calls 2012-04-15 17:17:17 +02:00
Ingo Schommer
b81863cfd9 MINOR Caching DataObject->fieldLabels() in memory, to avoid _t() being called excessively through fieldLabel() 2012-04-15 17:17:17 +02:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Ingo Schommer
8ba9c3ca6b API CHANGE Removed $params argument to DataObject->getCMSFields(), please use FormScaffolder directly (fixes #7135) 2012-04-13 15:46:47 +02:00
Ingo Schommer
c73b80049a MINOR Removed usage of deprecated Object::uninherited_static() in core, improves CMS loading speed in live mode by ~3.5% 2012-04-12 18:26:56 +02:00
Mateusz Uzdowski
ae5bd7d65e ENHANCEMENT: refer to cache statics explicitly via DataObject (os6175)
Unify the usage across the class. Since the intention is to have a
single site-wide cache, calling via DataObject seems to be a better
option - self could theoretically end up calling a redefined field from
a subclass.
2012-04-12 17:04:24 +12:00
Mateusz Uzdowski
aedadebae6 BUGFIX: adjust the cache flush and reset functions to cover all caches (os6175) 2012-04-12 17:04:22 +12:00
Mateusz Uzdowski
8ea2460e50 BUGFIX: make internal DataObject caches more consistent (os6175) 2012-04-12 17:03:18 +12:00
Mateusz Uzdowski
621b2e1888 APICHANGE: deprecate DataObject::setComponent, no longer does anything. 2012-04-12 17:02:09 +12:00
Mateusz Uzdowski
360e9df54e MINOR: fix typo 2012-04-12 16:22:36 +12:00
Andrew O'Neil
bdb312c665 API CHANGE: DBField::hasValue() conflicts with ViewableData::hasValue(), use DBField::exists() instead. 2012-04-11 14:48:06 +12:00
Ingo Schommer
6517f4496b Merge pull request #273 from ajoneil/sapphire
---

This allows DataList::create(SiteTree) as equivalent to Object::create(DataList, SiteTree), without
having to have a create() function on DataList.

Required for E_STRICT compliance, as child classes cant override create() if they change the arguments.

DBField::create() is also renamed to DBField::create_field(), as this does not just call the constructor, which all other cases of create() do.

Conflicts:
	tests/model/DateTest.php
	tests/model/DatetimeTest.php
2012-04-04 16:48:16 +02:00
Sam Minnee
58433d38ce BUGFIX: Tidied up relObject() behaviour on DataLists to restore broken SearchContext functionality. 2012-03-30 15:59:57 +13:00
Sean Harvey
e097f6e1a8 MINOR Fixes to method arguments in core classes for E_STRICT support.
API CHANGE Remove abstract static function and just use static functions
in Authenticator (PHP 5.3+ doesn't support abstract static functions)
2012-03-28 22:41:42 +13:00
Normann Lou
9e60225064 MINOR : Update core docs to use DataList::create() rather than DataObject::get()/get_one()/get_by_id() where appropriate - Trac#6891 2012-03-27 17:02:18 +02:00