Commit graph

854 commits

Author SHA1 Message Date
Maurits van der Schee
4e27405863 As discussed in #200 2017-03-10 23:09:25 +01:00
Maurits van der Schee
ee34a99942 As discussed in #200 2017-03-10 23:00:07 +01:00
Maurits van der Schee
d50eac6813 Merge pull request #200 from VyseExhale/patch-1
after_create
2017-03-10 22:40:29 +01:00
Maurits van der Schee
37f2e0d6a1 Merge pull request #201 from jr3cermak/master
A little bugfix.
2017-03-10 20:44:06 +01:00
Rob Cermak
cefe7b44e9 Fix for schema object. If no fields are required, do not add required tag. Fix to tests (Token->TOKEN). 2017-03-10 18:47:30 +00:00
Barry Dam
b712ebc8d7 after_create
Hi Maurits,

I needed a callback function that got triggered on a new db entry (Create).

For example I wanted to send an e-mail to a newly registered member.
In this example I have a "members" table with the columns: id , firstName, lastName, email
the yourEmailFunction method will send a welcome message to the newly entered member.

```php
$api = new PHP_CRUD_API(array(
   'after_create'=>function($db,$tab,$row) {
      if ($tab == 'members') 
         yourEmailFunction($row['firstName'],$row['lastName'],$row['email']);
      }
   }
));
$api->executeCommand();
```
Tell me you thoughts... maybe if you like it and willing to accept the pull request I can also create an after_delete and after_update method.
2017-03-09 15:14:08 +01:00
Maurits van der Schee
88b7bdb41a bugfix 2017-03-07 04:17:15 +01:00
Maurits van der Schee
fc12285ad9 Added response interceptor to transform 'x-xsrf-token' header into 'XSRF-TOKEN' cookie for cross-domain requests 2017-03-07 02:54:04 +01:00
Maurits van der Schee
a20a82cefd Improve bash authentication example 2017-03-05 10:25:52 +01:00
Maurits van der Schee
8deb13d824 Improve bash implementation 2017-03-05 10:17:52 +01:00
Maurits van der Schee
24522ce8bb Added comments 2017-03-05 10:05:23 +01:00
Maurits van der Schee
e069d28e5c Add bash curl examples 2017-03-05 09:52:31 +01:00
Maurits van der Schee
40be702430 Merge branch 'master' of github.com:mevdschee/php-crud-api 2017-03-05 02:41:26 +01:00
Maurits van der Schee
c060399550 Improve CORS header implementation 2017-03-05 02:40:20 +01:00
Maurits van der Schee
3fadb01951 updated json2xml.php 2017-03-03 23:55:10 +01:00
Maurits van der Schee
e550cb85a9 Merge pull request #195 from karllhughes/master
Allowing json, jsonb in postgres
2017-02-28 08:00:38 +01:00
Karl Hughes
244696c091 Allowing json, jsonb in postgres 2017-02-27 12:50:21 -06:00
mevdschee
4f5f7cf2d3 bugfix 2017-02-27 14:33:07 +01:00
Maurits van der Schee
7e0c2410be bugfix 2017-02-26 23:05:16 +01:00
Maurits van der Schee
6da5732fd0 Fix for #193, thank you jr3cermak 2017-02-26 14:33:41 +01:00
Maurits van der Schee
18b29420e8 Fix for #193, thank you jr3cermak 2017-02-26 14:15:06 +01:00
Maurits van der Schee
16a2abec99 Fix for #193, thank you jr3cermak 2017-02-26 13:57:41 +01:00
Maurits van der Schee
1e7b510062 bugfix 2017-02-26 04:05:09 +01:00
Maurits van der Schee
082d5e4a37 bugfix 2017-02-26 04:01:43 +01:00
Maurits van der Schee
34c7ac98ff Small fix for #192 and #192 to detect integer types 2017-02-26 02:02:54 +01:00
Maurits van der Schee
71a62e9439 small bugfix for #191 and #192 2017-02-26 01:44:32 +01:00
Maurits van der Schee
e718557ced Refactor for #191 and #192 2017-02-26 01:18:25 +01:00
Maurits van der Schee
83035f5aab Refactor for #191 and #192 2017-02-26 00:27:55 +01:00
Maurits van der Schee
113c0006ca Merge pull request #192 from jr3cermak/master
Adding "x-dbtype" to show database field type
2017-02-25 22:43:10 +01:00
Maurits van der Schee
72e11f221e Merge branch 'master' into master 2017-02-25 22:43:03 +01:00
Maurits van der Schee
f09ef2166d Merge pull request #191 from VyseExhale/patch-1
Database column type in metadata
2017-02-25 22:41:16 +01:00
Rob Cermak
7fb964c469 Add translation of numeric types in MySQL to actual types. 2017-02-24 18:47:26 -09:00
Rob Cermak
6de69b2abd Add x-dbtype to show actual field type from database. 2017-02-24 12:47:17 -09:00
Barry Dam
4738b91246 db-type in metadata
First of all, thanks for building this great php api framework and sharing it with the world!

I am a SAP Developer mainly developping JS apps with SAPui5 / OpenUit (https://open.sap.com/)
And for Sapui5 to work with your API, i made a SAPui5 model implementation of your api
With this model I can retrieve, edit and send data to your api and bind it to my views.

Other SAPui5 Models (like Odata) auto convert api response data to usable js json objects.
for example. Any date/time fields in the api will in js be converted to a new Date() object.

I wanted to do this too with my model implementation of your api.. but therefore I needed to know what db column and types my db tables have.

I found that in your metadata under paths/TABLENAME/post/parameters[0]/schema/properties
all db columns could be found.. and that all types are set to "string"

In order to get the db-types aswel I edited your class and added "db-type" to
paths/TABLENAME/get/responses/200/schema/items/properties/PROPERTYNAME

So now I can what what the column types are in the db, and so for my model I could convert a db column date to a js Date() object and viseversa.


note: I only added the query reflect_type to the MySQL class, I don't have the experience to write it also in PostgreSQL, SQLServer, SQLite.

hit me back what you think of it, and if maybe you are willing to accept the pull request or have a better solution, please let me know.

Barry
2017-02-24 15:58:04 +01:00
mevdschee
701eb540a5 Updated for unstructured data 2017-02-22 09:28:29 +01:00
Maurits van der Schee
9be41e904f Add extra JSON test 2017-02-21 01:48:34 +01:00
Maurits van der Schee
60ac51bdf7 Added xml2json for #176 2017-02-21 01:40:35 +01:00
Maurits van der Schee
f4be603eaf bugfix for #176 2017-02-20 02:11:15 +01:00
Maurits van der Schee
68e406d3c7 Initial commit for #176 2017-02-20 02:07:33 +01:00
Maurits van der Schee
bd3130b76d Added documentation in README for #185 2017-02-18 12:00:50 +01:00
Maurits van der Schee
e284677b65 small name change 2017-02-18 11:26:13 +01:00
Maurits van der Schee
7e593ace3c Avoid exclusion of relationship columns, see #185 2017-02-18 11:02:46 +01:00
Maurits van der Schee
e2f9d8ac99 Improved implementation of #185 2017-02-18 08:59:22 +01:00
Maurits van der Schee
ee0c13ad37 Small adjustment of #185 2017-02-18 08:19:01 +01:00
Maurits van der Schee
53285c4a48 Merge pull request #185 from jr3cermak/master
1st attempt at adding exclude= (issue #136) try#2
2017-02-18 08:16:17 +01:00
Maurits van der Schee
7edb0a29ca Improved signature 2017-02-17 14:08:40 +01:00
Rob Cermak
97a593c682 Fix test suite to include change for improved CSRF handling. 2017-02-16 22:50:36 -09:00
Rob Cermak
81cbe434b7 Merge branch 'master' of https://github.com/mevdschee/php-crud-api 2017-02-16 22:19:37 -09:00
Rob Cermak
aeb02dff5c 1st attempt at adding exclude (issue #136). If both include and exclude are used, include happens first, then the exclude. The exclude list is either {columns/fields} or {table}.{columns/fields} in format. If the {columns/fields} format is used, it will only be applicable to responses with a single table. If relations are pulled in, be aware that excluding a specified table/field/column could have unintended consequences to the response. 2017-02-16 22:18:35 -09:00
Maurits van der Schee
a828d5c409 Improve CSRF handling 2017-02-17 02:48:27 +01:00