Permalink
Browse files

Initial commit for webinar

  • Loading branch information...
0 parents commit 70a51bb8cebbc7622b02cc9ad542135eeea7d635 Ryan Mauger committed May 26, 2011
Showing 787 changed files with 148,483 additions and 0 deletions.
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+ <buildpathentry kind="con" path="org.zend.php.framework.CONTAINER"/>
+ <buildpathentry kind="src" path=""/>
+</buildpath>
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>d2-mongo</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.zend.php.framework.ZendFrameworkNature</nature>
+ <nature>org.eclipse.php.core.PHPNature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
@@ -0,0 +1,5 @@
+#Thu May 26 14:13:22 BST 2011
+eclipse.preferences.version=1
+include_path=0;/d2-mongo\u00055;org.zend.php.framework.CONTAINER
+phpVersion=php5.3
+use_asp_tags_as_php=false
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
@@ -0,0 +1 @@
+Window
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<projectProfile type="default" version="1.11.5">
+ <projectDirectory>
+ <projectProfileFile filesystemName=".zfproject.xml"/>
+ <applicationDirectory classNamePrefix="Application_">
+ <apisDirectory enabled="false"/>
+ <configsDirectory>
+ <applicationConfigFile type="ini"/>
+ </configsDirectory>
+ <controllersDirectory>
+ <controllerFile controllerName="Index">
+ <actionMethod actionName="index"/>
+ </controllerFile>
+ <controllerFile controllerName="Error"/>
+ </controllersDirectory>
+ <formsDirectory enabled="false"/>
+ <layoutsDirectory enabled="false"/>
+ <modelsDirectory/>
+ <modulesDirectory enabled="false"/>
+ <viewsDirectory>
+ <viewScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Index">
+ <viewScriptFile forActionName="index"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Error">
+ <viewScriptFile forActionName="error"/>
+ </viewControllerScriptsDirectory>
+ </viewScriptsDirectory>
+ <viewHelpersDirectory/>
+ <viewFiltersDirectory enabled="false"/>
+ </viewsDirectory>
+ <bootstrapFile filesystemName="Bootstrap.php"/>
+ </applicationDirectory>
+ <dataDirectory enabled="false">
+ <cacheDirectory enabled="false"/>
+ <searchIndexesDirectory enabled="false"/>
+ <localesDirectory enabled="false"/>
+ <logsDirectory enabled="false"/>
+ <sessionsDirectory enabled="false"/>
+ <uploadsDirectory enabled="false"/>
+ </dataDirectory>
+ <docsDirectory>
+ <file filesystemName="README.txt"/>
+ </docsDirectory>
+ <libraryDirectory>
+ <zfStandardLibraryDirectory enabled="false"/>
+ </libraryDirectory>
+ <publicDirectory>
+ <publicStylesheetsDirectory enabled="false"/>
+ <publicScriptsDirectory enabled="false"/>
+ <publicImagesDirectory enabled="false"/>
+ <publicIndexFile filesystemName="index.php"/>
+ <htaccessFile filesystemName=".htaccess"/>
+ </publicDirectory>
+ <projectProvidersDirectory enabled="false"/>
+ <temporaryDirectory enabled="false"/>
+ <testsDirectory>
+ <testPHPUnitConfigFile filesystemName="phpunit.xml"/>
+ <testPHPUnitBootstrapFile filesystemName="bootstrap.php"/>
+ <testApplicationDirectory>
+ <testApplicationControllerDirectory>
+ <testApplicationControllerFile forControllerName="Index"/>
+ </testApplicationControllerDirectory>
+ </testApplicationDirectory>
+ <testLibraryDirectory/>
+ </testsDirectory>
+ </projectDirectory>
+</projectProfile>
@@ -0,0 +1,8 @@
+<?php
+
+class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
+{
+
+
+}
+
@@ -0,0 +1,41 @@
+[production]
+; PHP settings
+phpSettings.display_startup_errors = 0
+phpSettings.display_errors = 0
+
+; Set Plugin path for lupi mongoodm resource
+pluginPaths.Lupi_Resource = APPLICATION_PATH "/../library/Lupi/Resource"
+
+; Library include paths & namespaces
+includePaths.library = APPLICATION_PATH "/../library"
+autoloaderNamespaces[] = "Lupi\"
+autoloaderNamespaces[] = "Doctrine\"
+
+; Bootstrap options
+bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
+bootstrap.class = "Bootstrap"
+
+; Applicaiton Setup
+appnamespace = "Application"
+resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
+resources.frontController.params.displayExceptions = 0
+
+; ODM settings
+resources.odm.documents.dir = APPLICATION_PATH "/entities"
+resources.odm.documents.namespace = "Application"
+resources.odm.config.proxyDir = APPLICATION_PATH "/cache/proxies"
+resources.odm.config.proxyNamespace = "proxies"
+resources.odm.config.hydratorDir = APPLICATION_PATH "/cache/hydrators"
+resources.odm.config.hydratorNamespace = "hydrators"
+
+
+[staging : production]
+
+[testing : production]
+phpSettings.display_startup_errors = 1
+phpSettings.display_errors = 1
+
+[development : production]
+phpSettings.display_startup_errors = 1
+phpSettings.display_errors = 1
+resources.frontController.params.displayExceptions = 1
@@ -0,0 +1,58 @@
+<?php
+
+class ErrorController extends Zend_Controller_Action
+{
+
+ public function errorAction()
+ {
+ $errors = $this->_getParam('error_handler');
+
+ if (!$errors || !$errors instanceof ArrayObject) {
+ $this->view->message = 'You have reached the error page';
+ return;
+ }
+
+ switch ($errors->type) {
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+ // 404 error -- controller or action not found
+ $this->getResponse()->setHttpResponseCode(404);
+ $priority = Zend_Log::NOTICE;
+ $this->view->message = 'Page not found';
+ break;
+ default:
+ // application error
+ $this->getResponse()->setHttpResponseCode(500);
+ $priority = Zend_Log::CRIT;
+ $this->view->message = 'Application error';
+ break;
+ }
+
+ // Log exception, if logger available
+ if ($log = $this->getLog()) {
+ $log->log($this->view->message, $priority, $errors->exception);
+ $log->log('Request Parameters', $priority, $errors->request->getParams());
+ }
+
+ // conditionally display exceptions
+ if ($this->getInvokeArg('displayExceptions') == true) {
+ $this->view->exception = $errors->exception;
+ }
+
+ $this->view->request = $errors->request;
+ }
+
+ public function getLog()
+ {
+ $bootstrap = $this->getInvokeArg('bootstrap');
+ if (!$bootstrap->hasResource('Log')) {
+ return false;
+ }
+ $log = $bootstrap->getResource('Log');
+ return $log;
+ }
+
+
+}
+
@@ -0,0 +1,29 @@
+<?php
+use Lupi\Controller as controller;
+
+class IndexController extends controller\Action
+{
+ /**
+ * @var \Doctrine\ODM\MongoDB\DocumentRepository
+ */
+ protected $repository;
+
+ public function init()
+ {
+ $this->repository = $this->dm->getRepository('\\Application\\Blog\\Post');
+ }
+
+ public function indexAction()
+ {
+ $post = $this->repository->find('4dde4067fbd2237df1000000');
+ $comment = new \Application\Blog\Comment();
+ $comment->setEmail('foo@test.com')
+ ->setComment('nice post!');
+ $post->addComment($comment);
+ $this->dm->persist($post);
+ $this->dm->flush();
+ }
+
+
+}
+
@@ -0,0 +1,56 @@
+<?php
+namespace Application\Blog;
+
+/**
+ * @EmbeddedDocument
+ */
+class Comment
+{
+ /**
+ * @Id
+ */
+ private $id;
+
+ /**
+ * @String
+ */
+ private $email;
+
+ /**
+ * @String
+ */
+ private $comment;
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setId($id)
+ {
+ $this->id = (string) $id;
+ return $this;
+ }
+
+ public function getEmail()
+ {
+ return $this->email;
+ }
+
+ public function setEmail($email)
+ {
+ $this->email = (string) $email;
+ return $this;
+ }
+
+ public function getComment()
+ {
+ return $this->comment;
+ }
+
+ public function setComment($comment)
+ {
+ $this->comment = (string) $comment;
+ return $this;
+ }
+}
Oops, something went wrong.

0 comments on commit 70a51bb

Please sign in to comment.