Giter Site home page Giter Site logo

db-fw's Introduction

Projects application and api

Configuration

Database configuration in /classes/DB/Database.php

Discovery

Visiting /discover will get all the tables and views in the configured database and create php files in /discover/src. these should be moved to the /classes folder in the proper namespace. If new entities or views are added make sure to add them to api/index.php to enable access

API

The api is accessible using a redirect to /api/index.php, parameter . With the .htaccess when accessing a non existing file or folder it will redirect the path to `/api/index.php``

Request methods allowed: GET, POST, PUT, DELETE, OPTIONS

The api has the following endpoints: GET: /api/index.php/<endpoint>[/\<id>]

  • returns a list of all entries in the database or a single object

GET: /api/index.php/\<endpoint>?\<query>

  • query is a key=value pair wildcards allowed, e.g. ?Name=foo or ?Name=foo&Age=42 or ?Name=foo*
  • returns a list of all entries in the database or a single object
  • Payload ignored

POST: /api/index.php/<endpoint>[/\<id>]

  • creates a new entry in the database
  • Payload should contain complete object

PUT: /api/index.php/<endpoint>

  • updates an existing entry in the database
  • Payload can contain a partial object

DELETE: /api/index.php/<endpoint>[/\<id>]

  • deletes an entry from the database
  • payload ignored

Payload: JSON Response: JSON array or JSON object or JSON object or error message

db-fw's People

Contributors

kingma-sbw avatar theking2 avatar

Stargazers

 avatar

Watchers

 avatar

db-fw's Issues

Bug on doPut test

Uncaught Error: Object of class DateTime could not be converted to string in D:\Projekten\dw-fw\classes\DB\PersistTrait.php:553

Do not convert DateTime values

The setter now accepts null and string (when set from sql results) but it could also be a \DateTime in which case nothing has to be converted.

split persisten trait

one for CRUD (freeze/thaw/update/delete)
and one for iteratator findFirst/-Next, Where and Iterator functions.

Allow password types

These should be converted with password_hash(). Add a function to do password_verify(). When searching for a user/pass combination.

Hash function is a class variable.

add config file

Database connection
Default namespace for discovered classes

error in constructor

[08-Apr-2022 07:01:34 UTC] PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on bool in D:\Projekte\pm\classes\DB\PersistTrait.php:161
Stack trace:
#0 D:\Projekte\pm\classes\DB\PersistTrait.php(562): NeueMedien\test->thaw(1)
#1 D:\Projekte\pm\api\index.php(139): NeueMedien\test->__construct(1)
#2 D:\Projekte\pm\api\index.php(25): NeueMedien\doDelete(Array)
#3 {main}
thrown in D:\Projekte\pm\classes\DB\PersistTrait.php on line 161

Bug on doPut

PHP Fatal error: Uncaught Error: Typed property NeueMedien\test::$test_ID must not be accessed before initialization in D:\Projekten\dw-fw\classes\DB\PersistTrait.php:139

FR: No PDO EXCEPTION

PDO::ATTR_ERRORMODE = PDO::ERRMODE_WARNING

Check all interaction with PDOStatement for error handling.

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.