From 2ceaa1358bf2f9c4ca42bb2c6106d7ab76ef1ded Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Thu, 2 Nov 2023 14:26:15 +0100 Subject: [PATCH] fix(doc): namespace README --- README.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f4e0b71..f593fac 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ This library retrievies and optionally resolves foreign keys in a MySQL/MariaDB ## Install with composer ``` -composer require victorwesterlund/libinnodb-fk +composer require victorwesterlund/innodb-fk ``` ```php -use victorwesterlund\ForeignKeys\ForeignKeys +use victorwesterlund\ForeignKeys ``` # Example / Documentation @@ -25,7 +25,7 @@ Remember to pass the database name where InnoDB foreign keys are stored to the 4 ## Initialize `ForeignKeys` ```php -use victorwesterlund\ForeignKeys\ForeignKeys +use victorwesterlund\ForeignKeys $fk = new ForeignKeys($host, $user, $pass, ForeignKeys::DATABASE_NAME); ``` @@ -55,8 +55,14 @@ Retrieve rows from your database and pass them to `resolve_all()` as an array of ```php $rows = [ - "id" => 1, - "fk" => 2 + [ + "id" => 1, + "fk" => 2 + ], + [ + "id" => 2, + "fk" => 1 + ] ]; $rows = $fk->for("test", "bar")->resolve_all($rows); @@ -64,10 +70,19 @@ $rows = $fk->for("test", "bar")->resolve_all($rows); ```php // $rows will become [ - "id" => 1, - "fk" => [ - "id" => 2, - "value" => "hello world" + [ + "id" => 1, + "fk" => [ + "id" => 2, + "value" => "lorem ipsum dolor sit amet" + ] + ], + [ + "id" => 2, + "fk" => [ + "id" => 1, + "value" => "consectetur adipiscing elit" + ] ] ] ```