Giter VIP home page Giter VIP logo

spoof's People

Contributors

unix1 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

spoof's Issues

NotFoundException interface

Should there be a NotFoundException type that is implemented by both data\RecordNotFoundException and api\ResourceNotFoundException? This would make it easier to capture a general "not found" condition for API response.

Move common test functionality to base test class

Similar to DatabaseTestCase class there should be a base test class containing common base test functionality. First obvious candidate is getProtectedProperty methods spread around individual test classes.

Unit tests must clean up test.db

To repro:

  • run unit tests
    cd lib360
    phpunit
  • look at additional files created
    git status

Expected: no additional files created

Actual: lib360/tests/db/test.db remains

test.db file must be deleted after the test run is completed.

Add ability to transform Model to array

Model class wraps Record, which makes the record array not easily accessible. There should probably be an easy way to transform an instance of a model into an array for output and other external uses.

Rename all $q to $query

Per code climate report, short variable name $q, mostly used in SQL class is too short. Replace it with $query.

Resolve IValue vs default string types in data classes

The following methods

Table::select
Table::insert
Table::update
Table::delete

expect values to be instances of IValue. However, the following methods:

Table::selectRecord
Table::insertRecord
Table::updateRecord

expect values to be plain strings. Also, when creating conditions and field maps they are hardcoded to strings.

How should this be made consistent? One option is to add automatic type detection to Value class, so it works when data is set to a Record instance too.

Allow connection implementations custom configuration parsing

Currently Connection abstract class constructor tries to read the configuration object DSN and parse the driver name and load the driver object.

Issues are:

  • this process might not be the same for all connection implementations.
  • it would be nicer to explicitly allow each implementation an option to perform its own parsing instead of trying to override the constructor

Catch/rethrow or let the object\NotFoundException propagate

Currently TODO in Connection::__construct states/asks to implement additional logging when a driver specified in db\Config object is not found. In this case object\Factory throws an object\NotFoundException.

To implement:

  • this should not log anything: remove comment about logging
  • should the Connection object catch and rethrow exception, or let it propagate?

Catching and rethrowing would allow the exception to contain more details about the DSN containing the error.

Get rid of code duplication in PDO class

The executor\PDO class has some code duplication between insert, update, delete, select, and query methods. Create smaller functions to get rid of the code duplication.

Implement models

Model classes should build on existing Table and Record classes to make operating on data easier. User should only need to define a model class, tie it to a table containing a key and a list of fields. Model should take care of all CRUD functions, including operating on lists of data via RecordList.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.