Skip to content

Commit

Permalink
Addign Doctrine
Browse files Browse the repository at this point in the history
  • Loading branch information
wingman007 committed May 30, 2013
1 parent a9b83e0 commit 37428c7
Show file tree
Hide file tree
Showing 1,533 changed files with 207,199 additions and 1,062 deletions.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"zf2"
],
"homepage": "http://framework.zend.com/",
"minimum-stability": "alpha",
"repositories": [
{
"type": "composer",
Expand All @@ -17,6 +18,8 @@
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"zendframework/zendservice-recaptcha": "2.*",
"doctrine/common": ">=2.1"
"doctrine/common": ">=2.1",
"doctrine/doctrine-orm-module": "0.*",
"doctrine/doctrine-mongo-odm-module": "dev-master"
}
}
Binary file modified composer.phar
Binary file not shown.
3 changes: 3 additions & 0 deletions config/application.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
return array(
'modules' => array(
'Application',
'DoctrineModule',
'DoctrineORMModule',
'DoctrineMongoODMModule',

'Album', //this line is added
'ZhelyanGuglev',
Expand Down
22 changes: 22 additions & 0 deletions config/autoload/doctrineorm.local.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
return array(
'doctrine' => array(
'connection' => array(
// default connection name
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'localhost',
'port' => '3306', // default 3306 find and change in H:\xampp\mysql\bin\my.ini
'user' => 'root',
'password' => 'password',
'dbname' => 'db',
'charset' => 'utf8', // extra
'driverOptions' => array(
1002=>'SET NAMES utf8'
)
)
)
)
),
);
10 changes: 10 additions & 0 deletions config/autoload/local.php.appfog.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
$services_json = json_decode(getenv("VCAP_SERVICES"),true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
return array(
'db' => array(
'dsn' => 'mysql:dbname='.$mysql_config["name"].';host='.$mysql_config["hostname"].';port='.$mysql_config["port"],
'username' => $mysql_config["username"],
'password' => $mysql_config["password"],
)
);
2 changes: 2 additions & 0 deletions data/DoctrineMongoODMModule/Hydrator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions data/DoctrineMongoODMModule/Proxy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions data/DoctrineORMModule/Proxy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
84 changes: 84 additions & 0 deletions fmi.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
-- MySQL dump 10.13 Distrib 5.5.27, for Win32 (x86)
--
-- Host: localhost Database: fmi
-- ------------------------------------------------------
-- Server version 5.5.27

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `album`
--

DROP TABLE IF EXISTS `album`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `album` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`artist` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `album`
--

LOCK TABLES `album` WRITE;
/*!40000 ALTER TABLE `album` DISABLE KEYS */;
INSERT INTO `album` VALUES (1,'The Military Wives','In My Dreams'),(2,'Adele','21'),(3,'Bruce Springsteen','Wrecking Ball (Deluxe)'),(4,'Lana Del Rey','Born To Die'),(5,'Gotye','Making Mirrors');
/*!40000 ALTER TABLE `album` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`usr_id` int(11) NOT NULL AUTO_INCREMENT,
`usr_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`usr_password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`usr_email` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`usrl_id` int(11) DEFAULT NULL,
`lng_id` int(11) DEFAULT NULL,
`usr_active` tinyint(1) NOT NULL,
`usr_question` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`usr_answer` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`usr_picture` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`usr_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'sadfasfsa','fsadfasfas','[email protected]',2,0,1,'safasdf','fasdf','fsadfsa');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2013-05-30 22:47:09
13 changes: 13 additions & 0 deletions localVirtualHost.conf.distribution
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Fmi test in delete me as a professor
Listen 10118
<VirtualHost *:10118>
DocumentRoot "/PortableApps/PortableGit/projects/deleteme/fmi/public"
<Directory "/PortableApps/PortableGit/projects/deleteme/fmi/public">
SetEnv ZF2_PATH /xampp/php/pear/ZF2
SetEnv APPLICATION_ENV development
Order allow,deny
Allow from all
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
42 changes: 37 additions & 5 deletions module/Fmi/Module.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
<?php
namespace Fmi;
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Fmi;

class Module
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;

class Module
{

}
// public function onBootstrap(MvcEvent $e)
// {
// $eventManager = $e->getApplication()->getEventManager();
// $moduleRouteListener = new ModuleRouteListener();
// $moduleRouteListener->attach($eventManager);
// }

public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
}
79 changes: 79 additions & 0 deletions module/Fmi/config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
// http://stackoverflow.com/questions/13007477/doctrine-2-and-zf2-integration
namespace Fmi; // SUPER important for Doctrine othervise can not find the Entities

return array(
'controllers' => array(
'invokables' => array(
'Fmi\Controller\Index' => 'Fmi\Controller\IndexController',
),
),
// !!! SUPER important use fmi/default grace-drops/<segment>in url helper
'router' => array(
'routes' => array(
'fmi' => array(
'type' => 'Literal',
'options' => array(
'route' => '/fmi',
'defaults' => array(
'__NAMESPACE__' => 'Fmi\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action[/:id]]]', // !!! SUPER important use grace-drops/default grace-drops/<segment>in url helper
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]*'
),
'defaults' => array(
// STOYAn was adding this. You can avoid using it
'__NAMESPACE__' => 'Fmi\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
),
),
),
),
),
'view_manager' => array(
'template_map' => array(
// 'layout/rage' => __DIR__ . '/../view/layout/rage.phtml', // layout/layout
// 'layout/waterdrop' => __DIR__ . '/../view/layout/waterdrop.phtml',
),
'template_path_stack' => array(
'grace-drops' => __DIR__ . '/../view'
),

'display_exceptions' => true,
),
'doctrine' => array(
'driver' => array(
// defines an annotation driver with two paths, and names it `my_annotation_driver`
__NAMESPACE__ . '_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(
__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity',
),
),

// default metadata driver, aggregates all other drivers into a single one.
// Override `orm_default` only if you know what you're doing
'orm_default' => array(
'drivers' => array(
// register `my_annotation_driver` for any entity under namespace `My\Namespace`
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver',
)
)
)
)
);
Loading

0 comments on commit 37428c7

Please sign in to comment.