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

Adjust binary escaping #252

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
try new primaryKey guid.
vistart committed Jul 24, 2022
commit 699bc2e2e5a831bd228b587ddd79ca4dc9d4a62b
6 changes: 3 additions & 3 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
@@ -177,13 +177,13 @@ public function setUp()
$this->fkBinary2 = hex2bin(str_replace([' ', '-'], '', 'febf943f-15f9-cf2d-88fb-e77bbf73845f'));
$this->fkBinary3 = hex2bin(str_replace([' ', '-'], '', 'febf943f-15f9-cf2d-88fc-e77bbf73845f'));
$customer = new CustomerBinary();
$customer->setAttributes(['id' => $this->fkBinary1, 'email' => '[email protected]', 'name' => 'user1', 'address' => 'address1', 'status' => 1, 'profile_id' => 1], false);
$customer->setAttributes(['guid' => $this->fkBinary1, 'email' => '[email protected]', 'name' => 'user1', 'address' => 'address1', 'status' => 1, 'profile_id' => 1], false);
$customer->save(false);
$customer = new CustomerBinary();
$customer->setAttributes(['id' => $this->fkBinary2, 'email' => '[email protected]', 'name' => 'user2', 'address' => 'address2', 'status' => 1, 'profile_id' => null], false);
$customer->setAttributes(['guid' => $this->fkBinary2, 'email' => '[email protected]', 'name' => 'user2', 'address' => 'address2', 'status' => 1, 'profile_id' => null], false);
$customer->save(false);
$customer = new CustomerBinary();
$customer->setAttributes(['id' => $this->fkBinary3, 'email' => '[email protected]', 'name' => 'user3', 'address' => 'address3', 'status' => 2, 'profile_id' => 2], false);
$customer->setAttributes(['guid' => $this->fkBinary3, 'email' => '[email protected]', 'name' => 'user3', 'address' => 'address3', 'status' => 2, 'profile_id' => 2], false);
$customer->save(false);

}
7 changes: 6 additions & 1 deletion tests/data/ar/CustomerBinary.php
Original file line number Diff line number Diff line change
@@ -27,7 +27,12 @@ class CustomerBinary extends ActiveRecord
*/
public function attributes()
{
return ['id', 'email', 'name', 'address', 'status', 'profile_id'];
return ['id', 'guid', 'email', 'name', 'address', 'status', 'profile_id'];
}

public static function primaryKey()
{
return 'guid';
}

/**