Skip to content

Commit

Permalink
Daddy, I just wanna go fast!
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisJordan committed Nov 13, 2008
1 parent 918d783 commit f868764
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
6 changes: 3 additions & 3 deletions apps/blog/controllers/PostsController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class PostsController extends Controller {
/** !Route GET, /blog/ */
function home() {

// $this->latestPosts = Make::a('Post')->find()->orderBy('id DESC')->range(0,5);
$this->latestPosts = array();
$this->latestPosts = Make::a('Post')->find()->orderBy('id DESC')->range(0,5);

}

Expand All @@ -27,7 +26,8 @@ function alphabetical() {
/** !Route GET, comments/$postId */
function comments($postId) {

$this->comments = Make::a('Post')->equal('id',$postId)->comments();
$this->post = Make::a('Post')->equal('id',$postId)->first();
$this->comments = $this->post->comments();

}

Expand Down
17 changes: 11 additions & 6 deletions apps/blog/views/home/comments.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<form method="POST">
<input type="text" name="comment"></input>
<input type="submit"></input>
</form>



<?php

echo '<a href="/blog/">Go Back</a>';
echo '<h2>' . $post->title . '</h2>';

foreach($comments as $comment) {

echo '<p>' . $comment->comment . '</p>';
Expand All @@ -8,9 +18,4 @@

}

?>

<form method="POST">
<input type="text" name="comment"></input>
<input type="submit"></input>
</form>
?>
Binary file added data/default.db
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/recess/framework/views/SmartyView.class.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
Library::import('smarty.Smarty');
Library::import('recess.framework.views.AbstractView');
Library::import('recess.http.Response');

class SmartyView extends AbstractView {
protected $smarty = null;

public function __construct() {
Library::import('smarty.Smarty');
//Fetch Smarty object
if($this->smarty !== ''){
$this->smarty = new Smarty();
Expand Down
10 changes: 5 additions & 5 deletions lib/recess/lang/Library.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ static function beginNamedRun($name) {
}

static function namedRunMissed($class) {
self::$namedRuns[self::$namedRun][] = $class;
if($class != 'Smarty')
self::$namedRuns[self::$namedRun][] = $class;
}

static function persistNamedRuns() {
Expand All @@ -70,15 +71,14 @@ static function persistNamedRuns() {
$file = fopen($namedRunFile,'w');
}

echo $namedRun;
foreach($missedClasses as $class) {
$classInfo = self::$classesByClass[$class];
$fullName = $classInfo[self::NAME];
$path = self::$paths[$classInfo[self::PATH]];
$fileName = str_replace(self::dotSeparator,self::pathSeparator, $fullName) . '.class.php';
$classFile = $path . $fileName;
// $code = php_strip_whitespace($classFile);
$code = preg_replace('/\nLibrary::import\(.*/','',file_get_contents($classFile));
$code = file_get_contents($classFile);
// $code = preg_replace('/\nLibrary::import\(.*/','',file_get_contents($classFile));
fwrite($file, $code);
}

Expand Down Expand Up @@ -221,7 +221,7 @@ static function getClassName($fullName) {

$lastDotPosition = strrpos($fullName, self::dotSeparator);
if($lastDotPosition === false) {
self::$classNames[$fullName] = $fullName;
self::$classesByFull[$fullName] = $fullName;
return $fullName;
} else {
$className = substr($fullName, $lastDotPosition + 1);
Expand Down
8 changes: 4 additions & 4 deletions lib/recess/lang/RecessReflectionClass.class.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php
Library::import('recess.lang.Annotation');
Library::import('recess.lang.RecessClass');
Library::import('recess.lang.RecessReflectionMethod');
Library::import('recess.lang.RecessReflectionProperty');

/**
* Recess! Framework reflection for class which introduces annotations.
Expand All @@ -24,6 +21,7 @@
*/
class RecessReflectionClass extends ReflectionClass {
function getProperties() {
Library::import('recess.lang.RecessReflectionProperty');
$rawProperties = parent::getProperties();
$properties = array();
foreach($rawProperties as $rawProperty) {
Expand All @@ -32,19 +30,21 @@ function getProperties() {
return $properties;
}
function getMethods($getAttachedMethods = true){
Library::import('recess.lang.RecessReflectionMethod');
$rawMethods = parent::getMethods();
$methods = array();
foreach($rawMethods as $rawMethod) {
$method = new RecessReflectionMethod($this->name, $rawMethod->name);
$methods[] = $method;
}
if($getAttachedMethods && $this->isSubclassOf('RecessClass')) {
if($getAttachedMethods && $this instanceof RecessClass) {
// $attachedMethods = RecessClass::getAttachedMethods($this->name);
$methods = array_merge($methods, RecessClass::getAttachedMethods($this->name));
}
return $methods;
}
function getAnnotations() {
Library::import('recess.lang.Annotation');
$docstring = $this->getDocComment();
if($docstring == '') return array();
else {
Expand Down

0 comments on commit f868764

Please sign in to comment.