-
svu posted...
Great tutorial. How does phpactiverecord compare to Doctrine?
-
obehdi posted...
Hi. I'm using CI 2.1.0 and php-activerecord 0.0.2 and even using the MY_Loader.php file you recommended, I'm still getting the “Class User not found” fatal error. Are you aware of any problems with the newest version of CI and php-activerecord?
-
obehdi posted...
Actually they have just released a fix today! :) http://twitter.com/#!/getsparks/status/142085389274988544
About php-activerecord 0.0.2, I've made an installation from scratch using sparks via command line.
-
ian posted...
Oops well I guess AR doesn't like when a constructor exists in the User class. It's my default shortcut script for a ci class to have a constructor with parent::__construct inside it because I didn't know there would be cases where that would affect anything.
I'll play around and see what I can put in this model and what I can't. Oh and I'll watch the next video where I'll probably see. That would be a smart thing for me to do ;-)
Thanks
-
daslicht posted...
Netbeans highlights : ActiveRecord\Model as an error?
Is \Model Nessisary? or is ythere a way to fix Netbeans somehow?
-
Yuri posted...
Thanks man! But if the charset in the database utf-8, and contains russian text i see ???? instead of the Russian text. Please help fix it.
-
Ted Stein posted...
Thanks. You are exactly right that my PHP needed to be updated. Again, great tutorials. I have been doing Drupal module development for the past couple years and your videos really did a great job at helping me understand how to set up an MVC / PHP ActiveRecord site with CI. Looking forward to the next in the series...
-
Ted Stein posted...
Great set of tutorials.
I went through them on my desktop (Linux) and everything worked great. I recently moved my application over to my laptop (OS X) and I now get this error (php-activerecord install is broken, I believe):
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /Applications/MAMP/htdocs/ci_pe/codeigniter/sparks/php-activerecord/0.0.1/libraries/PHPActiveRecord.php on line 38
Parse error: syntax error, unexpected T_STRING in /Applications/MAMP/htdocs/ci_pe/codeigniter/sparks/php-activerecord/0.0.1/libraries/PHPActiveRecord.php on line 38
Any thoughts? Spark is telling me everything went fine, and I even reinstalled (failed) and manually removed and installed again (also failed). I get no spark error messages, but the site won't bootstrap.
I also sent an e-mail through your contact form, offering to pay for some consulting assistance (which I am still interested regardless of whether you answer this here), but thought it might be helpful here in case someone else has the same problem.
-
Tanver posted...
@obehdi, I am using the CI 2.1.0 with php-activerecord 0.0.1 [am not sure where to find php-activerecord 0.0.2], but am using the MY_Loader.php file from the Part 2 of this tutorial and it is working good for me. Try updating your MY_Loader.php file from the Part 2 of this tutorial and see if it helps.
-
Shawn McCool posted...
You're right. I posted a comment that fixes the issue.
-
Shawn McCool posted...
Yea, sorry about that. I realize that I could have done many more takes etc to really polish up the screencasts. Realistically though, my focus is on client work and I generally complete these in a single take over the course of 30-45 minutes (including editing, etc). I really enjoy making these kinds of resources. Hopefully, some day I'll have the kind of money necessary to really spend my time on these.
-
Shawn McCool posted...
The video will only work embedded in heybigname.com. It must be watched on heybigname.com. Alternately, you can go to Vimeo and search for Big Name and watch / download it there.
-
Shawn McCool posted...
The class is not found, not the database table. So, there is a problem with either the sparks loader class modification or the php-activerecord spark isn't in the right folder.
-
Shawn McCool posted...
Table names represent collections of many items. Therefore, they are pluralized. Models represent a model of a single item. Therefore, they are singular.
You have a user who, when combined with other users is stored in a collection of "users."
I don't know if that's helpful or just more confusing. But, tables are plural.
-
Shawn McCool posted...
No, you don't have to register the model. Try putting debug data in your loader. Also make sure that your model is correctly named. It should have the first letter capitalized.
-
Shawn McCool posted...
I honestly can't compare as I haven't used Doctrine.
I imagine that PHP-ActiveRecord is much more lightweight and easy to use while Doctrine may have more features to offer.
-
Shawn McCool posted...
I don't agree with your post. It's not broken in the context of its own existence. However, find me a project that doesn't extend core classes. CodeIgniter's fundamental value is in its basic ability to mold to the developer's intent. Extending core classes is a basic component of this. Without this we're all better off with FuelPHP or just switching to Django or Rails. I like CI because of the way the developers choose which features to develope based on the plasticity of the framework.
I'm not sure what made you defensive about the situation. I have nothing against the CI developers. I just don't believe that due diligence was performed on this release. Not a big deal, life will go on.
-
Shawn McCool posted...
Hi Ted,
While unfortunately we don't have the time required to help with one-off consulting. But, I would be more than happy to post responses in a public setting in which others can benefit, as you mentioned in your post.
You're having this issue because your PHP version is not up-to-date enough. You must be running PHP 5.3 (which implements many new features that are absolutely necessary for many of the things that we do).
-
Shawn McCool posted...
Glad you liked it. I have a lot of fun making them. It's good to get back into it and talk about some new algorithms.
-
Shawn McCool posted...
First, have you been following along with the code or are you retrofitting php-ar into your own project?
If you try to download the part1.zip file available in the article does it work for you?
What CI version? I'm assuming 2.0.3.
If you do $this->load->spark('php-activerecord/0.0.1'); before trying to access the User class does it work?
Did you make sure that your file is name User.php (singular with the first letter capitalized)?
-
Senthil posted...
Not sure if this is new but I have message on the box where the video should be playing stating: "Sorry, The creator of this video has not given you permission to embed it on this domain. This is a Vimeo Plus feature"
-
Myself posted...
chan! PostgreSql is not supported... yet.
-
Me posted...
great tutorial thanks
most commonly user word: Err lol !!
-
Justin posted...
I'm brand new to CodeIgniter but just to note, something was updated in the System folder in version 2.0.3 which causes the 'User' class to not be loaded.
-
Joseph Castro Riiquelme posted...
Great tutorial, very helpful and explicative. very easy to follow.
I have only one problem, I tried with PostgreSql, but I get the next error:
Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message 'ActiveRecord\PostgreAdapter not found!' in C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php:127 Stack trace: #0 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php(98): ActiveRecord\Connection::load_adapter_class('postgre') #1 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\ConnectionManager.php(33): ActiveRecord\Connection::instance('postgre://postg...') #2 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Table.php(103): ActiveRecord\ConnectionManager::get_connection(NULL) #3 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Table.php(80): ActiveRecord\Table->reestablish_connection(false) #4 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Table.php(61): ActiveRecord\Table->__construct('User') #5 C:\xampp\htdocs\part1\sparks\php-activ in C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php on line 127
where "Postgre" adapter is search in Php-ActiveRecord folder, but here is called "Pgsql", and when configure in CodeIgniter, must be use "Postgre".
How can pass the real driver, for Php-Activerecord, works?
Grettings to all.
-
Jmatosjr posted...
Great tutorial !!
but I got this odd situation ....
I´ve created a table named user (lowercase singular) when I try to use it as in the screencast
$user = User::create(array(
'username' => 'testuser',
'password' => 'testpass'
));
I got an error like 'table Users not exist' (FirstCapital Plural) ... what I figured out was tablename must be the plural of classname, it that true?
Thanks,
Jose
-
Jholcroft posted...
I had an issue with this I was following along but am using activerecord 0.0.2 and codeigniter 2.1.0. Your part1.zip works as does adding "$this->load->spark('php-activerecord/0.0.2');" which presumably means on my version it is not autoloading but I cannot work out why.
My autoload line is: $autoload['sparks'] = array('php-activerecord/0.0.2');
-
Idavid Str posted...
just go here http://getsparks.org/static/install/MY_Loader.php.txt an update the core MY_Loader
-
Ian posted...
Hey Mr McCool. Thanks for these updated videos. There are old prehistoric codeigniter tuts all over the internet and I've been having to try and figure out the changes to 2.0.3 so it's been a learning experience.
I have only one problem and it's not version related. I have two records in the db just like yours. AR returns two objects with print_r. But they are both empty. I'm scratching my head here trying to figure out why I have two empty objects which makes it obvious that AR found two records.
Thanks again
-
Gyorgy Kovacs posted...
I've just started this tutorial but somehow I need to modify
$spark_path = APPPATH . '/../' . SPARKPATH . $spark . '/';
in loader. Well I'm new in CI, so maybe my bad, eh?
-
George posted...
For the record, CI isn't broken. Third party code is broken. See this post - http://codeigniter.com/forums/viewthread/198107/
-
Dominique Rashid posted...
Zom when you recoding
-
Daslicht posted...
do you have found a solution?
-
Daslicht posted...
I use:
http://getsparks.org/static/install/MY_Loader.php.txt
And yes my User.php and class User are the same :/
-
Daslicht posted...
Hi,
when manually loading spark in the welcome controller like this:
$this->load->spark('php-activerecord/0.0.2');
anything is working properly.
But hwen I try to autoload like this:
$autoload['sparks'] = array('php-activerecord/0.0.2');
I get :
Fatal error: Class 'User' not found in C:\wamp\www\spark\SHR\application\controllers\welcome.php on line 23
Any idea why ?
-
Cfdemirkan posted...
that s great tutorial thanks !
-
Bockwurst posted...
hi,
thanks for the fast reply.
"If you try to download the part1.zip file available in the article does it work for you?"
I tryed it now, but the same error.
"What CI version? I'm assuming 2.0.3."
Now i have version 2.03.
"If you do $this->load->spark('php-activerecord/0.0.1'); before trying to access the User class does it work?"
I tried it, but its all the same :(
"Did you make sure that your file is name User.php (singular with the first letter capitalized)? "
Yes :(
-
Bockwurst posted...
"If you’re using CodeIgniter 2.0.3+ and get the fatal error, “Class User not found” you should update your MY_Loader.php from http://getsparks.org/static/install/MY_Loader.php.txt. This will resolve the issue."
i dit this, but the fatal error is always there :(
-
BeniRose posted...
I'm getting "Class 'Song' not found in /user/public_html/musictable/application/controllers/songs.php on line 21" when I definitely have Song.php in my Models folder. Song.php looks like this:
class Song extends ActiveRecord\Model
{
static $table_name = 'Song';
static $primary_key = 'SongID';
}
I added those two variables because I didn't want to change my DB structure. Any idea why this isn't working? Can you not break convention when using PHP-active record with CI? Or am I missing some inclusion code somewhere?
-
BeniRose posted...
I tried just adding $this->load->spark('php-activerecord/0.0.2'); to my controller and got some new error messages:
PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /user/public_html/musictable/sparks/php-activerecord/0.0.2/libraries/PHPActiveRecord.php on line 48
PHP Parse error: syntax error, unexpected T_STRING in /user/public_html/musictable/sparks/php-activerecord/0.0.2/libraries/PHPActiveRecord.php on line 48
Looks like maybe I have a bad PHPActiveRecord installation?
-
BeniRose posted...
Hmm, I have MY_Loader in place, and $autolaod['sparks'] = array("php-activerecord/0.0.2"); in my autoload.php and that's not throwing any errors so I imagine it's loading in correctly. I don't have to register the model in my controller or anything, right?
-
BeniRose posted...
Did some googling and this error is related to not having PHP v5.3, I have 5.2.17 on my server. Perhaps 0.0.1 will work with that, I'll give it a try.
These kind of configuration and version issues is why I stopped using Django!
UPDATE: Looks like I'm DOA, as even 0.0.1 requires 5.3. Any recommendations for other ORMs in CI? I was trying to follow your advice you gave me on your old screen-cast about building better models, but seems like it's not going to work out!
-
Admin posted...
im trying to get to where you are in the video,
i installed and followed every step and i am in the cmd.exe
i went to d: and then put in cd web but it is not showing me the sparks