Commit Graph

57 Commits

Author SHA1 Message Date
Geoff Munn
805337da0f BUGFIX: TeamComment table added to dataobjects list
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101220 467b73ca-7a2a-4603-9d3b-597d59a354a9
2011-02-02 14:19:04 +13:00
Sam Minnee
58cf79731b BUGFIX: Fixed potential data corruption issue when you are changing the class of a SiteTree subclass between two subclasses that share a fieldname.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97594 467b73ca-7a2a-4603-9d3b-597d59a354a9
2011-02-02 14:18:14 +13:00
Sam Minnee
63096cfefb API CHANGE: Don't generate TestOnly DataObjects in the database immediately; instead let test developers specify them in SapphireTest::$extraDataObjects.
API CHANGE: Added SapphireTest::resetDBSchema() (from r90054)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96734 467b73ca-7a2a-4603-9d3b-597d59a354a9
2011-02-02 14:18:04 +13:00
Andrew Short
a6562452ce MINOR: Fixed an incorrect join name being used in DataObjectTest.
From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90074 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-24 22:39:20 +00:00
Sam Minnee
709f162f13 Merge branch 'master' of git@github.com:sminnee/sapphire
From: Sam Minnee <sam@silverstripe.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90072 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-23 23:27:51 +00:00
Sam Minnee
9a83be9140 Merge branch 'master' of git@github.com:sminnee/sapphire
From: Sam Minnee <sam@silverstripe.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90071 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-23 23:26:10 +00:00
Sam Minnee
508d8d1215 MINOR: Added tests for many_many_extraFields (from r89013)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89210 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-15 22:40:38 +00:00
Sean Harvey
559bbfcca8 BUGFIX #4605 DataObject::newClassInstance() should repopulate it's defaults after changing to an instance of a different class, otherwise databases will complain of NULL values being written to columns that don't accept NULL values.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88956 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-14 06:35:45 +00:00
Andrew Short
d4fb917825 MINOR: Replaced usage of the deprecated SiteTree::get_by_url() with get_by_link().
From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88485 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-11 00:07:08 +00:00
Andrew Short
365b4784a9 FEATURE: Refactored ViewableData. The main changes are:
* Values are not always casted before being rendered into a template.
	* Casting information can by dynamically provided by $casting_properties, rather than being hardcoded to $casting and $db.
	* Removed unneeded ViewableData_Iterator - ArrayIterator is instead used.
	* Removed ViewableData_ObjectCustomised - now just uses ViewableData_Customised.
ENHANCEMENT: Added template and value methods to database fields.
MINOR: Added ViewableDataTest and extended DataObjectTest.

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88474 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-11 00:06:58 +00:00
Geoff Munn
5e15362a32 MINOR FIX: columns quoted properly + database agnostic version of RANDOM() created
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86505 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-09-17 00:04:09 +00:00
Sam Minnee
1e83a8b51e Ensure that DataObject->ClassName is set on object instantiation
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84981 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-21 05:02:31 +00:00
Sam Minnee
e0e12aeb40 BUGFIX: Reverted some changes from r84163 because they broke cases where you have two fields of the same name on different subclasses.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84789 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-19 04:34:28 +00:00
Sam Minnee
5790ddf708 API CHANGE: Added DataObject::is_composite_field() and DataObject::composite_fields() to efficiently keep track of which fields are composite.
API CHANGE: Deprecated DataObject::databaseFields() in favour of the static DataObject::database_fields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84161 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-11 08:49:52 +00:00
Sam Minnee
3c47db80d8 BUGFIX: Fixed other parts of core in response to the changing of MySQLDatabase to not inherit from object.
BUGFIX: Restored SiteTree::canView() functionality.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84068 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-08 04:23:05 +00:00
Ingo Schommer
883be66524 MINOR Fixed array/string notation in SapphireTest error messages
BUGFIX Using get_by_id() in DataObjectTest to grab deleted pages, to avoid error messages for missing fixtures from SapphireTest

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81313 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-07-08 02:54:01 +00:00
Ingo Schommer
f3959b038d API CHANGE Deprecated use of SapphireTest->fixture to access YML fixtures, please use gateway methods on SapphireTest instead (e.g. $this->objFromFixture() instead of $this->fixture->objFromFixture())
ENHANCEMENT Allowing multiple fixtures to be defined in SapphireTest::$fixture_file through array notation. 
BUGFIX Disabling DataObject validation in YamlFixture->saveIntoDatabase() instead of SapphireTest->setUp()
MINOR Adapted sapphire unit tests to deprecated $this->fixture usage

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81286 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-07-08 00:06:16 +00:00
Sam Minnee
02d4c34d6f MINOR: Fixed test to check for correct format of datetime value.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79320 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-16 03:21:13 +00:00
Sam Minnee
882a2cc533 MINOR: Added DataObjectTest for date field types.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79309 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-16 02:56:59 +00:00
Ingo Schommer
059aa76eec BUGFIX Fixed DataObjectTest->testHasDatabaseField(), test wasn't activated due to method naming. Fixed one assertion in this test which was the wrong way around.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78424 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-04 21:00:41 +00:00
Ingo Schommer
634ff10c89 BUGFIX Excluding names of CompositeDBFields from DataObject::custom_database_fields() and including the actually generated columns in CompositeDBField->compositeDatabaseFields(). This is necessary for DataObject->hasField() to work correctly and avoid generated queries with wrong column identifiers
BUGFIX Querying db() in DataObject->hasField() in addition to hasDatabaseField(), as the two might differ when CompositeDBFields are used
MINOR Added DataObjectTest->hasDatabaseField()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78235 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-02 03:43:45 +00:00
Ingo Schommer
dfa44c055c API CHANGE Changing DataObject::$changed to private visiblity. Please use getChangedFields() and isChanged()
ENHANCEMENT Added DataObject->isChanged() to detect if a field has been changed in this object instance
MINOR Changing call to CompositeDBField->compositeDatabaseFields() in DataObject->hasOwnDatabaseField()
BUGFIX Unsettig "Version" property in DataObject->getChangedField() to allow versioned to write a new version after a call to forceChange()
BUGFIX Introduced $markChanged in Money class
BUGFIX Casting Money->__toString() return value as string
MINOR Changing Member class to use new DataObject->isChanged() API
BUGFIX Using new $markChanged API for CompositeDBFields in DBField::create()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77893 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-27 00:09:23 +00:00
Will Rossiter
cf35533a78 EHANCHMENT: update the regular expression to disregard any underscores directly before a capital letter, as well as using the PCRE functions and adding a small test. PATCH: #4081
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77612 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-22 03:49:15 +00:00
Sean Harvey
7cb259f051 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77454 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-21 00:14:47 +00:00
Sam Minnee
ed06eb37c0 BUGFIX: Created Versioned's Version field as a proper Dataobject field.
API CHANGE: DataObject's internal $this->record array doesn't import null values, so that they don't get written back out.
API CHANGE: DataObject queries explicitly list columns, rather than using *.  This means that extraneous columns won't be included.
MINOR: Updated tests for db abstraction.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76372 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-07 06:00:50 +00:00
Sean Harvey
9b75cb1987 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75845 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-01 03:49:34 +00:00
Ingo Schommer
e55f3126fa BUGFIX Changed DataObject->newClassInstance() to only force changes if a differing classname was set. Setting ClassName property on new instance to trigger change detection (required for Translatable->onBeforeWrite())
BUGFIX Only force DataObject->forceChange() on fields which aren't already marked as changed

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75248 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-27 05:55:25 +00:00
Ingo Schommer
88359b1ba5 MINOR Added DataObjectTest->testPopulateDefaults()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73131 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-16 13:43:03 +00:00
Andrew O'Neil
635e2c3df6 Merged from 2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72453 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-04 03:44:11 +00:00
Sean Harvey
fa4c42d642 ENHANCEMENT Allow auto setting a many-to-many relation on ComplexTableField in the similar fashion of auto setting the foreign key for a one-to-many or one-to-many relation.
ENHANCEMENT Added DataObject::many_many_extraFields() for getting the many_many_extraFields fields for a component name on both sides of a many-to-many relation.
MINOR Added test for many_many_extraFields in DataObjectTest



git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71613 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-02-10 06:04:36 +00:00
Ingo Schommer
fcda174ea2 BUGFIX Fixed DataObject->merge() behaviour when merging grandchildren classes of DataObject - was using customDatabaseFields() to merge only the db fields on specific class. Changed to inheritedDatabaseFields() and added unit test.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@69801 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-01-07 01:25:43 +00:00
Sam Minnee
96c5be8252 Updating queries to be more DB agnostic
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66507 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-24 09:31:14 +00:00
Sam Minnee
93438e0be2 API CHANGE: Adding double quotes to all table and field references (a work in progress)
API CHANGE: DataObject::get()'s GROUP BY clause is only generated for MySQL as it needs to be improved for other databases to accept it.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66427 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-23 23:28:16 +00:00
Sam Minnee
a3d3fb65a9 Updated SQL queries to be ansi compatable
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66401 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-23 00:31:06 +00:00
Sam Minnee
12e62c6329 ENHANCEMENT: Change MySQLDatabase connection to operate in ANSI SQL mode, to ease the transition to DB abstraction
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66399 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-22 03:51:04 +00:00
Sam Minnee
c1d6e82248 API CHANGE: Removed manifest's dependency on database, by removing hastable information [17:47:04]
dquote> API CHANGE: Deprecate ClassInfo::ready() in favour of Security::database_is_ready()
dquote> API CHANGE: Create DataObject::has_own_table() to determine whether a DataObject has a table without looking at it.
dquote> API CHANGE: Exclude /tests/ directories from the manifest entirely except when tests are being run.
dquote> API CHANGE: Added ?usetestmanifest=1 flag to access the test manifest outside of test execution.
dquote> API CHANGE: Simplified Core.php manifest include to just call ManifestBuilder::include_manifest() - manifest takes care of its own cache file

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65385 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-06 04:51:25 +00:00
Ingo Schommer
09564b0132 API CHANGE Renamed DataObjectDecorator->loadExtraDBFields() to loadExtraStatics()
API CHANGE Renamed DataObjectDecorator->extraDBFields() to extraStatics()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65065 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-02 00:36:57 +00:00
Ingo Schommer
f06ae18409 API CHANGE Moved DataObject::get_by_url() to SiteTree::get_by_url()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65060 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-11-02 00:24:23 +00:00
Normann Lou
bff5942338 BUGFIX: Fix YamlFixture issues when specifying IDs
BUGFIX: Fix DataObject::write() with a specified ID and forceInsert to be true

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64798 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-28 01:23:41 +00:00
Ingo Schommer
b1b909103e BUGFIX Fixing DataObject->hasField() to find fields in inherited database tables by using hasDatabaseField().
BUGFIX Fixing DataObject->hasField() to detect dynamic getters by using hasMethod("get$fieldName") 
ENHANCEMENT Re-enabled two test cases in DataObjectSet as a result of the above fixes 


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63999 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-09 14:38:46 +00:00
Hayden Smith
fc2c16efdf DataObject::write now throws a ValidationException rather than calling user_error if the call to DataObject::validate fails. This allows the validation exception to be caught and handled by tests or other controllers.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63891 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-08 20:42:09 +00:00
Hayden Smith
634ed7b70c Merged from branches/nzct-trunk. Use 'svn log -c <changeset> -g' for full commit message. Merge includes stability fixes and minor refactor of TableListField and ComplexTableField.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63806 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-08 02:00:12 +00:00
Sam Minnee
cba8e71170 ENHANCEMENT: Added support for dot syntax to DataObject::update()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63493 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-02 00:45:13 +00:00
Sam Minnee
ca884b809d BUGFIX #2753: Couldn't have fields named the same as methods
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63432 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-01 00:55:25 +00:00
Ingo Schommer
0c4681eb81 MINOR todos for DataObjectTest
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63339 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-09-30 00:27:22 +00:00
Ingo Schommer
bf896a2cfd API CHANGE Deprecated DataObject->fieldExists() - please use hasField(), hasDatabaseField(), hasOwnTableDatabaseField()
ENHANCEMENT Added DataObject->hasOwnTableDatabaseField(), replaced legacy usage of fieldExists()
ENHANCEMENT Renamed cached static "fieldExists" to "_cache_hasOwnTableDatabaseField"
ENHANCEMENT Added DataObjectTest test cases for checking various field existence levels
API CHANGE Deprecated DataObject->listOfFields() - use custom code instead

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63337 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-09-30 00:20:30 +00:00
Sam Minnee
b92b2a5887 Fixed saving of blank values to the has_one relations on versioned objects
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60830 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-08-15 03:08:03 +00:00
Sam Minnee
26051153b8 Added tests for random queries
Improved DataObjectTest to use more helpful assertions

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60572 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-08-13 00:44:52 +00:00
Ingo Schommer
22023325cb BUGFIX Re-added test classes to DataObjectSet (lost during mergeback)
BUGFIX Removed duplicate GroupTest.php files


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60378 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-08-11 04:51:58 +00:00
Ingo Schommer
b6abd40783 (merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60330 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-08-11 03:03:52 +00:00