Skip to content

Commit

Permalink
improve some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Feb 2, 2024
1 parent 5e06d88 commit e113f3c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ $girls = (clone $m)->addCondition('gender', 'F');
$notGirls = (clone $m)->addCondition('gender', '!=', 'F');
```

When you use 'in' or 'not in' you should pass value as array:
When you use 'in' or 'not in' you must pass value as array or DSQL expression:

```
$m = new Model_User($db, 'user');
Expand Down
4 changes: 2 additions & 2 deletions src/Persistence/Array_.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ private function seedDataAndGetTable(Model $model): Table
* @return array<mixed, array<string, mixed>>
*
* @deprecated TODO temporary for these:
* - https://github.com/atk4/data/blob/90ab68ac063b8fc2c72dcd66115f1bd3f70a3a92/src/Reference/ContainsOne.php#L119
* - https://github.com/atk4/data/blob/90ab68ac063b8fc2c72dcd66115f1bd3f70a3a92/src/Reference/ContainsMany.php#L66
* - https://github.com/atk4/data/blob/90ab68ac06/src/Reference/ContainsOne.php#L119
* - https://github.com/atk4/data/blob/90ab68ac06/src/Reference/ContainsMany.php#L66
* remove once fixed/no longer needed
*/
public function getRawDataByTable(Model $model, string $table): array
Expand Down
4 changes: 2 additions & 2 deletions src/Persistence/Array_/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function filter(Model\Scope\AbstractScope $condition)
{
if (!$condition->isEmpty()) {
// CallbackFilterIterator with circular reference (bound function) is not GCed
// https://github.com/php/php-src/commit/afab9eb48c883766b7870f76f2e2b0a4bd575786
// https://github.com/php/php-src/commit/fb70460d8e7593e32abdaaf8ae8849345d49c8fd
// https://github.com/php/php-src/commit/afab9eb48c
// https://github.com/php/php-src/commit/fb70460d8e
// remove the if below once PHP 8.1.3 (or older) is no longer supported
$filterFx = function (array $row) use ($condition): bool {
return $this->match($row, $condition);
Expand Down
4 changes: 2 additions & 2 deletions src/Persistence/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __destruct()
* Override this method and open handle yourself if you want to
* reposition or load some extra columns on the top.
*
* @param string $mode 'r' or 'w'
* @param 'r'|'r+'|'w+'|'c+'|'x+' $mode
*/
public function openFile(string $mode = 'r'): void
{
Expand Down Expand Up @@ -149,7 +149,7 @@ public function loadHeader(): void
*/
public function saveHeader(Model $model): void
{
$this->openFile('w');
$this->openFile('r+');

$header = [];
foreach (array_keys($model->getFields()) as $name) {
Expand Down
4 changes: 2 additions & 2 deletions src/Persistence/Sql/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ protected function _renderJoin(): ?string
* @param string|Expressionable $field Field or Expression
* @param mixed $cond Condition such as '=', '>' or 'not like'
* @param mixed $value Value. Will be quoted unless you pass expression
* @param string $kind Do not use directly. Use having()
* @param 'where'|'having' $kind Do not use directly. Use having()
* @param int $numArgs when $kind is passed, we can't determine number of
* actual arguments, so this argument must be specified
*
Expand Down Expand Up @@ -485,7 +485,7 @@ public function having($field, $cond = null, $value = null)
/**
* Subroutine which renders either [where] or [having].
*
* @param string $kind 'where' or 'having'
* @param 'where'|'having' $kind
*
* @return list<string>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/Sql/Sqlite/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private function _renderConditionBinaryCheckNumericSql(string $sql): string
protected function _renderConditionBinary(string $operator, string $sqlLeft, string $sqlRight): string
{
// TODO deduplicate the duplicated SQL using https://sqlite.org/forum/info/c9970a37edf11cd1
// https://github.com/sqlite/sqlite/commit/5e4233a9e48b124d4d342b757b34e4ae849f5cf8
// https://github.com/sqlite/sqlite/commit/5e4233a9e4
// expected to be supported since SQLite v3.45.0

/** @var bool */
Expand Down

0 comments on commit e113f3c

Please sign in to comment.