mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3'
This commit is contained in:
commit
918fb94396
@ -1442,9 +1442,9 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest published DataObject.
|
* Is the latest version of the object published?
|
||||||
*
|
*
|
||||||
* @return DataObject
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function latestPublished() {
|
public function latestPublished() {
|
||||||
// Get the root data object class - this will have the version field
|
// Get the root data object class - this will have the version field
|
||||||
|
@ -335,7 +335,7 @@ class HTTP {
|
|||||||
* @param string $etag
|
* @param string $etag
|
||||||
*/
|
*/
|
||||||
public static function register_etag($etag) {
|
public static function register_etag($etag) {
|
||||||
if (0 !== strpos('"')) {
|
if (0 !== strpos($etag, '"')) {
|
||||||
$etag = sprintf('"%s"', $etag);
|
$etag = sprintf('"%s"', $etag);
|
||||||
}
|
}
|
||||||
self::$etag = $etag;
|
self::$etag = $etag;
|
||||||
|
@ -43,6 +43,13 @@ We can represent multiple instances of them in `YAML` as follows:
|
|||||||
**mysite/tests/fixtures.yml**
|
**mysite/tests/fixtures.yml**
|
||||||
|
|
||||||
:::yml
|
:::yml
|
||||||
|
Team:
|
||||||
|
hurricanes:
|
||||||
|
Name: The Hurricanes
|
||||||
|
Origin: Wellington
|
||||||
|
crusaders:
|
||||||
|
Name: The Crusaders
|
||||||
|
Origin: Canterbury
|
||||||
Player:
|
Player:
|
||||||
john:
|
john:
|
||||||
Name: John
|
Name: John
|
||||||
@ -53,13 +60,6 @@ We can represent multiple instances of them in `YAML` as follows:
|
|||||||
jack:
|
jack:
|
||||||
Name: Jack
|
Name: Jack
|
||||||
Team: =>Team.crusaders
|
Team: =>Team.crusaders
|
||||||
Team:
|
|
||||||
hurricanes:
|
|
||||||
Name: The Hurricanes
|
|
||||||
Origin: Wellington
|
|
||||||
crusaders:
|
|
||||||
Name: The Crusaders
|
|
||||||
Origin: Canterbury
|
|
||||||
|
|
||||||
This `YAML` is broken up into three levels, signified by the indentation of each line. In the first level of
|
This `YAML` is broken up into three levels, signified by the indentation of each line. In the first level of
|
||||||
indentation, `Player` and `Team`, represent the class names of the objects we want to be created.
|
indentation, `Player` and `Team`, represent the class names of the objects we want to be created.
|
||||||
@ -88,6 +88,10 @@ Note that we use the name of the relationship (Team), and not the name of the
|
|||||||
database field (TeamID).
|
database field (TeamID).
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="hint" markdown='1'>
|
||||||
|
Also be aware the target of a relationship must be defined before it is referenced, for example the `hurricanes` team must appear in the fixture file before the line `Team: =>Team.hurricanes`.
|
||||||
|
</div>
|
||||||
|
|
||||||
This style of relationship declaration can be used for any type of relationship (i.e `has_one`, `has_many`, `many_many`).
|
This style of relationship declaration can be used for any type of relationship (i.e `has_one`, `has_many`, `many_many`).
|
||||||
|
|
||||||
We can also declare the relationships conversely. Another way we could write the previous example is:
|
We can also declare the relationships conversely. Another way we could write the previous example is:
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
* 2016-08-15 [ac26816](https://github.com/silverstripe/silverstripe-framework/commit/ac2681658ac33f6c060b7f5f881bd94eba92791b) Fix regression in url concatenation #4967 (Damian Mooyman)
|
* 2016-08-15 [ac26816](https://github.com/silverstripe/silverstripe-framework/commit/ac2681658ac33f6c060b7f5f881bd94eba92791b) Fix regression in url concatenation #4967 (Damian Mooyman)
|
||||||
* 2016-08-15 [ef85618](https://github.com/silverstripe/silverstripe-cms/commit/ef856185ab7a86f25fda718a88256c9e6e27a763) Fix regression in FormField casting (Damian Mooyman)
|
* 2016-08-15 [ef85618](https://github.com/silverstripe/silverstripe-cms/commit/ef856185ab7a86f25fda718a88256c9e6e27a763) Fix regression in FormField casting (Damian Mooyman)
|
||||||
|
* 2016-08-02 [af3412a](https://github.com/silverstripe/silverstripe-framework/commit/af3412a4c2f3088f5647df0e366b9e1b6c41faa4) fix to grid field loading wrong current page id when using multiple tabs (John Milmine)
|
||||||
* 2016-08-02 [cd80d50](https://github.com/silverstripe/silverstripe-framework/commit/cd80d501f9eb12d9aca3e65f742041b142ee659f) Fix unset config options returning isset() = true (Damian Mooyman)
|
* 2016-08-02 [cd80d50](https://github.com/silverstripe/silverstripe-framework/commit/cd80d501f9eb12d9aca3e65f742041b142ee659f) Fix unset config options returning isset() = true (Damian Mooyman)
|
||||||
* 2016-08-01 [7d0b8e6](https://github.com/silverstripe/silverstripe-framework/commit/7d0b8e6520a246bd20204613233a0a6ad0f19437) Fix permission checking code not correctly handling escaped SQL identifiers (Damian Mooyman)
|
* 2016-08-01 [7d0b8e6](https://github.com/silverstripe/silverstripe-framework/commit/7d0b8e6520a246bd20204613233a0a6ad0f19437) Fix permission checking code not correctly handling escaped SQL identifiers (Damian Mooyman)
|
||||||
* 2016-07-28 [6c37532](https://github.com/silverstripe/silverstripe-framework/commit/6c37532a7ae4877fe1eaff45f41ff9902d5cccee) Gridfield delete action back link (#5848) (Jono Menz)
|
* 2016-07-28 [6c37532](https://github.com/silverstripe/silverstripe-framework/commit/6c37532a7ae4877fe1eaff45f41ff9902d5cccee) Gridfield delete action back link (#5848) (Jono Menz)
|
||||||
|
@ -347,7 +347,14 @@ class DateField extends TextField {
|
|||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
// Don't validate empty fields
|
// Don't validate empty fields
|
||||||
if(empty($this->value)) return true;
|
if ($this->getConfig('dmyfields')) {
|
||||||
|
if (empty($this->value['day']) && empty($this->value['month']) && empty($this->value['year'])) {
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (empty($this->value)) {
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
|
||||||
// date format
|
// date format
|
||||||
if($this->getConfig('dmyfields')) {
|
if($this->getConfig('dmyfields')) {
|
||||||
|
@ -115,6 +115,21 @@ class DateFieldTest extends SapphireTest {
|
|||||||
|
|
||||||
$f = new DateField('Date', 'Date', 'wrong');
|
$f = new DateField('Date', 'Date', 'wrong');
|
||||||
$this->assertFalse($f->validate(new RequiredFields()));
|
$this->assertFalse($f->validate(new RequiredFields()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEmptyValueValidation() {
|
||||||
|
$field = new DateField('Date');
|
||||||
|
$validator = new RequiredFields();
|
||||||
|
$this->assertTrue($field->validate($validator));
|
||||||
|
$field->setConfig('dmyfields', true);
|
||||||
|
$this->assertTrue($field->validate($validator));
|
||||||
|
$field->setValue(array(
|
||||||
|
'day' => '',
|
||||||
|
'month' => '',
|
||||||
|
'year' => '',
|
||||||
|
));
|
||||||
|
$this->assertTrue($field->validate($validator));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidateArray() {
|
public function testValidateArray() {
|
||||||
|
Loading…
Reference in New Issue
Block a user