Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review of the Silverstripe CMS 5.2.0 changelog #482

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions en/02_Developer_Guides/00_Model/08_SQL_Select.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ Common Table Expressions are a powerful tool both for optimising complex queries
Older database servers don't support this functionality, and the core implementation is only valid for MySQL (though community modules may add support for other database connectors). If you are using this functionality in an open source module or a project that you can't guarantee the type and version of database being used, you should wrap the query in a condition checking if CTEs are supported. You can do that by calling [`DB::get_conn()->supportsCteQueries()`](api:SilverStripe\ORM\Connect\Database::supportsCteQueries()).

```php
if (DB::get_conn()->supportsCteQueries()) {
// Supports non-recursive CTE clause
} elseif (DB::get_conn()->supportsCteQueries(true)) {
if (DB::get_conn()->supportsCteQueries(true)) {
// Supports recursive CTE clause
} elseif (DB::get_conn()->supportsCteQueries()) {
// Supports non-recursive CTE clause
} else {
// No CTE support
}
Comment on lines -421 to 427
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change - with the old code, the elseif condition would never have been executed because if it doesn't support non-recursive queries it definitely doesn't support recursive ones.

Expand Down
4 changes: 2 additions & 2 deletions en/02_Developer_Guides/00_Model/09_Validation.md
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes here reflect the changes in the changelog for the same content

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ icon: check-square

## Validation using `symfony/validator` constraints {#symfony-validator}

The [`ConstraintValidator`](api:SilverStripe\Core\Validation\ConstraintValidator) class provides an abstraction around [`symfony/validator`](https://symfony.com/doc/current/components/validator.html), so you can easily validate values against symfony's validation constraints and get a [`ValidationResult`](api:SilverStripe\ORM\ValidationResult) object as a result.
The [`ConstraintValidator`](api:SilverStripe\Core\Validation\ConstraintValidator) class provides an abstraction around [`symfony/validator`](https://symfony.com/doc/current/components/validator.html), so you can easily validate values against symfony's validation constraints and get a [`ValidationResult`](api:SilverStripe\ORM\ValidationResult) object with the result.

```php
use SilverStripe\Core\Validation\ConstraintValidator;
Expand All @@ -20,7 +20,7 @@ use SilverStripe\Core\Validation\ConstraintValidator;
$result = ConstraintValidator::validate($valueToValidate, $constraint);
```

To test if a URL is valid, for example:
For example, to test if a URL is valid:

```php
use SilverStripe\Core\Validation\ConstraintValidator;
Expand Down
Loading
Loading