yiisoft / yiisoft/active-record
Get table name and alias from string with symbols
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 119
- Forks
- 38
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 1
Description
public function testGetTableNameAndAliasDoesNotTrimTrailingGarbage(): void
{
[$tableName, $alias] = TableNameAndAliasResolver::resolve(Customer::query()->from(['customer c!']));
$this->assertSame('customer c!', $tableName);
$this->assertSame('customer c!', $alias);
}
public function testGetTableNameAndAliasDoesNotExtractAliasFromSuffixAfterNewline(): void
{
$from = "ignored\ncustomer c";
[$tableName, $alias] = TableNameAndAliasResolver::resolve(Customer::query()->from([$from]));
$this->assertSame($from, $tableName);
$this->assertSame($from, $alias);
}
Doesn't it looks like a bug?
Originally posted by @Tigrov in #545
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced pull request diff and the TableNameAndAliasResolver tests, especially testGetTableNameAndAliasDoesNotTrimTrailingGarbage and testGetTableNameAndAliasDoesNotExtractAliasFromSuffixAfterNewline. Reproduce both inputs, determine the intended handling of symbols and newlines, and finish with tests that document and verify the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100