fix: remove reference to removed method flatten() from README

This commit is contained in:
Victor Westerlund 2024-09-25 13:21:36 +00:00
parent adc2fda90a
commit a614003033

View file

@ -108,24 +108,6 @@ $beverages = MySQL->for("beverages")->select(["beverage_name", "beverage_size"])
] ]
``` ```
## Flatten array to single dimension
If you don't want an array of arrays and would instead like to access each key value pair directly. Chain the `MySQL->flatten()` anywhere before `MySQL->select()`.
This will return the key value pairs of the first entry directly.
> **Note**
> This method will not set `LIMIT 1` for you. It is recommended to chain `MySQL->limit(1)` anywhere before `MySQL->select()`. [You can read more about it here](https://github.com/VictorWesterlund/php-libmysqldriver/issues/14)
```php
$coffee = MySQL->for("beverages")->limit(1)->flatten()->select(["beverage_name", "beverage_size"]); // SELECT beverage_name, beverage_size FROM beverages WHERE beverage_type = "coffee" LIMIT 1
```
```php
[
"beverage_name" => "cappuccino",
"beverage_size" => 10
]
```
# INSERT # INSERT
Chain `MySQL->insert()` anywhere after a [`MySQL->for()`](#for) to append a new row to a database table. Chain `MySQL->insert()` anywhere after a [`MySQL->for()`](#for) to append a new row to a database table.
@ -330,9 +312,6 @@ MySQL->limit(
): self; ): self;
``` ```
> **Note**
> You can also flatten to a single dimensional array from the first entity by chaining [`MySQL->flatten()`](#flatten-array-to-single-dimension)
## Passing a single integer argument ## Passing a single integer argument
This will simply `LIMIT` the results returned to the integer passed This will simply `LIMIT` the results returned to the integer passed