Commit Graph

45 Commits

Author SHA1 Message Date
Julian Seidenberg
10199f908a API Data corruption on Versioned due to lazy loading
Lazy loading no longer loads fields from the versions table when querying. This could lead to incorrect data being displayed if the data on the object and the version it pointed to did not match.

API methods to allow setting of the context of the query that generated the DataObject on that object (used by the lazy loading mechanism to correctly query the Stage, Live, or Versions tables)

See https://github.com/silverstripe/sapphire/pull/1178 for context.
2013-02-14 14:28:42 +01:00
Sean Harvey
c23df511cd Improve class naming and docs for DataList::applyFilterContext() 2012-12-14 12:06:25 +13:00
Simon Welsh
fc5dd2994c Add codesniffer that ensures indentation is with tabs. 2012-12-12 00:12:11 +13:00
Sam Minnee
1f7fc1f76a FIX Remove instances of lines longer than 120c
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit.  This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
2012-09-30 17:18:13 +13:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Hamish Friedlander
e8e4604457 API Prep DataList for immutability in 3.1 per 7673
DataList had several methods that should act on a copy and return
that copy, but was instead mutating the existing list.

We cant change this behaviour in the 3.0 line for backwards compt.
reasons, but this makes the desired behavior the default, and
makes disabling the mutation in 3.1 easier

It also introduces two new methods to deal with the common pattern
of wanting to modify the underlying dataQuery, which we want to be
able to reliably do in a way that always acts immutably. The main
method of these two is alterDataQuery
2012-07-20 15:58:18 +12:00
Ingo Schommer
712f28bc78 Scoped deprecation messages (fixes #7645) 2012-07-13 11:37:35 +02:00
Andrew Short
119da09549 BUG Fixed DataList filtering and excluding by ID.
If a filter or exclude by ID was applied across more than one table it
would throw an ambiguous column error as the table name was not specified.
2012-06-25 10:16:18 +12:00
Sam Minnee
e19ab7aa5a BUGFIX: Ensure that DataList::filter() doesn't modify the original object. 2012-06-06 16:13:54 +12:00
Sam Minnee
0821f021cc API CHANGE: Added DataList::filterByCallback() to allow filtering by PHP code. 2012-06-06 16:12:05 +12: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
909c5bd3b1 MINOR Fixed spelling error 2012-05-29 20:10:34 +12:00
Sean Harvey
f43273f217 MINOR Provide a better error if incorrect number of arguments are passed
to filter() or exclude() on a DataList
2012-05-29 20:09:36 +12:00
Ingo Schommer
3a11c690ed MINOR Updated security documentation (phpdoc and markdown) around new DataList and SQLQuery APIs, additional automatic escaping on some stricter inputs like column names 2012-05-16 11:59:22 +02: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
Sam Minnee
a8e8a6060a BUGFIX: Fixed errors caused by complex raw SQL sort() calls. (#7236) 2012-05-01 18:15:08 +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
Will Rossiter
9938b64cf6 FEATURE: implement SS_Sortable->reverse()
API CHANGE: SQLQuery:: now an array object rather than string. Existing strings will continue to work
2012-04-27 15:54:14 +12:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +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
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
Andrew O'Neil
de2832e65f ENHANCEMENT: Allow Object::create() to be called with late static binding.
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.
2012-03-27 17:57:42 +13:00
Stig Lindqvist
2cb67efe07 API CHANGE DataObject::getComponents() should use default value for limit as NULL 2012-03-09 17:07:41 +13:00
Sam Minnee
e9e7655867 API CHANGE: Added SS_Sortable, an extra interface to apply to SS_Lists. 2012-03-09 17:07:41 +13:00
Sam Minnee
f000a47813 API CHANGE: Added SS_Filterable, an extra interface to apply to lists. 2012-03-09 17:07:40 +13:00
Sam Minnee
a55e06f6b5 API CHANGE: Introduce SS_Limitable class for adding to SS_Lists that have limit capability.
API CHANGE: Deprecated SS_List::getRange() in favour of SS_Limitable::limit().
API CHANGE: Introduce SS_Limitable::limit($limit, $offset = 0) as the only modern way of specifying limits; deprecate all others.
2012-03-09 17:07:40 +13:00
Stig Lindqvist
7f09b6931b API CHANGE DataList::subtract and DataQuery::subtract for subtracting a list from another list
Minor Stripped out ManyManyList tests from DataListTest into it's own test case
2012-01-26 17:59:43 +13:00
Sam Minnee
d296a9411d Merge remote-tracking branch 'refs/remotes/scienceninjas/story/sort-by-relation-on-datalist' 2012-01-10 17:33:04 +13:00
Stig Lindqvist
3c516b7b97 API CHANGE: Refactored GridField modifiers into GridField_ColumnProvider, GridField_HTMLProvider, GridField_ActionProvider, and GridField_DataModifier interfaces, all added as components in the config.
API CHANGE: Simplified state handling so that it's just a key store. Affectors are replaced with GridField_ActionProviders. API CHANGE: Removed GridField state manipulation actions instead opting for GridField_ActionProvider actions.
API CHANGE: Removed support for modifiers that add "body" rows, instead having core support for generating the body rows hardcoded into the GridField.
API CHANGE: Allow modification of columns across the whole GridField with the GridField_ColumnProvider interface.
API CHANGE: Renamed GridField_AlterAction to GridField_Action, and added actionName/args parameters, since it can be used for all actions (including batch actions and row actions)
API CHANGE: Removed GridFieldRow class.
2012-01-09 13:30:34 +13:00
Stig Lindqvist
f59d11c91e MINOR DataList::sort() can sort by relation name 2011-12-18 04:28:09 +01:00
Stig Lindqvist
9bf247cc33 API CHANGE Introduced DataQuery::whereAny() and SQLQuery::whereAny() 2011-12-17 16:42:30 +13:00
Stig Lindqvist
aafdb8e01c API CHANGE All SS_List implementators supports filter, exclude and sort methods 2011-12-17 16:42:29 +13:00
Stig Lindqvist
2306ec94c3 MINOR Updated inline documentation and added visibility keywords to methods for SS_List, DataList and ArrayList 2011-12-17 16:42:29 +13:00
Sean Harvey
30f049bd26 ENHANCEMENT ArrayList and DataList now show a nice view of the items inside when using Debug::show() 2011-12-17 12:45:45 +13:00
Sam Minnee
5ed14915bb BUGFIX: Fixed DataList::find() for find by ID and find multiple times. 2011-10-29 17:36:39 +13:00
Sam Minnee
0d683dd8ef MINOR: Removed use of deprecated join() in favour of innerJoin() and leftJoin(). 2011-10-29 17:36:38 +13:00
Sam Minnee
a4ee0f4dad ENHANCMEMENT: Added SS_Map to replace SQLMap.
API CHANGE: Deprecate SQLMap.
2011-10-29 17:34:32 +13:00
Sean Harvey
3bf983200b BUGFIX DataQuery: ensuring ORDER BY columns are set in SELECT clauses 2011-10-29 17:28:46 +13:00
Stig Lindqvist
e38dd08ea5 MINOR: Fix docblocks to reference SS_List instead of (now deprecated) DataObjectSet where appropriate 2011-10-28 15:58:55 +13:00
ajshort
b872ad7bb8 MINOR: Added default parameters to DataList->map(). 2011-05-03 12:15:49 +10:00
ajshort
50506659d1 API ChANGE: Updated DataList to not extend from DataObjectSet, but instead implement the list iterator.
MINOR: Return an ArrayIterator from DataList rather than a DataObjectSet_Iterator.
2011-05-02 18:14:55 +10:00
Sam Minnee
7fbb919ce8 API CHANGE: Introduce DataModel object, as a representation of the project's entire data model, and tie it to $this->model an all DataObjects, Controllers, and RequestHandlers for easy non-static access.
API CHANGE: Add DataList::newObject(), which creates a new object on that DataList.
API CHANGE: RequestHandler::handleRequest() now needs to handle a $model argument, if you override it.
2011-05-01 17:33:02 +12:00
ajshort
34e9ddfcc3 MINOR: Moved files from /core/model into /model. 2011-05-01 15:26:30 +12:00