Skip to content

Commit

Permalink
Merge pull request #7 from tonicospinelli/07-autoload
Browse files Browse the repository at this point in the history
refactoring: autload with composer
  • Loading branch information
tonicospinelli authored Jun 21, 2016
2 parents cf52cd6 + 3f46f82 commit de85c8b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/data/*
!/data/.gitkeep
/vendor
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "tonicospinelli/developing-for-business",
"description": "A Quick Project to show how to is possible evolute application in Flat PHP to Object Oriented PHP",
"license": "MIT",
"authors": [
{
"name": "Antonio Spinelli",
"email": "[email protected]"
}
],
"autoload": {
"files": [
"./lib/dbconn.php",
"./lib/functions.php",
"./lib/controllers/product.php",
"./lib/controllers/wishlist.php",
"./lib/models/product.php",
"./lib/models/wishlist.php"
]
}
}
2 changes: 1 addition & 1 deletion lib/controllers/wishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ function wishlistRemoveAction($email, $id)
if (!removeWishItem($id)) {
$errormsg = 'Product could not be removed from wishlist! :(';
}
header('Location: /wishlist?' . http_build_query(['email' => $_GET['email']]));
header('Location: /index.php/wishlist?' . http_build_query(['email' => $_GET['email']]));

}
7 changes: 1 addition & 6 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

// load and initialize any global libraries
require_once __DIR__ . '/../config/app.php';
require_once LIBRARY_DIR . '/functions.php';
require_once LIBRARY_DIR . '/dbconn.php';
require_once LIBRARY_DIR . '/models/product.php';
require_once LIBRARY_DIR . '/controllers/product.php';
require_once LIBRARY_DIR . '/models/wishlist.php';
require_once LIBRARY_DIR . '/controllers/wishlist.php';
require_once __DIR__ . '/../vendor/autoload.php';

// route the request internally
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
Expand Down

0 comments on commit de85c8b

Please sign in to comment.