Commit Graph

647 Commits

Author SHA1 Message Date
Will Rossiter
a50996a010 NEW: Add support for push operator on ArrayList (Fixes #1539) 2014-01-12 18:55:40 +13:00
Jeremy Shipman
62694b0a8b NEW: Made ValidationResult functions chain-able.
Added unit tests for CombiningResults
2014-01-09 16:32:27 +13:00
Ingo Schommer
f29d51f433 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	docs/en/reference/dataobject.md
	lang/es.yml
2013-12-19 20:23:09 +01:00
Sean Harvey
6fc9db6f0e API DataObject::validate() visibility changed to public (issue #1659)
DataObject::validate() is currently set to protected, but this means
you can't call validate() from outside the context of itself unless
you overload the method to use a public visibility and then call
parent::validate()

As it would turn out, most classes that overload this method already
set the visibility to public, so it would make sense the parent matches
that as well.
2013-12-19 16:36:39 +13:00
Daniel Pickering
94c19e349a FIX: Year.php getDefaultOptions now fixed, sets key as year. Also added YearTest unit test. 2013-12-16 03:29:29 +00:00
Ingo Schommer
ab91a5a80b Merge pull request #2622 from froog/patch-1
Created LessThanOrEqualFilter and GreaterThanEqualFilter
2013-12-13 03:34:45 -08:00
Ingo Schommer
c811556ea5 Removed debug code 2013-12-13 10:04:26 +01:00
Fred Condo
b88a0955a5 API: Support string descriptors for unique indexes in Versioned
- Document the format for descriptor arrays
- Implement the behaviour that developers have come to expect for
  string descriptors of indexes
- Add test for handling of unique indexes (MySQL & sqlite3)
- Resolve #2403

Versioned needs to convert unique indexes to non-unique for its suffixed
tables, such as Foo_Live and Foo_versions. Because DataObject accepts
string descriptors such as array('UniqIDX' => 'unique (Uniq)') as well
as array-based descriptors, Versioned needs to recognize string
descriptors. This patch accomplishes that. Before, Versioned would fail
to convert string-described indexes to non-unique, resulting in run-time
errors when creating a new version of an object.
2013-12-06 10:02:44 -08:00
Ingo Schommer
6176d65bd2 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	forms/gridfield/GridFieldSortableHeader.php
	model/DataList.php
	model/fieldtypes/Enum.php
2013-12-02 20:49:34 +01:00
froog
755857b22a NEW: Created LessThanOrEqualFilter and GreaterThanEqualFilter 2013-11-25 03:59:51 +00:00
Ingo Schommer
70207b0c98 Merge pull request #2626 from Zauberfisch/filterByCallback
filterByCallback added to SS_Filterable interface and implemented in ArrayList
2013-11-21 05:34:36 -08:00
Zauberfisch
d9b74874fc added filterByCallback() to interface SS_Filterable and all implementing classes 2013-11-21 13:03:18 +00:00
Will Rossiter
0e89c4b6cd API: Implement SS_Map::push() to append values.
FIX: SS_Map::count() not taking into account additional firstItems
2013-11-18 20:38:57 +13:00
Andrew Short
bedf292612 Merge branch '3.1'
Conflicts:
	docs/en/reference/execution-pipeline.md
	lang/nl.yml
2013-11-11 18:18:25 +11:00
Damian Mooyman
c74f7e7640 BUG Fixes issue where items could be deleted from a has_many relation by an entirely unrelated HasManyList calling delete on that item. 2013-11-01 11:39:13 +13:00
Ingo Schommer
dfabd54bdb Fixed support for single stage in Versioned
This used to work in 2.4, so is considered a regression.
To test, simply add a Versioned("Stage") extension to
some record in 2.4 vs. 3.1.
2013-10-24 17:09:17 +02:00
Ingo Schommer
60fc7e5346 Merge remote-tracking branch 'origin/3.1' 2013-10-06 19:07:39 +02:00
Damian Mooyman
afaf7f6b4e BUG Sort column order maintained correctly when using expressions in SQLQuery and DataQuery 2013-10-03 14:20:31 +13:00
Ingo Schommer
455e550d9a Merge remote-tracking branch 'origin/3.1'
Conflicts:
	docs/en/topics/testing/create-silverstripe-test.md
	forms/Form.php
	i18n/i18n.php
	model/Image.php
2013-09-27 19:22:14 +02:00
Ingo Schommer
ba5984e2bf Only compare array notations in SQLQuery->getOrderedJoins()
If more than two $from were added through SQLQuery->addFrom(),
the getOrderedJoins() comparison kicks in. It assumes all $from
parts are in array notation, which isn't always the case.
For legacy reasons, and because we don't have full API support,
you can still add literal joins through addFrom('INNER JOIN ...').
On PHP 5.3, the ordering comparison still works because it
allows array access in strings, with string rather than numeric indexes.
Thankfully that's no longer supported in PHP 5.4.
2013-09-17 22:08:48 +02:00
Sean Harvey
17fb7752db Skipping SQLQueryTest::testZeroLimitWithOffset() for MSSQLDatabase.
This test doesn't work on MSSQLDatabase.
2013-09-13 15:50:36 +12:00
Sean Harvey
bf1110d911 Adding a test for SQLQuery::setLimit() parsing OFFSET string clause. 2013-09-13 15:44:46 +12:00
Russell Michell
bbda63a16f MINOR: Corrected tests to use assertFalse|True() 2013-09-13 12:27:37 +12:00
Russell Michell
3aaa12f114 FIX: Fixes #2398
- hasAmount() failed to return true for values <= 0.99 and >= 0.01
- Added unit tests
2013-09-13 12:21:21 +12:00
Sean Harvey
95bb799e6f BUG Fixing SQLQuery::aggregate() adding ORDER BY when no limit.
DataQuery::initialiseQuery() will add a default sort to a query,
and when calling up an aggregate it will make a query like this
which doesn't make sense:

SELECT MAX("LastEdited") FROM "Member" ORDER BY "ID"

In this case there is no need to add the ORDER BY, and it will
break databases like MSSQL in cases such as
GenericTemplateGlobalProvider
which provides a default List() function for adding aggregates
into SSViewer template cacheblocks.

If we add a limit, however, then it does make sense:

SELECT MAX("LastEdited") FROM "Member" ORDER BY "ID" LIMIT 10

This fixes SQLQuery::aggregate() to NOT add an ORDER BY to an
aggregate call if there is no limit.
2013-09-06 18:11:11 +12:00
Johannes Hammersen, x75
b8495da5d9 BUG Cached images stored in wrong folder
If multiple image manipulations are performend the resulting cached image is stored in assets/_resampled because the cached version of the image has no ParentID, which cacheFilename needs to set the correct path.
2013-08-26 10:16:42 +02:00
Ingo Schommer
a4c6ae3e90 Merge remote-tracking branch 'origin/3.1' 2013-08-22 13:56:33 +02:00
Simon Welsh
151baeede1 Correct line length and indentation 2013-08-21 18:54:05 +12:00
Ingo Schommer
a6da1f5570 Merge pull request #2294 from wilr/fixgridexport
FIX: Remove limit on GridField export
2013-08-20 14:08:18 -07:00
Will Rossiter
65d96e8d7c FIX: Remove limit on GridField export
Allow DataList::limit() to take a null value to remove the limit.

Added tests for limit(). Note the one failure, currently the ORM doesn't support unlimited values with an offset.
2013-08-05 19:59:12 +12:00
Robert Curry
d69520bd70 Preempt fatal errors when making some function calls on an empty ArrayList
The function "first" on ArrayList uses the PHP function "reset", which
returns false if there aren't any elements in the array. Two functions
inside ArrayList use this function, "canFilterBy" and "byID". I've
changed these functions to catch the possibility of a false return from
first().
2013-08-05 15:47:58 +12:00
Simon Welsh
4b57a343a2 Merge remote-tracking branch 'origin/3.1' 2013-07-05 11:56:31 +12:00
Simon Welsh
ff45f7ce4d DataListTest should not rely on order of values when not explictly sorting 2013-07-05 11:45:34 +12:00
Simon Welsh
dfc8dbdee0 Merge remote-tracking branch 'origin/3.1' 2013-07-05 10:23:59 +12:00
Simon Welsh
fbce9fd7cd Merge branch '3.1'
Conflicts:
	.travis.yml
	docs/en/misc/contributing/code.md
	javascript/HtmlEditorField.js
2013-07-05 10:22:58 +12:00
Hamish Friedlander
ca63e33c19 FIX Recent patch to DataObject#db changed API which broke core 2013-07-05 10:11:35 +12:00
Ingo Schommer
cf20923fd6 Postgres compat in SQLQueryTest 2013-07-04 22:28:13 +02:00
Jeremy Thomerson
50e9eee2e9 FIX #2174: SearchFilter needs casting helper for DataObject base fields
Commit 964b3f2 fixed an issue where dbObject was returning casting helpers for
fields that were not actually DB objects, but had something in $casting config.

However, because dbObject was no longer calling DataObject->castingHelper, this
exposed a bug that the underlying function db($fieldName) was not returning
field specs for the base fields that are created by SS automatically on all
DataObjects (i.e. Created, LastEdited, etc).

This commit fixes the underlying issue that DataObject->db($fieldName) should
return the field specs for *all* DB fields like its documentation says it will,
including those base fields that are automatically created and do not appear in
$db.
2013-07-03 03:03:40 +00:00
Ingo Schommer
94b4237372 Merge remote-tracking branch 'origin/3.1' 2013-06-19 11:17:33 +02:00
Will Rossiter
9775204436 FIX Allow filtering on joined columns 2013-06-15 12:06:24 +12:00
Will Rossiter
0129e185b8 Coding conventions, PHPDoc cleanup 2013-06-15 12:06:24 +12:00
Damian Mooyman
be986c6524 API Allow $summary_fields to support methods on DBFields 2013-06-13 09:41:24 +12:00
Stig Lindqvist
dbc2b62c69 Merge pull request #2054 from chillu/pulls/dataobject-duplicate-hasone
BUG Correct relation saving in DataObject->duplicateRelations()
2013-06-07 22:54:36 -07:00
Ingo Schommer
23e51b871b BUG Accept $limit=0 in SQLQuery->setLimit()
SQLQuery->setLimit(0, 99) should result in "SELECT ... LIMIT 0 OFFSET 1".
In fact it does "SELECT ..." without a LIMIT clause at all,
which is unexpected. This is regardless of the $offset value.
2013-06-06 15:27:14 +02:00
Ingo Schommer
f61ab7305d BUG Correct relation saving in DataObject->duplicateRelations()
This caused problems when duplicate() was used in the CMS UI
to duplicate a SiteTree object. Since every object of this type
has a ParentID relation, it copied this empty relation into
new "ghost page".

See https://github.com/silverstripe/silverstripe-cms/issues/689
2013-06-03 15:57:20 +02:00
Ingo Schommer
5a1d476e8d Merge branch 'idvalidattr' of git://github.com/wilr/sapphire into wilr-idvalidattr 2013-05-31 19:27:19 +02:00
Ingo Schommer
88536998b9 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	.travis.yml
2013-05-31 18:08:59 +02:00
Will Rossiter
41974b9632 MoneyTest_Subclass::$db needs to be private. 2013-05-30 21:05:03 +12:00
Loz Calver
4a158454d6 FIX: Convert newlines to <br /> tags in string fields (fixes #1942) 2013-05-30 09:26:58 +01:00
Sam Minnée
c26ddee191 Merge pull request #1861 from raket/dataobject-update-orphan
Fix: Orphaned records when running DataObject::update
2013-05-24 19:48:48 -07:00
Sam Minnee
d97ca43cd0 Merge branch '3.1'
Conflicts:
	README.md
	dev/install/install.php5
	forms/ConfirmedPasswordField.php
	tests/forms/FormTest.php
2013-05-23 19:01:58 +12:00
Will Rossiter
5ec4f3146f Merge pull request #1869 from wilr/open6236
FIX: Remove version field from default scaffolded CMS fields.
2013-05-21 03:50:55 -07:00
Will Rossiter
f6cd582dd9 FIX: Remove version field from default scaffolded CMS fields. 2013-05-21 22:47:54 +12:00
Sean Harvey
13e632d053 Merge pull request #1867 from tractorcow/3.1-urlsegmentfilter-fixes
BUG Fixes issue with "+" characters in url.
2013-05-20 00:36:18 -07:00
Damian Mooyman
6e0e3564e1 NEW Added beforeExtending, afterExtending, and beforeUpdateCMSFields to allow user code better control over interaction with extending methods 2013-05-16 10:34:45 +12:00
Damian Mooyman
de41a2a75e BUG Fixes issue with '+' characters in url. 2013-05-10 16:16:31 +12:00
Ingo Schommer
3b02d22989 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	dev/CsvBulkLoader.php
2013-05-09 10:34:20 +02:00
Marcus Dalgren
7f871fa18b Fix orphaned records when running update
When DataObject::update() is run with relation fields and the relationship
is new the relationship ID was not set on the DataObject. This patch fixes
this. Fixes issue 6195 in open.silverstripe.org.
2013-05-09 03:53:53 +02:00
Ingo Schommer
1a52a51195 DataObject->duplicate() test
Advanced relationship copying is already tested further down,
but doesn't cover the same basics. Triggered by a CMS bug
which turned out to be unrelated (https://github.com/silverstripe/silverstripe-cms/issues/689)
2013-05-07 10:06:15 +02:00
Sean Harvey
f1a4e7203e BUG Fixing queries on non-existent table breaking archive site
With a many to many relation, e.g. SiteTree_MyRelation, and listing
them in your template then adding ?archiveDate=x in the URL, a SQL
error is shown because Versioned::augmentSQL() tries to query the
non-existent table "SiteTree_MyRelation_versions" assuming there's
versioning setup, but there isn't.
2013-05-07 12:34:46 +12:00
Damian Mooyman
4d5bd451bb Updated HTMLTextTest to test for correct testFirstSentence, specifically a past failing test case. fixes #1422 2013-05-01 16:03:58 +12:00
Nico Haase
5fbb3da661 Enhanced tests for regeneration of images and a bugfix for images that were cached in multiple steps 2013-04-24 10:27:20 +02:00
Sam Minnee
9ba26a04c4 Added test for lazy-loading edge-case in Money field. 2013-04-22 11:50:57 +12:00
Ingo Schommer
0343a77d30 Merge remote-tracking branch 'origin/3.1' 2013-04-11 11:42:04 +02:00
Sam Minnée
a6929f11b2 Merge pull request #1185 from chillu/pulls/augment-lazy-versioned
Versioned lazy loading fixes (backport from 3.1)
2013-04-08 16:04:50 -07:00
Ingo Schommer
01f46d039f NEW Enforce max node counts to avoid excessive resource usage
Rendering potentially 1000s of nodes can exceed the CPU and memory constraints
of a normal PHP process, as well as the rendering capabilities of browsers.
Set a hard maximum for the renderable nodes, deferring to a "show as list" action
in the main CMS tree. For TreeDropdownField, we don't have the list fallback option,
so ask the user to search for the node title instead.

Also makes both the "node_threshold_total" and "node_threshold_leaf" values configurable
2013-04-09 10:24:18 +12:00
Sam Minnée
88d77db9e0 Merge pull request #1318 from tractorcow/3.1-api-image-resampling-compatible
API Better detection and prevention of image resampling
2013-04-08 15:18:55 -07:00
Nico Haase
8908a6bcd7 This is a fixed version for RegenerateCachedImagesTask (former FlushGeneratedImagesTask) such that it regenerates images instead of silently removing them and breaking existing pages
The pull request also contains some enhancements and fixes to the corresponding testcases.

Fixes #318
2013-04-06 15:56:27 +02:00
Ingo Schommer
2bc273e2a8 Consistently quote DataObject::$default_sort
Strictly speaking, no longer required since we auto-quote simple
field names in DataQuery now, but since the majority of sorts in core is
already quoted we should stay consistent.
2013-04-03 12:11:53 +02:00
Ingo Schommer
e9d55fcaf9 Correctly quote SQL in SQLQueryTest (fixes Postgresql) 2013-04-03 12:11:52 +02:00
Ingo Schommer
b9f628146a Fixed query quoting in SQLQueryTest 2013-04-03 10:48:55 +02:00
Andrew Short
5ec85d06f6 API: Don't allow dots in URL segments 2013-03-30 19:47:17 +11:00
Ingo Schommer
3334eafcb1 API Marked statics private, use Config API instead (#8317)
See "Static configuration properties are now immutable, you must use Config API." in the 3.1 change log for details.
2013-03-24 17:20:53 +01:00
Damian Mooyman
dd6aaaf484 ENHANCEMENT Additional image generation functions now self-determine if a modification to the underlying image backend is necessary before generating additional image files. 2013-03-21 12:15:28 +13:00
Ingo Schommer
61dbafc4e5 Merge pull request #1292 from tractorcow/3.1-validationexception-fixes
BUG Issue with ValidationException having blank ValidationResult
2013-03-20 03:55:42 -07:00
Andrew Short
b8a51c3792 Merge branch '3.0' into 3.1 2013-03-19 22:27:09 +11:00
Ingo Schommer
b416e50bff Fixed deprecations 2013-03-19 10:38:14 +01:00
Ingo Schommer
3932241844 Removed test for deprecated NegationFilter 2013-03-19 10:13:57 +01:00
Ingo Schommer
dd6f33ab37 FIX Respect tree node limits, fix search result node display
- Renamed $minNodeCount to more accurate $nodeCountThreshold
- The $minNodeCount attribute wasn't properly respected
during actual querying, so SilverStripe would always traverse
the entire tree (and load all objects into memory),
before then marking nodes as "unexpanded", which prevents
them from actually being rendered.
- Fixes nodes on search results to be expanded by default
- Fixes nodes on search results to correctly ajax-expand
2013-03-19 00:05:14 +01:00
Damian Mooyman
cd27bf71fb BUG Enforced requirement that ValidationException::getResult() is expected to consistently produce a valid ValidationResult object. 2013-03-15 13:56:43 +13:00
Sam Minnée
362ca9b4d5 Merge pull request #1244 from silverstripe-rebelalliance/feature/config
Feature/config
2013-03-12 13:19:59 -07:00
Robert Curry
b9dc2dc650 Define getIDList on UnsavedRelationList
This is to fix a bug that caused CheckboxSetFields to throw an error
when trying to call this function when editing a new DataObject. This
occurred when using the advancedworkflow module.

Thanks to simonwelsh for the majority of the work on this fix.
2013-03-08 12:34:52 +13:00
ajshort
b537ee28a2 BUG: Fix ManyManyList->removeAll() when filters are applied to the query
In order to be cross-database compatible and support filters, the IDs to
delete must be retrieved in a sub-query.
2013-03-02 17:23:15 +11:00
Hamish Friedlander
80bd38e1e9 FIX DataObjectSchemaGenerationTest trying to modify config statics directly 2013-02-28 09:43:34 +13:00
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
jean
e2bf9649f3 FIX 7934 When lazy loading fields respect version of the record 2013-02-14 14:27:44 +01:00
Julian Seidenberg
f931b8d326 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:18:10 +01:00
Ingo Schommer
634c91c6ff Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	email/Mailer.php
2013-01-30 12:46:24 +01:00
Sam Minnee
1e1df8c43e BUGFIX: Improved detection of empty HTMLText fields. 2013-01-29 18:03:47 +01:00
Ingo Schommer
c11b3918fc Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/css/screen.css
	admin/scss/_style.scss
	core/PaginatedList.php
	email/Mailer.php
2013-01-21 11:14:57 +01:00
Ingo Schommer
27d2f75d9d Added test for DataList filters with array and modifiers (see #8162) 2013-01-15 01:11:35 +01:00
Ingo Schommer
3a1df46743 Merge pull request #1055 from stojg/bug-relField
BUG Calling DataObject::relField() on a object with an empty relation list
2013-01-11 07:09:55 -08:00
Ingo Schommer
9e82d8e857 Fixed line lengths 2013-01-11 09:59:33 +01:00
Sam Minnee
f4efaeefa7 FIX: Fix DataObject::get_one() when the classname is passed with improper casing. 2013-01-11 12:20:57 +13:00
g4b0
e53280c650 BUG SQLQuery::aggregate() with limit, groupBy and orderBy (fixes #8148) 2012-12-21 15:20:59 +01:00
Ingo Schommer
8ec3641e60 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/javascript/LeftAndMain.FieldHelp.js
	lang/en.yml
	model/URLSegmentFilter.php
2012-12-21 15:04:17 +01:00
Sean Harvey
aa3b358469 Adding test for SortColumn to SQLQueryTest
Mostly for the benefit of MSSQLDatabase which is having problems
with subselects and alias functions.
2012-12-20 15:52:46 +13:00
Stig Lindqvist
22efd3848e BUG Calling DataObject::relField() on a object with an empty relation list
This causes a 'Fatal error: Call to a member function hasMethod() on a non-object'.

This can happen when displaying a field in a gridfield on a belongs_to relationship.
2012-12-19 16:47:07 +13:00
Mateusz Uzdowski
d5a1c3d99a BUG SS has problems handling + in URLs. Filter them out.
+ has a special meaning in the URLs so overall it's a good idea to
strip them out. Otherwise they would need to appear in their ugly url
encoded form "%2B".

Refer: http://open.silverstripe.org/ticket/7929
2012-12-18 09:44:47 +01:00
Damian Mooyman
6aa16e1f01 BUG Test case for versioned now correctly checks IDs returned from Versioned::get_including_deleted
BUG Issue with deleted records not being queried properly.
API DataQuery::expressionForField no longer requires a second parameter. Rather the query object is inferred from the DataQuery itself. This should improve consistency of use of this function.
2012-12-17 17:15:26 +13:00
Ingo Schommer
e6bf19928f Less far-future date assertions, seems to throw off some PHP installs
Apparently not all PHPs (Travis) are build to last a 100 years,
who would've thought ;)
2012-12-14 11:25:24 +01:00
Ingo Schommer
d13c53fda6 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	tests/model/DataQueryTest.php
2012-12-14 10:57:28 +01:00
Hamish Friedlander
27113f82c3 API Make DataList and ArrayList immutable
In 3.0 there was some confusion about whether DataLists and ArrayLists
were mutable or not. If DataLists were immutable, they'd return the result, and your code
would look like

  $list = $list->filter(....);

If DataLists were mutable, they'd operate on themselves, returning nothing, and your code
would look like

 $list->filter(....);

This makes all DataLists and ArrayList immutable for all _searching_ operations.
Operations on DataList that modify the underlying SQL data store remain mutating.

- These functions no longer mutate the existing object, and if you do not capture the value
returned by them will have no effect:

  ArrayList#reverse
  ArrayList#sort
  ArrayList#filter
  ArrayList#exclude

  DataList#dataQuery (use DataList#alterDataQuery to modify dataQuery in a safe manner)
  DataList#where
  DataList#limit
  DataList#sort
  DataList#addFilter
  DataList#applyFilterContext
  DataList#innerJoin
  DataList#leftJoin
  DataList#find
  DataList#byIDs
  DataList#reverse

- DataList#setDataQueryParam has been added as syntactic sugar around the most common
cause of accessing the dataQuery directly - setting query parameters

- RelationList#setForeignID has been removed. Always use RelationList#forForeignID
when querying, and overload RelationList#foreignIDList when subclassing.

- Relatedly,the protected variable RelationList->foreignID has been removed, as the ID is
now stored on a query parameter. Use RelationList#getForeignID to read it.
2012-12-14 13:30:35 +13:00
Ingo Schommer
c6b1d4aa6b API Storing alternative DB name in cookie rather than session
Session is not initialized by the time we need to use
the setting in DB::connect(). Cookie values get initialized
automatically for each request.

Tightened name format validation to ensure it can only
be used for temporary databases, rather than switching
the browser session to a different production database.

Encrypting token for secure cookie usage.
Added dev/generatesecuretoken to generate this token.
Not storing in YML config directly because of web access issues.
2012-12-13 23:21:48 +01:00
Ingo Schommer
7e4629073a NEW Date->Ago() with "less than a minute" support 2012-12-13 19:01:27 +01:00
Ingo Schommer
2e9b5e9221 Merge branch 'orm-join-bug' of git://github.com/stojg/sapphire into stojg-orm-join-bug 2012-12-12 15:53:19 +01:00
Sam Minnée
b618909220 Merge pull request #1007 from simonwelsh/indent-sniff
Add codesniffer that ensures indentation is with tabs
2012-12-11 20:46:47 -08:00
Simon Welsh
b0121b541c Add codesniffer that ensures indentation is with tabs. 2012-12-12 17:33:31 +13:00
Ingo Schommer
6571c17992 Merge remote-tracking branch 'origin/3.0' 2012-12-11 17:16:19 +01:00
Ingo Schommer
e8fbfc0bd1 NEW FixtureFactory separated out from YamlFixture
Enables more generic use of the fixture facilities
without dependency on the YAML format, for example
when creating fixtures from Behat step definitions.

Note: The YamlFixture class needs to be created via
Injector::inst()->create('YamlFixture') now,
direct instantiation is no longer supported.
2012-12-11 17:06:27 +01:00
Simon Welsh
fc5dd2994c Add codesniffer that ensures indentation is with tabs. 2012-12-12 00:12:11 +13:00
Andrew O'Neil
9d74c99e08 BUGFIX: ArrayList now discards keys of the array passed in and keeps the numerically indexed array sequential.
This fixes FirstLast and EvenOdd in templates, and makes ArrayList more consistent, as several methods already discarded the keys.
2012-12-11 10:12:00 +01:00
stojg
efa9ff9b08 API: Queries added by DataList::addInnerJoin() and DataList::leftJoin() come after the base joins, not before.
This bug will surface when using the ORM and adding an join to DataList
where a DataObject inherits another DataObject.

If you for example want to restrict the number of pages that only have a
related Staff object:

    $list = DataList::create('Page')
		->InnerJoin('Staff', '"Staff"."ID" = "Page"."StaffID");

This will create a SQL query where the INNER JOIN is before the
LEFT JOIN of Page and SiteTree in the resulting SQL string. In MySQL
and PostgreSQL this will create an invalid query.

This patch solves the problem by sorting the joins.
2012-12-11 11:04:29 +13:00
Ingo Schommer
fa84c2d705 Merge remote-tracking branch 'origin/3.0' 2012-12-10 17:50:43 +01:00
Simon Welsh
aadefbb641 Sort lists that check ordering of results
These tests would randomly fail, mostly on Postgres, as the result
is an unordered set, not the ordered set expected.
2012-12-07 08:45:52 +13:00
Ingo Schommer
a108f67476 Merge pull request #922 from simonwelsh/rellist-presave
NEW: Allows setting of has_many and many_many relations before writing
2012-12-04 01:25:15 -08:00
Ingo Schommer
fa2057bcd9 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	search/FulltextSearchable.php
2012-11-30 14:25:06 +01:00
Ingo Schommer
3f67404a8a Revert "BUGFIX: ArrayList now discards keys of the array passed in and keeps the numerically indexed array sequential."
This reverts commit b6017a7c90.
It breaks SelectionGroup, and its most prominent usage,
the "add page" dialog.
2012-11-30 14:24:03 +01:00
Simon Welsh
bbc4443af7 NEW: Allows setting of has_many and many_many relations before writing
Adds a new wrapper list, UnsavedRelationList, that maintains the relations until
writing, where it is converted into the correct RelationList.
2012-11-28 09:37:08 +13:00
jean
fbfff8df28 FIX 7934 When lazy loading fields respect version of the record 2012-11-27 17:31:45 +01:00
Ingo Schommer
15a687f1e7 Merge remote-tracking branch 'origin/3.0' 2012-11-23 15:31:08 +01:00
Ingo Schommer
aa72425e84 Fixed PHPUnit assertions for incomplete tests in core
Avoid PHPUnit throwing "test didn't run any assertions"
notices in PHP. If nothing else, it keeps test output
looking less broken by default, making it more likely
that actual errors do get noticed.
2012-11-23 15:16:39 +01:00
Ingo Schommer
c55c7c33f8 Merge branch '3.0'
Conflicts:
	admin/code/CMSProfileController.php
	composer.json
	tests/model/DataObjectTest.php
2012-11-22 23:51:28 +01:00
Damian Mooyman
76c63fe4a4 BUG Fixed issue with SQLQuery::lastRow crashing on empty set. Added test cases for lastRow and firstRow.
Quoted table / column names to make test cases work in postgres

BUG Fixed issue with SQLQuery::lastRow crashing on empty set. Added test cases for lastRow and firstRow.

Quoted table / column names to make test cases work in postgres

Merge branch '3.0-sqlquery-lastrow-fix' of github.com:tractorcow/sapphire into 3.0-sqlquery-lastrow-fix
2012-11-16 13:27:51 +13:00
Andrew O'Neil
b6017a7c90 BUGFIX: ArrayList now discards keys of the array passed in and keeps the numerically indexed array sequential.
This fixes FirstLast and EvenOdd in templates, and makes ArrayList more consistent, as several methods already discarded the keys.
2012-11-16 09:39:01 +13:00
Sean Harvey
d038cd7a65 Removing deprecated tests 2012-11-15 14:43:15 +13:00
Sean Harvey
88366bf3c8 Adding additional test for populateDefaults() in DataObjectTest 2012-11-07 11:28:36 +13:00
Andrew O'Neil
fdea5321c7 APICHANGE: add_extension() is now called directly on the class, instead of on Object 2012-11-07 11:07:55 +13:00
Justin Martin
d24b586830 NEW: Enable multiple image manipulation back-ends on the Image class 2012-11-03 19:38:09 -07:00
Simon Welsh
123a742872 Merge pull request #920 from TheFrozenFire/feature-SSListEach
API: Add new method "each" to SS_List
2012-11-03 02:10:23 -07:00
Simon Welsh
5a793990d8 Merge pull request #921 from TheFrozenFire/bug-DataObjectCreated
BUG: DataObject::write overwrites Created on first write
2012-11-03 02:08:35 -07:00
Justin Martin
f2a709d849 BUG: DataObject::write overwrites Created on first write 2012-11-02 20:37:17 -07:00
Justin Martin
26e5afc0c4 NEW: Add new method "each" to SS_List and core implementors thereof 2012-11-02 18:21:02 -07:00
Simon Welsh
8a0f234acf Merge pull request #870 from chillu/pulls/datalist-filterany
NEW DataList->filterAny()
2012-11-02 16:17:48 -07:00
Simon Welsh
bedb579b07 Merge branch '3.0' 2012-10-23 15:21:20 +13:00
Mateusz Uzdowski
8eb0fa91bd API Add the ability to query if the schema update is in progress.
The specific situation where this is useful is where populateDefaults on
DataObjects needs to query the database. This will break the dev/build
when it tries to create the object via singleton - the query will not be
able to be executed if the table is not there or its schema has changed.

For an example of such use case see Translatable::populateDefaults.
2012-10-17 11:45:21 +13:00
Ingo Schommer
5be3a4c35a NEW DataList->filterAny() 2012-10-12 15:24:25 +02:00
Simon Welsh
c49f7566c3 API Allow use of :not, :nocase and :case modifiers to SearchFilters.
More modifiers can be added to each class as desired.
2012-10-10 10:26:47 +13:00
Simon Welsh
2faf7d112d API Allow using SearchFilters in DataList::exclude() 2012-10-09 14:47:22 +13:00
Ingo Schommer
fb5e488103 Line length fixes 2012-10-03 18:11:31 +02:00
Ingo Schommer
56f7ce1dcf Merge remote-tracking branch 'origin/3.0'
Conflicts:
	control/Cookie.php
	control/Director.php
	control/HTTPResponse.php
	model/Database.php
	model/MySQLDatabase.php
	model/SQLQuery.php
	view/Requirements.php
	view/SSViewer.php
2012-10-03 16:16:19 +02:00
Ingo Schommer
ef81318aea BUG Retaining join extraFields on ManyManyList->add() 2012-10-03 14:58:28 +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
Simon Welsh
6d696d506f API Allow subgroups in the WHERE clause of a Data/SQLQuery
Adds three extra methods to Data/SQLQuery query that allow for starting
a disjunctive subgroup, a conjunctive subgroup and for ending a subgroup.

Database::sqlWhereToString() now builds up the WHERE clause one by one
instead of with a straight implode. Uses a stack to know which conenctive
to use.
2012-09-21 14:59:47 +12:00
Simon Welsh
1e629f4585 Merge branch '3.0'
Conflicts:
	control/Cookie.php
	control/Director.php
	dev/Profiler.php
	view/Requirements.php
2012-09-21 14:56:56 +12:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Sam Minnée
651f45e0e4 Merge pull request #782 from tractorcow/3.0-index-generation-fixes
FIXED: Generation of table indexes
2012-09-16 23:43:17 -07:00
Sean Harvey
9c2be0f025 Merge branch '3.0' 2012-09-17 15:16:52 +12:00
Damian Mooyman
0e997d0285 FIXED: Cleaned up test case, made sure it initialised consistently and correctly
ADDED: Extra assertions to test case to ensure that different expressions of the same index definition were treated as non-changes.
2012-09-14 14:55:07 +12:00
Ingo Schommer
99b1bc672b Don't rely on hardcoded IDs in DataListTest (breaks postgres) 2012-09-12 10:51:40 +02:00
Damian Mooyman
30e15d11a7 FIXED: Generation of tables with fulltext indexes now no longer incorrectly thinks that all fulltext indexes have changed.
ADDED: Test cases correctly checking for changes (and no changes) to the data model for both fields and indexes.
FIXED: References to indexes throughough the code that probably should have quoted field names. This prevents a lot of 'spam' during dev build. This includes an updated FulltextSearchable test case.
2012-09-11 12:53:08 +12:00
Simon Welsh
78fdcc580b API DataList->leftJoin()/innerJoin() args no longer escaped
The table name in the join was being escaped, though table
names aren't escaped anywhere else. This breaks
namespaced classes, which rely on unescaped backslashes.
2012-08-29 11:54:42 +02:00
Simon Welsh
9d2686130c Merge cd61b61 from master 2012-08-29 11:18:41 +12:00
Sam Minnee
c2afca2cd8 Merge branch '3.0' 2012-08-28 16:08:57 +12:00
Simon Welsh
e159a68f89 FIX Removes version checking for LSB in Object::static_lookup()
Late static binding was added in PHP 5.3, not 5.4. As such, the check for 5.4
and then fallback to Reflection isn't needed.
2012-08-23 17:51:29 +12:00
Simon Welsh
cd61b61a84 FIX Use array_intersect() with expected values so that the order matches.
The values in $values aren't returned in any order, so this test can randomly fail. This
changes the check from expected = $values to $values \cap expected = $value. PHP's array_intersect
maintains the keys of the first array, so order is preserved. The intersect also guarentees that the
only accepted values are the expected ones.
2012-08-23 17:36:59 +12:00
Sam Minnee
f6334dd017 Added default sort to test data for better cross-db performance. 2012-08-23 12:38:33 +12:00
Damian Mooyman
89728acece UPDATED: Improved get_all_versions test case to test versions in the middle of version updates. 2012-08-20 13:48:48 +12:00
Damian Mooyman
56fe7f881a REMOVED: Unnecessary publish actions from test cases
ADDED: Test case for get_all_versions
2012-08-20 13:44:56 +12:00
Damian Mooyman
0f09305e3d FIXED: Issue where temporary table would cause unpredictable behaviour. Temporary table functionality was substituted with subqueries in each use case.
ADDED: Test case for version archive functionality.
2012-08-20 13:24:28 +12:00
Hamish Friedlander
b7691077cf API Prep forForeignID for immutability in 3.1 per 7673 2012-07-23 10:31:47 +12:00
Mateusz Uzdowski
70dcb55fe0 BUG Use prepStringForDB consistently across the framework.
Also remove a line from DBFieldTest, it's redundant with the previous
line.

Ref: os7229
2012-07-17 14:27:58 +12:00
Saophalkun Ponlu
c555256890 BUGFIX: PaginatedList::getIterator() trims the original list to the page lenght when the source list is DataList 2012-07-15 01:02:49 +12:00
Ingo Schommer
55c348d01b Merge pull request #621 from chillu/pull/dbdatetimetest-offsets
Skip tests rather than throw PHP error on wrong offests in DBDatetimeTest
2012-07-06 02:34:19 -07:00
Ingo Schommer
64357a4522 Merge branch '3.0'
Conflicts:
	admin/css/screen.css
	admin/scss/_forms.scss
	docs/en/changelogs/3.0.0.md
2012-07-05 18:01:09 +02:00
Ingo Schommer
664903433d Mark DBDatetimeTest skipped on wrong offsets, rather than error out.
While well-intentioned, this test keeps causing problems
due to wrong timezone settings in test mode.
It shouldn't completely abort test execution,
since its more of an environment sanity check than a failed test.

Refactored to mark test skipped (regardless of offset, as long as
its greater than 5 seconds). And skipping tests altogether
on SQLite3 with new supportsTimezoneOverride() check.
SapphireTest->setUp() sets the PHP timezone to UTC (see 59547745),
but SQLite doesn't support this for a DB connection.
Since changing it on a global UNIX system level is infeasible,
the tests need to be skipped.
2012-07-05 16:20:18 +02:00
Simon Welsh
cd0a1ff623 FIX DataQuery::applyRelation was returning the base class.
If the applyRelation() was passed a relation that went to a class with a parent
class with a database table, applyRelation would return the name of the parent
class, rather than the class the relation was actually too.
2012-06-29 21:54:48 +12:00
Will Rossiter
4ee709e88d FIX: ensure limits to SQLQuery are passed as positive values 2012-06-29 19:40:28 +12:00
Sam Minnee
b654b95472 BUGFIX: Allow Versioned::get_latest_version() and Version::get_version() to return results if the classname has changed.
Without this bugfix, if you had a Page that used to be a SiteTree, and you tried to use Versiond::get_version() or Versioned::get_latest_version() to return the older SiteTree version, nothing would be returned, because the results were being filtered by ClassName.  This caused bugs in the history panel for certain combinbations of page classname alteration.
2012-06-28 13:00:40 +12:00
Simon Welsh
070ba56104 FIX DataQuery::applyRelation was returning the base class.
If the applyRelation() was passed a relation that went to a class with a parent
class with a database table, applyRelation would return the name of the parent
class, rather than the class the relation was actually too.
2012-06-25 11:34:02 +12:00
Sam Minnee
fd881d6a4c MINOR: Add test using a namespaced class for DataList::filter() and DataList::exclude() 2012-06-25 10:43:37 +12: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
4aa4cd2c28 Merge branch '3.0'
Conflicts:
	admin/scss/ie7.scss
2012-06-22 17:20:07 +12:00
Sam Minnee
1b5768975c BUG: exclude() clears previously selected filters() (Trac #7529)
This bug was caused by the fact that SQLQuery::whereAny() removed existing filters.  In line with addWhere() and setWhere(), I split this into addWhereAny() and setWhereAny().  Strictly speaking, this drops the method SQLQuery::whereAny(), but it was really just an internal function for exclude, and so I think that's acceptable.
2012-06-22 16:31:29 +12:00
Andrew Short
77d712202c ENHANCEMENT: Add method to disable automatic limiting on PaginagedLists.
In some circumstances a custom generated list will already only contain
the items for the current page. The automatic limiting will then limit
the already limited list, breaking pagination. This allows you to disable
automatic limiting so all items are shown regardless of the current page.
2012-06-21 21:21:34 +02:00
Sean Harvey
b04c199064 MINOR Fixing additional cases where DataList needs to be returned correctly when filtering 2012-06-15 16:09:40 +12:00
Sam Minnee
80941ef658 MINOR: Fixed unit test to respect idempotent semantics of DataList filter() and sort(). 2012-06-15 13:25:23 +12:00
Sean Harvey
e1ebb4a8eb MINOR Fixing broken test for PostgreSQL 2012-06-12 14:54:19 +12:00
Ingo Schommer
cb8b11812c API CHANGE Moved RestfulServer into its own module at https://github.com/silverstripe/silverstripe-restfulserver (fixes #7282) 2012-06-04 10:21:29 +02: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
23a3872e34 MINOR Fixed regression in DataListTest 2012-05-28 21:17:40 +12:00
Sean Harvey
c3eabffcb9 MINOR Use shorthand {class}::get() syntax instead of DataList::create()
in core code.
2012-05-28 21:13:42 +12:00
Yuki Awano
c04b01fc2a BUGFIX Changed Date.php and DateTime.php to use DateTime->Format instead of strtotime to handle extended dates on 32bit environment(fixes #7311) 2012-05-18 16:09:38 +09: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
56e75b4486 MINOR Revert changes for 5.4 2012-05-10 14:11:33 +12:00
Sean Harvey
7dcfdb05fa MINOR Fixing broken test on PHP 5.4 2012-05-10 13:40:35 +12:00
Sean Harvey
b1e17578c7 API CHANGE Removed assertType() and assertEmpty() workarounds. Use assertInstanceOf()
instead of assertType(), assertEmpty() is available in PHPUnit 3.5+.
PHPUnit 3.4 is no longer supported, so please upgrade your version to
work.

MINOR Removed FullTestSuite which was a workaround for PHPUnit but not
used.
2012-05-09 23:05:39 +12:00
Ingo Schommer
8281678d4c BUGFIX Urlencode paths in URLSegmentFilter when $allowMultibyte=true to avoid creating invalid URLs (and breaking assumptions based on ascii-only URLs, such as static publishing filename creation) 2012-05-08 15:32:15 +02:00
Sean Harvey
bb9ffd2eb1 ENHANCEMENT SQLQuery::selectField() returns a SQLQuery object to be
consistent with how the other add/set methods work.
MINOR Fixing DbDatetimeTest to use the correct selectField to select an
alias
2012-05-07 16:59:42 +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
a79032c57f MINOR Fixing broken test on Windows 2012-05-04 22:48:47 +12:00
Sean Harvey
450bc258d8 MINOR Fixing broken SQLQueryTest cases 2012-05-03 13:09:50 +12:00
Sam Minnee
2207e3d978 API CHANGE: Add SQLQuery::prepareSelect(), to further remove the need for direct property access.
API CHANGE: Change the format of SQLQuery::$select to use aliases as keys.
2012-05-01 18:15:11 +12:00
Sam Minnee
a8e8a6060a BUGFIX: Fixed errors caused by complex raw SQL sort() calls. (#7236) 2012-05-01 18:15:08 +12:00
Sam Minnee
8661164c19 API CHANGE: Add SQLQuery::clearSelect(), SQLQuery::selectField() and SQLQuery::itemisedSelect() to make it easier for other subsystems to use SQLQuery without resorting to direct property access.
API CHANGE: Remove DataQuery::select() in place of DataQuery::selectField().
BUGFIX: Remove direct property access to SQLQuery::$select
2012-05-01 17:57:39 +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
Mateusz Uzdowski
6469d83569 API CHANGE: add a remote relation class getter to DataObject 2012-04-23 15:01:55 +12:00
Sean Harvey
a3e43171cf MINOR Fixed broken DataExtensionTest 2012-04-20 15:41:51 +12:00
Sam Minnee
8e48e6e231 API CHANGE: Allow <classname>::get(), eg, Member::get()->byID(5) 2012-04-20 14:58:24 +12:00
Will Rossiter
585417d141 Merge pull request #343 from halkyon/object_static_remove_deprecation
BUGFIX Remove calls to deprecated Object static methods, update ConfigTest
2012-04-19 14:41:45 -07:00
Sean Harvey
4cf8db3ee4 ENHANCEMENT Remove use of deprecated extraStatics in core files 2012-04-19 08:37:51 +12:00
Sean Harvey
ccb941ea9d BUGFIX Fixed places where Object::get_static() was being used. Replace
with Config system instead.
2012-04-18 23:55:37 +12:00
Sean Harvey
16e950cb6a MINOR Tidy up of code formatting in TestRunner
MINOR Fixing up old ObjectStaticTest and merging into ConfigTest
2012-04-18 23:29:54 +12:00
Mateusz Uzdowski
be97535b1e ENHANCEMENT: add an infinite-loop check as validation in Hierarchy (os4399)
Check only when the parent has changed - hierarchy traversal is
expensive operation, so we do it only when it is needed.
2012-04-18 10:50:35 +12:00
Sean Harvey
8949dfa691 ENHANCEMENT Replaced locations of sapphire with $ModulePath(framework) in templates, based off Controller which implements TemplateGlobalProvider 2012-04-15 10:50:20 +12:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
3a6341a251 API-CHANGE sapphire folder can now be renamed. 2012-04-15 10:50:19 +12:00
Simon Welsh
f8082e4814 MINOR Add newline to end of files without one 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
Sean Harvey
b52c6b4f2b MINOR Testing extended dates (very far in the past and future) in
DateTest
2012-04-12 16:38:35 +12:00
Ingo Schommer
6cd91ff449 Merge pull request #299 from ajoneil/sapphire
---

Conflicts:
	forms/NumericField.php
2012-04-11 15:36:35 +02: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
Sean Harvey
6c9a3ba9f0 MINOR Fixed failing tests on pgsql 2012-04-10 17:07:41 +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
Sean Harvey
db65704639 MINOR Removed PHP 5.2 check in DateTest 2012-04-03 09:54:55 +12: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
Fred Condo
5954774530 BUGFIX: Use UTC consistently across all tests for date/time calculations
This ensures that tests will not pass or fail based on whether the test
machine is on NZ time.

This partially reverts df050eda5d, which has
already been merged. Instead of finding tests that use date calculations, we
are now setting the default time zone in SapphireTest so it will apply to the
whole test suite and any future tests.

Adjust expected values in certain tests for UTC, where the expected values had
previously been expressed in NZ time.

When creating a temp DB for test fixtures, create the DB connection with
timezone UTC.
2012-03-27 10:29:07 -07:00
Fred Condo
82bb12b5d3 MINOR: Explicitly declare $adapter in DbDatetimeTest 2012-03-27 10:28:10 -07: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
Sam Minnee
2576944a45 API CHANGE: Added DataObject::relField(), which pushes the "relation dot syntax" code of TableListField/GridField back to the model.
BUGFIX: Made DataObject::relObject() more flexible; allowable thanks to new ORM.
2012-03-24 14:04:08 +13:00
Sean Harvey
02c8019bb8 ENHANCEMENT Introduce Database::prepStringForDB(), used by
DBField::prepValueForDB() and StringField::prepValueForDB() to ensure
the field value is escaped correctly for the database. This means
databases like MSSQL can introduce an "N" prefix (marking text as
unicode to be saved correctly) by overloading the
prepStringForDB method. MySQL, PostgreSQL and SQLite3
operate as usual.
2012-03-20 21:20:35 +13:00
Sean Harvey
9b0009643a MINOR Added tests for SS_Map testing value method instead of value field 2012-03-15 17:42:42 +13:00
Fred Condo
df050eda5d BUGFIX: Correct testSetNullAndZeroValues() of DatetimeTest
- Code was assuming NZ time zone
- Set the default timezone to UTC for the test
- Correct the expected times for the epoch from noon to 00:00:00 UTC
2012-03-09 15:41:11 -08:00
Fred Condo
6e6890f689 Clarify failure messages to distinguish string and numeric zero tests 2012-03-09 15:41:11 -08:00
Hamish Friedlander
bc3f5ac329 BUGFIX: DataObjectTest needs its extensions to use the new static-on-object method to keep the ordering as it expects 2012-03-09 18:16:45 +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
Ingo Schommer
e4a6dd5850 Merge branch 'integration'
Conflicts:
	forms/gridfield/GridField.php
2012-03-08 20:25:21 +01:00
Ingo Schommer
51bae9e4a6 ENHANCEMENT Allowing to save ManyManyList with multiple foreign keys (e.g. required to add to an overloaded Group->Members() relationship) 2012-03-06 21:38:33 +01:00
Ingo Schommer
bb6d4c506e BUGFIX Fixed HasManyList and ManyManyList queries for relationships on new records (was returning all available records due to the SQL filtering ignoring ID=0) 2012-03-06 01:23:34 +01:00
Ingo Schommer
299bf8b9c6 Merge branch 'integration' 2012-03-02 20:53:06 +01:00
Ingo Schommer
e5c4b0a36b ENHANCEMENT Hierarchy->Breadcrumbs() 2012-03-02 20:46:19 +01:00
Sean Harvey
58d48583a9 ENHANCEMENT Date::DayOfMonth() now supports ordinal argument, so you can get somehing like "10th" or "2nd". Also supported in Date::RangeString 2012-02-24 20:38:11 +13:00
Sean Harvey
8fdc531345 BUGFIX Ensure Date and Datetime field types actually set NULL, false, empty string values correctly instead of "1970-01-01" which gets saved to the database instead of NULL.
BUGFIX Datetime::Nice() and casting methods return NULL when there is no value, to be consistent with Date::Nice() and so on
2012-02-24 20:37:58 +13:00
Sean Harvey
b1acd0520d MINOR Fixed tests using PostgreSQL as the database 2012-02-16 12:19:33 +13:00
Sean Harvey
f1a67a87de MINOR Fixed broken test using PostgreSQL as the database 2012-02-16 12:18:36 +13:00
Fred Condo
d370423825 Clean up trailing ?> per coding standard
All sapphire but the lang directory
2012-02-12 12:40:16 -08:00
Sean Harvey
c5452a7d4c MINOR Fixed broken tests in PostgreSQL 2012-02-11 14:40:39 +13:00
Sean Harvey
753bed5294 MINOR Fixed broken tests in PostgreSQL 2012-02-11 14:25:13 +13:00
Ingo Schommer
91b0c7b3ba Merge pull request #187 from silverstripe-scienceninjas/story/datadifferencetest-fix
MINOR DataDifferenceTest should not test whitespace
2012-02-10 15:43:40 -08:00
Sean Harvey
591dd4efa9 BUGFIX SS_Map::keys() and SS_Map::values() are identical, keys() should return the *keys* not the values #6818 2012-02-11 11:46:20 +13:00
Stig Lindqvist
03abde46be MINOR DataDifferenceTest should not test whitespace 2012-02-10 23:27:06 +01:00
Sam Minnee
d1a39b0b1a BUGFIX: Fixed operation of the onlyDeletedFromStage parameter of Hierarchy::liveChildren(). 2012-02-08 18:38:37 +13:00
Ingo Schommer
618d767dcb API CHANGE Removed XML escaping in DBField->LowerCase() and UpperCase(), in order to consistently allow SSViewer to deal with casting. Affects subclasses like Text, Varchar and HTMLText.
API CHANGE Deprecated StringField->Lower() and Upper(), use String->LowerCase() and UpperCase() instead. Moved methods from DBField to StringField.
2012-01-31 16:11:55 +01:00
Ingo Schommer
e1e5546ab6 BUGFIX Casting return values on text helper methods in StringField, Text, Varchar 2012-01-31 16:11:55 +01: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
Sam Minnée
9a1644f9e1 Merge pull request #148 from ajshort/pull-2
Added GroupedList
2012-01-06 16:19:20 -08:00
Ingo Schommer
b5421d9598 ENHANCEMENT Allowing custom attributes in (most) FormField implementations, which allows for HTML5 data attributes 2012-01-02 16:48:14 +01:00