Jake Hawkes Mon Jun 28 00:32:21 -0400 2010

Subject: Bug Reports?

First of all, I'm pretty happy with PHP ActiveRecord so far and I really appreciate what you guys have done.

Second, do you guys have a way for users to submit bug reports? Here are the items I've noticed which may or may not be bugs.

1) I have a class named "Base" and when it gets pluralized, it becomes "Bases" but when "Bases" gets singularized it becomes "Basis". It appears that I can get around this by using the singular form in my has_many association (although I haven't tested this thoroughly), eg:
static $has_many = array(array('base'));
instead of
static $has_many = array(array('bases'));
Not sure what the best fix for this is but you might consider encouraging users in the docs to use the singular form of their class instead of the plural form. Here's the stack trace:

Fatal error: Uncaught exception 'ReflectionException' with message 'Class Basis does not exist' in .../php-activerecord/lib/Reflections.php:33 Stack trace:
#0 .../php-activerecord/lib/Reflections.php(33): ReflectionClass->_construct('Basis')
#1 /.../php-activerecord/lib/Relationship.php(259): ActiveRecord\Reflections->add('Basis')
#2 .../php-activerecord/lib/Relationship.php(254): ActiveRecord\AbstractRelationship->set_class_name('Basis')
#3 .../php-activerecord/lib/Relationship.php(437): ActiveRecord\AbstractRelationship->set_inferred_class_name()
#4 .../php-activerecord/lib/Table.php(461): ActiveRecord\HasMany->
#5 .../php-activerecord/lib/Table.php(62): ActiveRecord\Table->set_associations()
#6 .../php-activerecord/lib/Relationship.php(612): ActiveRecord\Table::load('User')
#7 .../php-activerecord/lib/Table.php(469): ActiveR in /.../php-activerecord/lib/Reflections.php on line 33

2) The second item I noticed is that when you keyify a class such as BuildingType, you keyify it as "buildingtype_id" whereas I would expect most developers would have the column in their database as "building_type_id"... though I could be wrong.

I apologize that this post has gotten so long, but I couldn't find anywhere else to put it. Again, great work on this project! I really appreciate the time and effort you guys put in so that the rest of us don't have to!

Jake Hawkes Mon Jun 28 00:34:30 -0400 2010

Sometimes I'm stupid. It just occurred to me that I could have posted this on github.

Kien La Mon Jun 28 18:10:31 -0400 2010

1) We do already encourage singular class names in the Conventions section of the wiki.

2) I've committed a patch to fix this. The keyify() method was calling classify() where it should have been calling underscorify().