Commit graph

330 commits

Author SHA1 Message Date
Maurits van der Schee
07e5ce5e1f fix soft delete 2017-03-17 03:01:35 +01:00
Maurits van der Schee
c240c4fdcd bugfix 2017-03-17 02:14:33 +01:00
Maurits van der Schee
75febbe3a5 some adjustments 2017-03-17 01:45:33 +01:00
Maurits van der Schee
c3fd4564bf Merge pull request #208 from appcrew/hotfix/1.0.8_swagger
Swagger: Output swagger description
2017-03-17 01:45:08 +01:00
Maurits van der Schee
ebb8fecc0e Fix for #208 2017-03-17 01:43:54 +01:00
Maurits van der Schee
919e820ba0 Some fixes 2017-03-17 01:29:52 +01:00
Barry Dam
68a4043965 call before multiple times
[refererring to](https://github.com/mevdschee/php-crud-api/pull/210)
2017-03-16 13:16:07 +01:00
Barry Dam
1d105ad435 Bug in beforehandler, on deleting multiple rows
Hi there,

We're allmost there, I found 2 bug, one I solved by this pull request:

The first one: when deleting multiple rows at once and applying my soft delete [see example 209](https://github.com/mevdschee/php-crud-api/issues/209) I got an 404 errror : Subject cuased by the [updateObject method](https://github.com/mevdschee/php-crud-api/blob/master/api.php#L1533-L1535) 

The other you will find here [209](https://github.com/mevdschee/php-crud-api/issues/209), this needs to be discussed first.
2017-03-16 09:35:51 +01:00
mevdschee
753c0c05bb bugfix 2017-03-16 09:33:24 +01:00
Benedikt Dahm
aada5cab0a Swagger: Output swagger description when api.php (__FILE__) is requested and no path requested entitiy is given 2017-03-15 23:26:13 +01:00
Maurits van der Schee
71116bc8e5 12.04 compatability fix 2017-03-15 22:57:50 +01:00
Maurits van der Schee
33d82a6a08 12.04 compatability fix 2017-03-15 22:55:53 +01:00
Maurits van der Schee
c05cb8d130 cleanup construct 2017-03-15 22:32:28 +01:00
Maurits van der Schee
b91bd3177a cleanup construct 2017-03-15 19:17:31 +01:00
mevdschee
fec8b5ccef fix #207 2017-03-15 17:37:39 +01:00
Maurits van der Schee
c6d79bbdf3 Merge branch 'master' into patch-1 2017-03-15 17:36:15 +01:00
mevdschee
b11f5966e6 Fix for #130 2017-03-15 17:26:59 +01:00
Barry Dam
70922c6ec2 Possible fix for issue 206
Possible fix for [issue 206](https://github.com/mevdschee/php-crud-api/issues/206)

soft delete example
```php
'before'=>function(&$cmd, &$db, &$tab, &$id, &$in) { 
	if ($cmd == 'delete') {
		$cmd = 'update'; // change command to update
		foreach($in as $k => $o) {
			$in[$k]->deleted = date('Y-m-d H:i:s', time());
		}				
	}
			
},
'column_authorizer'=>function($cmd, $db ,$tab, $col) { 
	return ( ! in_array($col, array('deleted')));
},
'record_filter'=>function($cmd,$db,$tab) { 
	return array('deleted,is,null');
}
```
2017-03-15 15:35:27 +01:00
Maurits van der Schee
272f5759f4 Adjust before handler to facilitate #130 2017-03-12 14:17:57 +01:00
Maurits van der Schee
4cf339c9ea Before handler to facilitate #151 2017-03-12 09:56:27 +01:00
Maurits van der Schee
7ff9ff9d30 Allow error logging 2017-03-11 09:04:08 +01:00
Maurits van der Schee
1a41e008e7 whitespace 2017-03-11 01:46:37 +01:00
Maurits van der Schee
bc31c2ba67 As discussed in #200 2017-03-11 00:22:59 +01:00
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
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
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
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
72e11f221e Merge branch 'master' into master 2017-02-25 22:43:03 +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
Maurits van der Schee
60ac51bdf7 Added xml2json for #176 2017-02-21 01:40:35 +01:00
Maurits van der Schee
68e406d3c7 Initial commit for #176 2017-02-20 02:07:33 +01:00