put the line
define('AK_ERROR_REPORTING_ON_SCRIPTS', E_ALL);
in "yourapp/config/config.php", try to execute "script/generate controller Blog" again to see if there is an error
I don't know how to fix this problem but I found the same discussion here
do you have more than one php version installed? that is what caused problems for me. try to find out the path to your wamp php version and use it to call the script again.
probably this thread on another forum could help you. it seems like someone has a quite similar problem
raslam, you should check the path to your command line PHP binary by typing
which php
or
env php -i
it is quite possible that the PHP you've got linked to your apache is not the same than the included in your server PATH
A php script/framework cannot remove runtime functions so it is certainly a non Akelos error. You've got 2 php's, and you should either change the shebang line on your scripts to your production php binary or you should move the strange php binary out of your path and link the known one.
thanks bermi,
i have passed this step... now I have moved to
Connection to the database failed. mysqlt://root:******@localhost/akelos
that is posted by ichigo.
strange i set the database name to ncvacc and the config file created in folder akelos/config/config.php has the database name akelos. i have change it to mine but why it didn't pick my values from the database step of configuration wizard?
Hi,
I'm back and well... I am quite successful with XAMPP. It was quite easy to setup with xamp. Also when i started the Blog project screen cast (by Bermi), I got stuck at adding new post. It was a strange error. i wasn't using akelos from SVN then I installed SVN and downloaded the latest version from the trunk. I proceeded further and i'm stuck at comments section of blog tutorial.
Every thing was going fine and I followed it correctly. Problem is... my comments for a post aren't showing. After executing the comment installer, it has a statement
Ak::import('post,comment');
which relates comments with post, i think the problem is at this statement. first comment of post(1) is added to the table and I can see it but isn't showing up but that comment isn't showing up on post show action.
I also added the Add Comment form and it posts correctly and adds a comment into database table but comment doesn't apprear.
Please could you paste your code here http://akelos.pastebin.com?
It will be easier to follow the problem and people can help you modifying your code
Ok salavert,
I'm at my home now and don't have the code with me. i have created the blog application in my office. though lookin at the code i do remember the lines now. Ok, here goes:
comment_installer.php
function up_1()
{
/* table creation code by the model generator */
//the columns are id,body,post_id
Ak::import('post,comment');
$Post = new Post(1);
$Post->comment->create(array('body'=>'I love my country'));
$Post->save();
}
show.tpl of Post model:
{loop post.comments}
<hr />
<p>{comment.body}</p>
{end}
If you still need more code then i'll be able to post it after exactly 12 hrs from now.
Alright, I figured out why comments didn't show up. Its these two lines that were missing in my blog controller.
var $models = 'post,comment';
And the second line in show action handler
$this->post = $this->Post->find(@$this->params['id'], array('include'=>'comments'));
The above line had missing 2nd argument for find() method. what exactly this "include" parameter does?
Loads the associated comments for current Post, but it's not correct at all, you should write
$this->Post = $this->Post->find(@$this->params['id'], array('include' => array('comments')));
Or
$this->Post = $this->Post->find(@$this->params['id']);
$this->Post->comment->load();
But last case is an extra sql request to db, but in some cases is useful.
thanks salavert to giving me an alternate. I don't know the framework yet so I wanted to know what include can do to have an idea where it can be utilized.
now when i reached the testing section of screen cast and i ran unit test it failed at comment_installer.php
function up_1()
{
/**/
$this->createTable('comments', "
id,
body,
post_id
");
/**/
Ak::import('post,comment');
$Post = new Post(1);
$Post->comment->create(array('body' => 'I love my country'));
$Post->save();
}
Error says "Call to member function create on non-object". The line reference is the
$Post->comment->create(array('body' => 'I love my country'));
I tried this example and worked for me, did you already defined the relation between Post an Comment at
~/model/post.php
~/model/comment.php
Or maybe becouse database is empty and Post with id 1 not exists
$Post =& new Post(1);
Yes the relations are already defined. For ~/model/comment.php
var $belongs_to = "post";
For ~/model/post.php
var $has_many = "comments";
I think, even if the relations are already defined and post(1) does exist in database the comment create() method should work.
And if you try with
$Post =& Post->find(1, array('include' => array('comments') ));
Or
$Post =& new Post(1);
$Post->comment->load();
And later
$Post->comment->create(array('body' => 'I love my country'));
1 to 27 of 27