NEW Add method to check if a class is ready for db queries#11784
NEW Add method to check if a class is ready for db queries#11784emteknetnz merged 1 commit intosilverstripe:6from
Conversation
4bbd0e4 to
1da3d13
Compare
|
Maybe this should be a new issue but it is somewhat related: For me the existing I don't know why but the |
|
@beerbohmdo Please open a new issue about that bug - a patch for that likely needs to target CMS 5 first, while this new method is for CMS 6. I'll also want some more details about how to reproduce it etc - all of which is best captured in an issue. |
emteknetnz
left a comment
There was a problem hiding this comment.
Feels like this method should not be on DataObjectSchema, which "Provides dataobject and database schema mapping functionality"
Seems like this method should be on DB instead which has "Use this class for interacting with the database."
In the original PR I had it in In other words, while we are using |
This effectively makes the functionality from `Security::database_is_ready()` reusable for any arbitrary DataObject subclass.
1da3d13 to
cd42486
Compare
|
Seems like DBSchemaManager would be a better place for this? That already has a private property Database $database - which presumably is the same object (singleton??) that DB::get_conn() uses, which is used in things like DB::is_ready(). DB::get_schema() (used by DB::field_list()) presumably returns the same (singleton?) DBSchemaManger? |
|
I think it makes more sense for a higher-level class ( |
This effectively makes the functionality from
Security::database_is_ready()reusable for any arbitraryDataObjectsubclass.Replaces #10276
I've resurrected this old PR because I was about to reimplement "is the DB ready?" checks yet again in #11783.... I'd much rather just reuse existing logic instead.
Parent issue