Skip to content

Allowing for Postgres View support#447

Closed
PsySecCorp wants to merge 6 commits intodoctrine:2.1.xfrom
PsySecCorp:2.1.x
Closed

Allowing for Postgres View support#447
PsySecCorp wants to merge 6 commits intodoctrine:2.1.xfrom
PsySecCorp:2.1.x

Conversation

@PsySecCorp
Copy link

This will allow an Entity to be designated as a view so that it is exempt from schema generation.

@PsySecCorp
Copy link
Author

Ugh. I was just told 2.1.x is only updated for security fixes only. Before this is rejected and closed, can a concept very similar to this PLEASE be implemented in the current version of Doctrine? These changes show how it can be done.

@guilhermeblanco
Copy link
Member

Why you need all this if you can create an Entity as ReadOnly and achieve the same thing?

@stof
Copy link
Member

stof commented Sep 17, 2012

PRs should be done in the master branch

@stof
Copy link
Member

stof commented Sep 17, 2012

@guilhermeblanco read-only entities still generate a table in the SchemaTool, so they cannot be used for views if you want to continue using the SchemaTool.
However, entities mapped to a view should probably be read-only

Copy link
Member

Choose a reason for hiding this comment

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

This is wrong. Entities must have an identifier as it is used by the unit of work to store the reference to the entity.

Copy link
Author

Choose a reason for hiding this comment

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

@stof
Copy link
Member

stof commented Sep 17, 2012

Btw, adding some tests for the features would have shown you that it is broken currently

@PsySecCorp
Copy link
Author

I'm not a pro at Doctrine and I dont' think I'll ever be one, but I am currently in need of view support when using it. No one else seems to care about this very important SQL standard, so I'm adding what I can based on whatever that I can find. I'll keep plugging at it until I get it right, but I hope this brings up the point that people more familiar with Doctrine should at least acknowledge that views exist and people are using them.

@stof
Copy link
Member

stof commented Sep 18, 2012

@12Dcode Don't spend time about fixing the feedback in a PR based on 2.1 as this will never be merged in this branch anyway (new features are never added in maintenance branches).
I did the review of the code itself to allow you to apply the feedback when redoing the PR to the master branch if you do it.

@PsySecCorp
Copy link
Author

Fundamentally, the issue remains: Can Doctrine be told to treat View records as an entity in all cases except when dealing with schema updates?

The only way I found this to be possible was by tweaking the Metadata classes. Can you elaborate how best to do this since I do not possess the necessary mastery of Doctrine to do this as you are suggesting?

@beberlei
Copy link
Member

Why dont you hook into the "postGenerateSchema" event with a listener and remove the Table instances that are actually views in your database schema? That would easily solve the issue. This is much to scattered a patch for a feature that has little value since a way to handle this already exists.

Closing the issue,

@beberlei beberlei closed this Sep 20, 2012
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.

4 participants