Login | Register
My pages Projects Community openCollabNet

Discussions > users > Three issues

propel
Discussion topic

Back to topic list

Three issues

Reply

Author Anthony Sheetz <sheetzam at zurka dot com>
Full name Anthony Sheetz <sheetzam at zurka dot com>
Date 2007-10-18 08:32:55 PDT
Message Hopefully someone can give me some help on either of the first two,
and the third is a bug someone might want to fix...
First, some basics: We're trying to use Propel on Ubuntu Serever
7.04, PHP 5.2.1, MySQL, and installing Propel using PEAR.

1. Using Propel 1.2.1, when we save an object, related objects are
not also saved. This seems to be specific to MySQL, as the related
row insert in the demo works with SQLite db.
Put another way, using the DB schema excerpt shown below, and the
code excerpt below, the user is saved, but not the role.

2. Using Propel 1.3.0beta2, and the same schema and code, we run in
to another problem. With both the demo code from the Trac site, and
our own code we get errors.
With our own we get this error:
Catchable fatal error: Object of class Roles could not be converted
to string in /usr/share/php/prope​l/util/BasePeer.php on line 290.
With the bookstore demo code, we get this error: Fatal error: Call to
undefined method BasePeer::getmapbuilder().

3. There's a minor bug in the generator parser for the XML. If you
look at the DB schema below, the validator for password ends up
having a bug in it once it's through the propel generator. The '
mark is not escaped, and so fails execution.

Any help anyone can offer would be greatly appreciated. We'd like to
start using Propel, but just can't seem to get it working.
Anthony Sheetz
Zurka Interactive




DB Schema:

<database name="photoManager">
         <table name="roles" idMethod="native">
                 <column name="role_id" type="INTEGER"
required="true" primaryKey="true" autoIncrement="true" />
                 <column name="name" type="VARCHAR" size="255"
required="true" />
         </table>

         <table name="users" idMethod="native">
                 <column name="user_id" type="INTEGER"
required="true" primaryKey="true" autoIncrement="true" />
                 <column name="first_name" type="VARCHAR" size="255" />
                 <validator column='first_name'>
                         <rule name='match' value='/^[a-zA-Z ]+$/'
message="Name can only contain letters or spaces"/>
                 </validator>
                 <column name="last_name" type="VARCHAR" size="255" />
                 <validator column='last_name'>
                         <rule name='match' value='/^[a-zA-Z ]+$/'
message="Name can only contain letters or spaces"/>
                 </validator>
                 <column name="username" type="VARCHAR" size="255"
required="true" />
                 <column name="password" type="VARCHAR" size="255"
required="true" />
                 <validator column='password'>
                         <rule name='match' value='/(?=^.{8,30}$)(?=.*
\d)(?=.*[a-z])(?=.*​[A-Z])(?=.*[!@#$%^​&amp;*()_+}{&​quot;&quot;
:;&apos;?/&g​t;.&lt;,]).*$/'​ message="Password must have at least 1
small-case letter, at least 1 Capital letter, at least 1 digit,
at least 1 special character. Length should be between 8-30
characters. Spaces allowed. The sequence of the characters is not imp
ortant."/>
                 </validator>
                 <column name="email" type="VARCHAR" size="255" />
                 <column name="role" type="INTEGER" />
                 <foreign-key foreignTable='roles'>
                         <reference local='role' foreign='role_id' />
                 </foreign-key>
         </table>
...
</database>

Code Excerpt
<?php
// Set the include
set_include_path("./​build/classes" . PATH_SEPARATOR . get_include_path
());
set_include_path("/u​sr/share/php/propel"​. PATH_SEPARATOR .
get_include_path());
require_once 'propel/Propel.php';
Propel::init("./buil​d/conf/photoManager-​conf.php");
require_once 'photoManager/Roles.php';
require_once 'photoManager/Users.php';

$role = new Roles();
$role->setName("users");

$user = new Users();
$user->setUserna​me("sheetzam");
$user->setPasswo​rd('1234xX*1234');
$user->setRole($role);

if(!$user->validate()){
         echo "errors: ";
         $errors = $user->getValida​tionFailures();
         foreach($errors as $key => $value){
                 echo "validation error - ".$value->getMessage
($key)."\n";
         }
}
$user->save();
?>

« Previous message in topic | 1 of 15 | Next message in topic »

Messages

Show all messages in topic

Three issues Anthony Sheetz <sheetzam at zurka dot com> Anthony Sheetz <sheetzam at zurka dot com> 2007-10-18 08:32:55 PDT
     Re: [propel] Three issues hlellelid Hans Lellelid 2007-10-18 09:30:30 PDT
         Re: [propel] Three issues hlellelid Hans Lellelid 2007-10-18 09:36:17 PDT
             Re: [propel] Three issues hlellelid Hans Lellelid 2007-10-18 09:46:05 PDT
                 Re: [propel] Three issues Anthony Sheetz <sheetzam at zurka dot com> Anthony Sheetz <sheetzam at zurka dot com> 2007-10-18 10:40:05 PDT
                     Re: [propel] Three issues hlellelid Hans Lellelid 2007-10-18 10:42:27 PDT
                 Re: [propel] Three issues Anthony Sheetz <sheetzam at zurka dot com> Anthony Sheetz <sheetzam at zurka dot com> 2007-10-19 08:16:37 PDT
                     Re: [propel] Three issues hlellelid Hans Lellelid 2007-10-19 08:20:53 PDT
                         Re: [propel] Three issues Anthony Sheetz <sheetzam at zurka dot com> Anthony Sheetz <sheetzam at zurka dot com> 2007-10-19 08:31:48 PDT
                             Re: [propel] Three issues hlellelid Hans Lellelid 2007-10-19 09:28:15 PDT
                                 Re: [propel] Three issues Anthony Sheetz <sheetzam at zurka dot com> Anthony Sheetz <sheetzam at zurka dot com> 2007-10-19 09:45:21 PDT
                                     Re: [propel] Three issues Anthony Sheetz <sheetzam at zurka dot com> Anthony Sheetz <sheetzam at zurka dot com> 2007-10-19 10:37:36 PDT
                     Generated Peer classes Anthony Smith <anthony dot smith at fedex dot com> Anthony Smith <anthony dot smith at fedex dot com> 2007-10-19 12:07:16 PDT
                         RE: Generated Peer classes Anthony Smith <anthony dot smith at fedex dot com> Anthony Smith <anthony dot smith at fedex dot com> 2007-10-23 07:08:56 PDT
                             Re: [propel] RE: Generated Peer classes hlellelid Hans Lellelid 2007-10-23 07:12:16 PDT
Messages per page: