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

Fixed bug where it was not possible to specify the connection to use #66

Closed
wants to merge 4 commits into from
Closed

Conversation

LittleBigDev
Copy link

See issue #62
I added possibility to specify the connection (same as in core \Illuminate\Validation\Validator::validateUnique() method)

@@ -34,7 +34,7 @@ public function validateUniqueWith($attribute, $value, $parameters)
$parameters = array_map('trim', $parameters);

// first item equals table name
$table = array_shift($parameters);
list($connection, $table) = $this->parseTable(array_shift($parameters));
Copy link
Owner

Choose a reason for hiding this comment

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

There is no parseTable function defined.

Copy link
Author

@LittleBigDev LittleBigDev Jan 25, 2017

Choose a reason for hiding this comment

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

parseTable() is available from L5.1 and above. I fixed this.

Copy link
Author

Choose a reason for hiding this comment

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

Hello @felixkiss, are you requesting anything else about this PR ?

Copy link
Owner

Choose a reason for hiding this comment

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

Sorry for the delay. I will try to find time to review this in the near future. You can use your fork in the meantime. Cheers.

Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a test for the new behavior? (Asserting that setConnection is called with the correct parameter)

@@ -34,7 +34,7 @@ public function validateUniqueWith($attribute, $value, $parameters)
$parameters = array_map('trim', $parameters);

// first item equals table name
$table = array_shift($parameters);
list($connection, $table) = $this->parseTable(array_shift($parameters));
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a test for the new behavior? (Asserting that setConnection is called with the correct parameter)

@@ -19,12 +19,15 @@ public function setUp()
->andReturn($this->testDefaultErrorMessage);
$this->translator->shouldReceive('trans')
->andReturnUsing(function($arg) { return $arg; });
$this->translator->shouldReceive('get')
Copy link
Owner

Choose a reason for hiding this comment

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

We already mock translator->get() in line 17. Why is it necessary again?

@felixkiss
Copy link
Owner

@LittleBigDev I did a long overdue rewrite of the package, but I will look into rebasing this on master (and adding the new tests we need) in the next few days.

@LittleBigDev
Copy link
Author

Oh ok then. I had no time for this anyway. Thx a lot.

jankivi added a commit to jankivi/uniquewith-validator that referenced this pull request May 23, 2017
All the changes  have been borrowed from the following PR made by @LittleBigDev

felixkiss#66
@xyrintech
Copy link

Is this fixed?

@LittleBigDev
Copy link
Author

Yes, here : jankivi@a12d4e1

@webdevog
Copy link

still relevant for me...
would be good to have this fix because I have same issue with different database connections

@ReDev1L
Copy link

ReDev1L commented Feb 12, 2019

3 months passed, is there anything i could do to see this PR merged?

@felixkiss
Copy link
Owner

felixkiss commented Feb 12, 2019

@ReDev1L you can also test this new PR #99 I've created. The old PR was based on a version prior to complete rewrite, so I had to create a new one and never got around to it.

@felixkiss felixkiss closed this Feb 12, 2019
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.

5 participants