Cannot insert data into table when schema is diferent of standard, but the entity has the schema annotation in @ORM\Table #5593

Closed
opened 2026-01-22 15:12:16 +01:00 by admin · 1 comment
Owner

Originally created by @ghost on GitHub (Jun 28, 2017).

Originally assigned to: @Ocramius on GitHub.

The problem could be simulated when command doctrine:fixture:load is executed, only the entity with standard schema has its data inserted.

/**
 * @ORM\Table(name="cnl.city", schema="cnl")
 */
class City extends Localization {

It is possible correct the problem, modifying the following code in the file lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php in line 3180.

public function getQuotedTableName($platform)
    {
        $tablename = isset($this->table['schema']) ? $this->table['schema'] .'.'. $this->table['name'] : $this->table['name'];

        return isset($this->table['quoted']) ? $platform->quoteIdentifier($tablename) : $tablename;
        //OLD RETURN -> return isset($this->table['quoted']) ? $platform->quoteIdentifier($this->table['name']) : $this->table['name'];
    }
Originally created by @ghost on GitHub (Jun 28, 2017). Originally assigned to: @Ocramius on GitHub. The problem could be simulated when command doctrine:fixture:load is executed, only the entity with standard schema has its data inserted. ``` /** * @ORM\Table(name="cnl.city", schema="cnl") */ class City extends Localization { ``` It is possible correct the problem, modifying the following code in the file lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php in line 3180. ``` public function getQuotedTableName($platform) { $tablename = isset($this->table['schema']) ? $this->table['schema'] .'.'. $this->table['name'] : $this->table['name']; return isset($this->table['quoted']) ? $platform->quoteIdentifier($tablename) : $tablename; //OLD RETURN -> return isset($this->table['quoted']) ? $platform->quoteIdentifier($this->table['name']) : $this->table['name']; } ```
admin added the BugIncompleteMissing Tests labels 2026-01-22 15:12:16 +01:00
admin closed this issue 2026-01-22 15:12:16 +01:00
Author
Owner

@Ocramius commented on GitHub (Jul 12, 2017):

only the entity with standard schema has its data inserted.

Fixtures use the ORM to perform inserts, and that means that if no insert was performed, the entity didn't land in the UnitOfWork at all.
It is very likely that you are simply looking at the wrong schema when verifying inserted data.

Also, consider using an SQLLogger to check your issue in more detail

Closing here - please report this again once/if you have a reproducible test case.

@Ocramius commented on GitHub (Jul 12, 2017): > only the entity with standard schema has its data inserted. Fixtures use the ORM to perform inserts, and that means that if no insert was performed, the entity didn't land in the `UnitOfWork` at all. It is very likely that you are simply looking at the wrong schema when verifying inserted data. Also, consider using an `SQLLogger` to check your issue in more detail Closing here - please report this again once/if you have a reproducible test case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5593