Yii skeleton app

Hi Jonah,

Quote

Though an exception does not happen when I clicked the user button, another exception happens when I clicked username in userlist. Exception follows.

Quote

PHP Error

Description

YiiBase::include(Post.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory

Source File

Now everything looks fine. :) There’s no exception when I do anything so far.

I have found an error. Below is how to reproduce it.

(1) mysql < *.sql

(2) Login admin/admin

(3) Delete user 'Nevada' (3rd user)

(4) Click 'Post' menu

I'm not getting that error.  Do you remember what the error said?

Also I don't know what you mean in step one.

Is the foreign key constraint set up as in main.sql?:

--


-- Constraints for table `post`


--


ALTER TABLE `post`


  ADD CONSTRAINT `post_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

Sorry but I thought you can easily reproduce this error.

(1) Initialize mysql database.

  $ mysql -ppassword database <tables.sql

  $ mysql -ppassword database <testData_Post.sql

  $ mysql -ppassword database <testData_User.sql

Quote

PHP Error

Description

Trying to get property of non-object

Source File

/var/www/html/yii/demos/yii-skeleton-app/protected/views/post/list.php(18)

00006: $items[] = array('New Post',array('create'));

00007: if (Yii::app()->user->hasAuth(Group::ADMIN)){

00008:    $items[] = array('Admin',array('admin'));

00009: }

00010: $this->widget('application.components.Menu',array('items'=>$items));

00011:

00012: $this->widget('CLinkPager',array('pages'=>$pages));

00013: ?>

00014: <?php foreach($posts as $n=>$post) { ?>

00015: <div class="post">

00016: <h3><?php echo CHtml::link($post->title,array('show','id'=>$post->id)); ?></h3>

00017: <p class="summary">

00018: By <?php echo CHtml::link(CHtml::encode($post->user->username), array('user/show', 'id'=>$post->user->id)); ?>

00019: on <?php echo Time::nice($post->created); ?>

00020: </p>

00021:

00022: <?php echo $post->getMarkdown('content'); ?>

00023:

00024: </div>

00025: <?php } ?>

00026: <br/>

00027: <?php $this->widget('CLinkPager',array('pages'=>$pages)); ?>

Stack Trace

#0 /var/www/html/yii/framework/web/CBaseController.php(119): require()

#1 /var/www/html/yii/framework/web/CBaseController.php(88): PostController->renderInternal()

#2 /var/www/html/yii/framework/web/CController.php(652): PostController->renderFile()

#3 /var/www/html/yii/framework/web/CController.php(591): PostController->renderPartial()

#4 /var/www/html/yii/demos/yii-skeleton-app/protected/controllers/PostController.php(116): PostController->render()

#5 /var/www/html/yii/framework/web/actions/CInlineAction.php(32): PostController->actionList()

#6 /var/www/html/yii/framework/web/CController.php(265): CInlineAction->run()

#7 /var/www/html/yii/framework/web/filters/CFilterChain.php(128): PostController->runAction()

#8 /var/www/html/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()

#9 /var/www/html/yii/demos/yii-skeleton-app/protected/components/Controller.php(7): AccessControlFilter->filter()

#10 /var/www/html/yii/framework/web/filters/CInlineFilter.php(59): PostController->filterAccessControl()

#11 /var/www/html/yii/framework/web/filters/CFilterChain.php(125): CInlineFilter->filter()

#12 /var/www/html/yii/framework/web/CController.php(248): CFilterChain->run()

#13 /var/www/html/yii/framework/web/CController.php(225): PostController->runActionWithFilters()

#14 /var/www/html/yii/framework/web/CWebApplication.php(335): PostController->run()

#15 /var/www/html/yii/framework/web/CWebApplication.php(123): CWebApplication->runController()

#16 /var/www/html/yii/framework/base/CApplication.php(170): CWebApplication->processRequest()

#17 /var/www/html/yii/demos/yii-skeleton-app/index.php(11): CWebApplication->run()

I have found that the table 'post' is defined as a MyIsam in the table.sql. I think we should use InnoDB for relation. Actually, I edited table.sql and did the same thing, no error was found.

Ah, yes, it should be InnoDB, not myIsam.  I think that's why the post didn't get automatically deleted when it's user was.  I'm fixing it in the svn now

i built an application with this as the base, and upgrading to 1.04 of the framework broke my user authentication completely - you could access any action no matter what type of user you were.

Does anyone have any idea why? I would ideally still like to use 1.04 because of the new features included like aggregate relations.

Edit:reverted to 1.03 for the time being, but using 1.04 version of helpers for CHtml beginForm and endForm

Yes this happened to me, but I think I checked in a fix.  Are you using the latest SVN of the skeleton? The fix was in AccessControlFilter.php

BTW, right now is the best time to grab the SVN if you want to check this out, as I am using a copy of the skeleton myself to rebuild an old website of mine, and as I am using it I was able to find bugs and fix them, without introducing new features to the skeleton and thus probably new bugs.

Great to hear this!

I reverted all my access control filters to one based on the default RBAC at the moment due to time constraints.

Will explore the fixes when my time permits me to.

Jonah, I want to say thank you for your effort. This is a great project and I am using it for a real production. Saved me lots of time.

Thanks,

P.S. The original accessRules can block access according to IP, roles, Controllers, I wonder how we do it under this new accessRules.

Wonder what happen there is no download any more.

@foe#1

You can still get the SVN at

http://code.google.c…ii-skeleton-app

@moho

thanks!

With my version of the accessRules you can not specify ip addresses, roles, etc. It is basically a major simplification of Yii's accessRules, so I could write the access rules within my app really fast and efficiently, but it does not contain all the featues of Yii's access rules and may not be optimal for everyone.  I believe I documented what to change to revert back to the old accessRules.

Jonah, great move. Look forward to your change. I can change sth by myself but I would rather follow your design for possible enhancement in the future.

By the way, do you plan to add the "comment" feature in future revisions?

Yeah, I think I will.  Hopefully during summer vacation after finals week.  If anyone else implants it though, I would be happy to move it to the SVN (probably with some customizations though)

Hey,

Thanks a lot for the better skeleton application.

I am pretty new to PHP & Yii.

I am getting "Object not found" error when trying to access any page in skeleton app.

I have changed the yii path in index.php, created db, changed DB connection in config/main.php.

Home page is accessible but all other pages are not.

What could be the reason? Can anyone please help me?

What's the full error message it throws? or is that it?

Here it is:

Quote

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost

05/14/09 23:20:07

Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6

I'm trying the skeleton app to check if Yii can be the framework I'll use, thanks for this.

I attach a PHP file to check if the apache modules needed (autoindex and rewrite) for .htaccess and if directories are writable.

Does anyone know where I can download it ? I can't find it anywhere …

Quote

Does anyone know where I can download it ? I can't find it anywhere ..

Have a look at http://code.google.c…ource/checkout.

You can download the source via SVN there.

Greets

Thomas