Skip to content

A bug fix#398

Open
myaaghubi wants to merge 1 commit intof3-factory:masterfrom
myaaghubi:patch-3
Open

A bug fix#398
myaaghubi wants to merge 1 commit intof3-factory:masterfrom
myaaghubi:patch-3

Conversation

@myaaghubi
Copy link
Copy Markdown
Contributor

No description provided.

@geniuswebtools
Copy link
Copy Markdown
Contributor

Providing the trailing slash is intended, it's not a bug. It's also mentioned in the documentation:
N.B.1: Like every F3 directory name, $dir must end with a trailing slash!

@myaaghubi
Copy link
Copy Markdown
Contributor Author

Let's have the mapper

$db=new DB\Jig('db/data/',DB\Jig::FORMAT_JSON);
$user=new DB\Jig\Mapper($db,'users');
$user=new DB\Jig\Mapper($db,'categories');
...

For a path like test/dir/db, it will make dbs like dbusers, dbcategories, which is not the responsibility of the mapper to fix the issue
The point is whether these small things should be fixed in (it is a bug) or out of the framework

@geniuswebtools
Copy link
Copy Markdown
Contributor

TLDR;
I'm simply saying, it's not a bug, and F3 is functioning as intended.

Longer Version:
I understand what you're saying, and you're right, it doesn't take much to make the code a little more developer friendly, however, the opinionated approach by F3 is clearly stated in the documentation, and we the developer MUST add the trailing slash any time we're working with the framework.

During the development stage of your app, when you realize you're Jig code is trying to access dbusers you need to correct the path to match what is expected by F3.

I'm working on a project with Jig now, and my DB reference is:
$f3->set('DB', new \DB\Jig(__DIR__ . '/jig/'));

Calling the mapper is as simple as:
$mapper = new \DB\Mapper\Jig($f3->get('DB'), 'user.json');
... and I'm not having any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants