You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sql's foreign-table guard raises TypeError when its table is a TableIdentifier or aliased array #210
Sql::delete(), insert(), select() and update() throw when asked for a table other than the one Sql was constructed with (Sql.php#L46, #L75, #L102, #L121). Each passes $this->table to forForeignTable(string $table) (InvalidArgumentException.php#L114). Sql's table can be a TableIdentifier or an aliased array, and either raises a TypeError while building the exception.
#192 notes this as needing its own issue: "TableIdentifier has no __toString(), so Sql::forForeignTable($this->table) fatals when $this->table is a TableIdentifier".
Steps to Reproduce
new Sql($adapter, new TableIdentifier('users', 'app')), then ->select('other').
new Sql($adapter, ['u' => 'users']), then ->select('other').
Expected Behavior
PhpDb\Sql\Exception\InvalidArgumentException with a message naming the table: app.users for a TableIdentifier, and users AS u for an aliased array.
Actual behavior?
TypeError: PhpDb\Sql\Exception\InvalidArgumentException::forForeignTable(): Argument #1 ($table) must be of type string, PhpDb\Sql\TableIdentifier given
Activity