Coder Social home page Coder Social logo

recess / recess Goto Github PK

View Code? Open in Web Editor NEW

This project forked from krisjordan/recess

416.0 416.0 54.0 1.62 MB

Recess is a REST oriented, full-stack PHP framework.

Home Page: http://www.recessframework.org

License: Other

PHP 96.24% ApacheConf 0.05% CSS 3.71%

recess's Introduction

Welcome to the Recess PHP Framework! Let’s have some fun…

Requirements

  • Apache
  • mod_rewrite suggested
  • PHP 5.2.3 or greater

Installation Process

  1. Unzip contents into your web documents path (i.e. public_html)
  2. On a development machine make these directories writeable by PHP:
    1. apps/
    2. data/temp/
    3. data/sqlite/
  3. Open recess-conf.php and set RecessConf::$defaultDatabase
    1. If using MySQL: Uncomment the ‘mysql:…’ line and fill in DBNAME/USER/PASS
    2. If using Sqlite: Uncomment the ‘sqlite:…’ line and name the database
  4. Do you have mod_rewrite?
    1. Yes: Open your browser to the location you unzipped
    2. No: Open your browser to the location you unzipped followed by index.php
  5. If you see “Welcome to Recess!” we’re ready to rock.
  6. The URL you are currently at will be referenced {$installUrl}

Recess Tools Mini-tutorial

  1. Browse to http://{$installUrl}/recess/ (i.e. http://localhost/recess)
  2. Do you see Recess Tools? Good.
  3. Click ‘Database’
    1. Make sure your default database shows up.
  4. Click ‘Apps’ and let’s start a new app
    1. Click ‘Start a New Application’
    2. Human name: My First Recess App
    3. Programmatic name: FirstApp [NEXT]
    4. Url prefix: firstApp/ [NEXT]
    5. Follow instructions to activate your first app.
    6. In a new tab browse to http://{$installUrl}/firstApp/
    7. Do you see a Hello page? Great.
  5. Back in Recess Tools click ‘Apps’
  6. Click on ‘My First Recess App’ – this is your app dashboard.
  7. Click on ‘new’ beside of Models
    1. Name the model Post
    2. Select ‘Table does not exist.’
    3. Add 2 properties:
      1. title => String
      2. body => Text
    4. Click ‘Generate Model’
    5. Click ‘Generate Scaffolding’
    6. In your other tab browse to http://{$installUrl}/firstApp/post
    7. Try creating a new post.
  8. In your editor open the apps dir in your Recess install location.
    1. Poke around in here to get a sense of what Tools just generated.
  9. From here have fun, keep tinkering, and stay tuned to RecessFramework.org

Stay tuned, ask questions, and get involved in the Recess Community:

Enjoy Recess!

Kris Jordan

http://www.krisjordan.com/

http://www.twitter.com/KrisJordan

recess's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recess's Issues

Object of class <Controller> could not be converted to string

When trying to return Response Object.
Then controller raises:

Object of class WelcomeHomeController could not be converted to string

In Controller.class.php file, error exists at line 197

$response->data['controller'] = $this;

I did a quick fix by

if(is_string($response->data)) $response->data = "";

[Submitted by zdk]

Ajax Post doesnt get added to the request object

so using

var data = {
    user : {
        username: 'test',
        password: 'test',
        email: '[email protected]',
        group_id: 1
    },
}

$(document).ready(function(){
    $.ajax({
    url:'http://domain.com/api/user.json',
    type:'POST',
    data: data,
    dataType: 'json'
    });
});

I am using the generated scaffolding / models from the recess tools no modification other than adding Json to the RespondsWith

When I dumped $this->request->post['user'] I get an array with all the fields but they are empty.
however when I dump $_POST all the data is there.

Empty prefix results in prefix='/', which causes errors

A bit unexpectedly, '' not '/' is the correct prefix if you don't want any prefix. Tools unhelpfully replaces the former with the (wrong) latter. Actually, I'd go so far as to say that tools should strip leading slashes on the prefix field so that the generated code still works even if users get confused about leading slash or not. [Joshua Paine]

all number strings get 0's stripped

I have string fields for serial numbers which sometimes are all numeric and start with 0. This got interpreted as a numeric type and the 0 was stripped when saving to the database. I made a modification to Criterion to check that not only is the value numeric, but is it also ! a string. The fix works under both mysql and pgsql. Is the the proper place to make this check? Thoughts?

Request->meta should be an array

Currently the Request class has a property $meta of type Meta.
The Response class however also has a property $meta but is of type array (at least at initialization it gets overwritten with the Meta from $request tough).

As Meta is used as a simple key->value container I suggest just making it an array instead.

Recess Tools - Model generator chokes on field name "primary"

Table generation in Recess Tools fails when attempting to generate a table based on a model containing a field named 'primary'. Probably similar problems with column names "integer" "varchar" "default" etc.

To reproduce:
Create a new model in recess tools with a column named "primary". Attempt to generate table for said model.

Expected behavior:
Table is created

Actual behavior:
Table is not created

Probable fix:
Recess tools should escape column names in SQL to avoid column naming conflicts.

Tools codegen on *nix platforms is not user owned

On linux, the files generated by tools end up being unwriteable by non-owners. since apache typically runs under a different user, one has to chmod/chown the new tree to actually do anything with it after creation.

Possible solutions:

  • chmod to world writeable
  • * not a great solution because an SCC like git propagates permissions
  • chown/chgrp to developer's user account
  • * means there will need to be a setting for system username
  • include a native-PHP webserver script that can be run from console on php installs with sockets
  • really want to see this happen
  • * a lead: http://github.com/elazar/php-web-server
  • offer CLI equivalents
  • * definitely going to happen and planned
  • * want to keep web gui-based solution, too

Check PHP Version

You don't get immediate fail with earlier versions of PHP (<5.2.4) - you just get erratic behavior. The version should be checked (maybe in Welcome? maybe we need an install script a la Wordpress?) and developer notified if an insufficient version of PHP is being used.

preg_replace(): The /e modifier is deprecated

Hi
Recess don't work because I have this warning :

preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Location: Line 185 of /.../recess/recess/apps/tools/views/code/classInfo.html.php

Use of Key model_id does not work

/** !BelongsTo person, Key: person_id */
class Post extends Model {}

/** !HasMany post */
class Person extends Model {}

$person->post();

It works if I use PersonId instead

Can I use Key: some_custom_id_field?

[Originally posted by zdk]

Error in a indirectly imported class causes wrong error message

If you are trying to use a class which has an error (like $blah = new ClassWithANastyError()), you'll get an error message stating "ClassWithANastyError has not been imported". This only occurs if you Library::import() a class which Library::import()s the erroneous class file. (think of an erroneous *Input.class.php which is indirectly imported via Form.class.php).
If you directly Library::import() the erroneous file, you'll get the right error message (like a PHP parse error message).

Get 'hasMany' model on newly created model returns random data

When you have two models, e.g. Foo and Bar, and you have a '!HasMany Bar' annotation on model Foo, it will return objects when calling bars() on a newly created Foo object.
Steps to reproduce:
create a model Foo with annotation '!HasMany Bar', create a model Bar with a '!BelongsTo Foo'.

  1. Create a Foo object with one related Bar object and save it (i.e. it will be stored in te DB).
  2. Create a new Foo object without any Bar object (so it doesn't have an 'id' yet).
  3. Now, when you call:
    $foo1 = new Foo();
    $barSet = $foo1->bars();

variable $barSet contains the Bar object created in the first step.

Route resolution fails if recess parent folder is "recess"

http://localhost/recess/recess/apps/model/gen/analyzeModelName/foo.json
responds with 404 from DefaultPolicy:41

$request has
["resourceParts"]=>
array(5) {
[0]=>
string(4) "apps"
[1]=>
string(5) "model"
[2]=>
string(3) "gen"
[3]=>
string(16) "analyzeModelName"
[4]=>
string(3) "foo"

with different parent folder it works and looks like this:

["resourceParts"]=>
array(6) {
[0]=>
string(6) "recess"
[1]=>
string(4) "apps"
[2]=>
string(5) "model"
[3]=>
string(3) "gen"
[4]=>
string(16) "analyzeModelName"
[5]=>
string(6) "foo"

Fatal error retrieving table fields when creating model from existing table

When creating model from existing table, after choosing a table name, if the given table has a double unsigned column, a fatal error will be thrown and fields are not updated or become blank.

URL accessed by AJAX:
http://localhost/recess/apps/model/gen/getTableProps/Default/table_name.json

Error:
Fatal error: Call to undefined function double unsigned() in D:\wamp\www\recess\recess\database\pdo\MysqlDataSourceProvider.class.php on line 109

Column in question:
column_name double unsigned DEFAULT NULL

I'm using the edge version from github. Lines with problem:

108: if( ($spacePos = strpos($mysqlType,' '))) {
109: $mysqlType = substr($mysqlType(0,$spacePos));
110: }

Kill output if response cannot have a body

When returning items that don't necessarily have a body (or a view!) i.e. a temporary redirect from a controller, rather than error'ing out in kill the output (but still send the headers) if no view is available.

Some initial thoughts on fix for this:

  • a change in the default policy
  • a back-up view that takes lower priority than all other views but traps specific response codes (i.e. ones that typically involve the browser redirecting)

A missing Model creates errors in the diagnostics

If one of your annotations refer to a non-existing Model it will create a fatal error inside recess/diagnostics/output/exception_report.php
It says that printType cannot be re-declared.
Wrapping it with:
if (!function_exists('printType')) { /function here/ }
propagates the error to the next function.
After wrapping all functions the exception_report.php file works and returns an error from printCodeSnippet() that says that the $file parameter is empty instead of notifying that the Model does not exist.
Fixing the misspelled Model fixes the problem.

JSON Parsing too narrow

Commit 47444bc is too narrow.

It assumes a PUT cannot have a request body. And while getHttpMethodFromPost() sets $request->put, that happens before this method is called.

I propose:

protected function reparameterizeForFormat(Request $request) {
$method = strtolower($request->method);
if(strtolower($request->format == 'json' && json_decode($request->input)) {
$request->$method = json_decode($request->input, true);
} else if (strtolower($request->format) == 'xml') {
// TODO: XML reparameterization in request transformer
}
return $request;
}

TRACE HTTP Method Support

The "Big 4" GET, POST, PUT, DELETE are first-class and well supported. There are many more, though and some important ones remaining to have better support: HEAD, OPTIONS, TRACE

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

TRACE

The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK) response. The final recipient is either the

origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity.

TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information. The value of the Via header field (section 14.45) is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop.

If the request is valid, the response SHOULD contain the entire request message in the entity-body, with a Content-Type of "message/http". Responses to this method MUST NOT be cached.

member isForeignKey of modelProperty class stays false

member isForeignKey of modelProperty class stays false.
While Model::getRelationships(...) shows that there is a foreign key.
tested in ModelForm, snippet [ lines 27-32] :
var_dump( Model::getRelationships($model) );
$properties = Model::getProperties($model);
$this->inputs = array();
foreach($properties as $property) {
var_dump($property);

Code Indexing Error

SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'recess_tools_classes'

Seems like the tables created are being created again during code indexing.

Call to undefined method Model::insert()

[First Comment]
Hi I am new to Recess and am evaluating it. I downloaded a copy today from github
wget http://github.com/recess/recess/tarball/master
which returned
recess-recess-ac4ccd27162dbf064222cd0af2ab73a13661be75.tar.gz

I then started to run through your excellent 1 minute tutorials.

After creating the post and comments models I clicked the post link under the Apps tab

it resulted in the following error

Fatal error: Call to undefined method Model::insert()
in /home/chris/public_html/recess/recess/recess/apps/tools/models/RecessReflectorPackage.class.php on line 27

On reviewing the code I found that
RecessReflectorPackage::insert() calls parent::insert()

I cant locate an insert() function in the Model class.

If I comment out the parent::insert() call I get a segmentation fault!

apache error log...

[Fri Aug 21 13:39:25 2009] [notice] child pid 18483 exit signal Segmentation fault (11)

Apart from that Recess looks great

DeveloperChris

[Second Comment]
I have after some more checking I realised we are using the wrong version of PHP 5.1 instead of 5.2.4

perhaps the config scripts should have a version check and die on a version mismatch

DeveloperChris

[ThirdComment]
This has happened with me too, I changed the call to Model::insert(); to Model::wrappedInsert(); and it ran fine. It was because the RecessReflectorPackage was overwriting insert(); directly, so when !Wrappable tried to wrap it, the method already existed and it failed.

I don't quite know what to do with this - I think changing RecessReflectorPackage::insert() method to wrappedInsert() should provide the same functionality, but why it's failing on some systems and not on others I'm not sure.

Jamie Rumbelow

HEAD HTTP method support

Return only the headers of a GET request, with no message-body.

From the HTTP spec...

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.

The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache MUST treat the cache entry as stale.

Remove the explicit / from the welcome app

Re: http://forums.recessframework.org/topic/50-changing-the-default-applications/page__view__findpost__p__275

It might be a good idea to remove the explicit "/" for the !Route annotation of the WelcomeHomeController->index(). I found this very confusing as I expected to change the $app->routingPrefix and have everything work. It is confusing to have something lower down stepping on the toes of something higher up like that. Especially in the default install.

Error in procesing similar routers

if we have 2 similar routers with different parameters and request methods, processes only first one even if it not matches with request method. And throws error "METHOD not supported, supported METHODs are: ..."

for example:
/**

  • !RespondsWith Xml, Json
  • !Prefix webContacts/
    */
    !Route POST, contacts/$parameter1
    !Route GET, contacts/$parameter2

request:
GET:webContacts/contacts/1234

response:
"METHOD not supported, supported METHODs are: POST"

possible way to fix is change 173 string in file recess/framework/routing/RtNode.class.php from:
if($result->routeExists) {
to
if($result->routeExists && $result->methodIsSupported) {

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.