Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Move to new QueryBuilder #186

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open

[WIP] Move to new QueryBuilder #186

wants to merge 39 commits into from

Conversation

allejo
Copy link
Owner

@allejo allejo commented Feb 2, 2018

Shame on me for deciding to sneak in such a huge change to BZiON's core in
a planned point release... 😅 BUT Deeeeeeeeploy Jenkins!

This PR has been reassigned to a 0.11.0 release

This PR is dedicated to the restructuring of model statuses in the database and introducing a new query builder, powered by Pixie.

  • In order to allow for both query builders to coexist, the Pixie powered version has been dubbed QueryBuilderFlex.
    • This class name is subject to change.
  • The practice of using status columns for models has been deprecated.
    • Due to SET columns in MySQL being a bad idea, models will be making use of boolean columns for model states (e.g. is_deleted, is_draft, is_public). By making this switch, it'll also allow us to support more databases in the future since the SET column type is not part of the SQL standard.

Progress

Model migration to new QueryBuilder and new status convention.

  • ApiKey
  • Ban
  • Conversation
  • ConversationEvent
  • Country
  • Invitation
  • Map
  • Match
  • Message
  • News
  • NewsCategory
  • Notification
  • Page
  • Permission
  • Player
  • Role
  • Server
  • Team
  • Visit

Closes #163

@allejo allejo added this to the Version 0.10.2 milestone Feb 2, 2018
@allejo allejo self-assigned this Feb 2, 2018
@allejo allejo force-pushed the feature/pixie-port branch 4 times, most recently from d05df7c to 85286dd Compare February 5, 2018 07:38
Repository owner deleted a comment from todo bot Feb 5, 2018
@allejo allejo modified the milestones: Version 0.10.2, Version 0.11.0 Feb 7, 2018
@allejo allejo force-pushed the feature/pixie-port branch from 1f1c57c to 1862227 Compare February 7, 2018 08:37
Repository owner deleted a comment from todo bot Feb 7, 2018
@allejo allejo force-pushed the feature/pixie-port branch 3 times, most recently from 4b0f1f7 to b3acf3c Compare February 9, 2018 06:57
@todo
Copy link

todo bot commented Feb 9, 2018

Redirect models with wrong alias when bzion.site.url_type === 'permalink'

* @todo Redirect models with wrong alias when bzion.site.url_type === 'permalink'
*/
public function getURL($action = 'show', $absolute = false, $params = array(), $vanity = false)
{
if (!$this->isValid()) {
return "";


This comment was generated by todo based on a @todo comment in b0f41c2 in #186. cc @allejo.

Repository owner deleted a comment from todo bot Feb 9, 2018
@allejo allejo force-pushed the feature/pixie-port branch from e693095 to e678df9 Compare February 10, 2018 08:30
@todo
Copy link

todo bot commented Feb 10, 2018

Move this to the Service class

bzion/src/Database.php

Lines 20 to 25 in 456aeef

* @todo Move this to the Service class
* @var Database
*/
private static $Database;
/**


This comment was generated by todo based on a @todo comment in 456aeef in #186. cc @allejo.

@todo
Copy link

todo bot commented Feb 10, 2018

Make this work for PDO, or deprecate it if not needed

bzion/src/Database.php

Lines 159 to 164 in 456aeef

* @todo Make this work for PDO, or deprecate it if not needed
* @return bool True if the connection is active
*/
public function isConnected()
{
return true;


This comment was generated by todo based on a @todo comment in 456aeef in #186. cc @allejo.

@todo
Copy link

todo bot commented Feb 10, 2018

When PHP 5.x support is dropped, replace Exception with Throwable

bzion/src/Database.php

Lines 366 to 371 in 456aeef

* @todo When PHP 5.x support is dropped, replace Exception with Throwable
*
* @throws Exception
*/
public function error($error, $id = null, Exception $previous = null)
{


This comment was generated by todo based on a @todo comment in 456aeef in #186. cc @allejo.

@allejo allejo force-pushed the feature/pixie-port branch from 456aeef to 0682c18 Compare February 10, 2018 10:07
Repository owner deleted a comment from todo bot Feb 10, 2018
Repository owner deleted a comment from todo bot Feb 10, 2018
Repository owner deleted a comment from todo bot Feb 10, 2018
Repository owner deleted a comment from todo bot Feb 10, 2018
Repository owner deleted a comment from todo bot Feb 10, 2018
Repository owner deleted a comment from todo bot Feb 10, 2018
Repository owner deleted a comment from todo bot Feb 10, 2018
allejo added 29 commits April 9, 2018 20:58
- Update model construction to fetch database values using the new query
  builder
- Add new getActiveModels() function to allow models to define how to
  define "active" models
- Redesign eager and lazy columns to return an array of column names
A system model is one that is maintained entirely by BZiON and does not
allow users to edit values. For example, the Permission model is stored
in the database, however, it is only maintained BZiON through migrations
for removing or adding new permissions.
This method will find and pick the first result matching the query. Only
a single Model will be returned; an invalid Model if the query returns
nothing.
- In addition to migrating to the new Query Builder, the Server model
  has gotten some new columns allowing us to classify servers based on
  their purpose. e.g. Match server vs replay server
- The form view for Server models have also been updated to allow edits
  for server types.
- Bump QueryBuilderFlex to use PHP 7 type-hinting
The get() method of the query builder is the heart of getting results
from the database. Override the method to ensure all queries are tracked
by our query manager.
@allejo allejo force-pushed the feature/pixie-port branch from d487e6c to 0f24bc0 Compare April 10, 2018 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant