Please HELP!!!
I am having no luck and am totally lost:
I tried creating a new test project with just the sfGuardUserProfile
model class but have had no luck.
This how I went about it
php symfony generate:project test
php symfony generate:app --escaping-strategy=on --csrf-
secret=UniqueSecret frontend
php symfony plugin:install sfGuardPlugin
edited the database.yml and schema.yml files in config/
php symfony propel:build-all-load --noconfirmation
php symfony propel:build-forms
php symfony propel:build-filters
php symfony guard:create-user admin <Password>
php symfony guard:promote admin
Then I changed the myUser class to extend sfGuardSecurityUser instead
of Basic, changed the security.yml and settings.yml files to switch on
security and enable the sfGuardAuth module.
My schema.yml file:
propel:
# The User profile table
sf_guard_user_profile:
_attributes: { phpName: sfGuardUserProfile }
id: ~
user_id: { type: integer, foreignTable: sf_guard_user,
foreignReference: id, required: true, onDelete: cascade }
first_name: { type: varchar(20), required: true }
last_name: { type: varchar(20), required: true }
email: { type: varchar(255), required: true }
address: { type: varchar(50), required: true }
city: { type: varchar(50), required: true }
state: { type: varchar(50), required: true }
country: { type: varchar(50), required: true }
profession: { type: varchar(50), required: true }
profile_pic: { type: varchar(255), required: false }
is_public: { type: boolean, required: true, default: 1 }
is_active: { type: boolean, required: true, default: 0 }
created_at: ~
updated_at: ~
Thanks
Zain
On Feb 24, 1:25 pm, zabbasi <[email protected]> wrote:
> Hi
> My new Plan of Action is to create a new sample project with just the
> sfGuardUserProfile class and see what happens. I think I am missing
> something really small somewhere and maybe if I do the entire process
> again I will find what the problem is.
>
> PS: I am using sfGuardPlugin 3.1.3 - symfony v.1.2.2 - php 5.2.8.
>
> Please send in your suggestions.
>
> Thanks
> Zain
>
> On Feb 24, 2:00 am, zabbasi <[email protected]> wrote:
>
> > Sorry
> > I am using sfGuardPlugin 3.1.3 not 3.1.1
>
> > An update: I changed the table PHP name from UserProfile to
> > sfGuardUserProfile in the schema file. No Luck.
>
> > Thanks
> > Zain
>
> > On Feb 24, 12:39 am, zabbasi <[email protected]> wrote:
>
> > > Hi Everyone
>
> > > I see the same problem as mentioned by this post (http://
> > > groups.google.com/group/symfony-users/browse_thread/thread/
> > > 41f54b8c71ce607f/ad08bf3766215dce?lnk=gst&q=user
> > > +profile#ad08bf3766215dce - I have noted something strange about
> > > sfGuard 3.1.1.
>
> > > I created a table UserProfile for my project. Which is the
> > > profile_class for sfGuardUser.
>
> > > I get an error 500 everytime someone logins with a user that is
> > > created directly from sfGuardUser's admin pages.) but the solution (re-
> > > build the filters) does not work.
>
> > > The reason I think the solution does not work is because none of the
> > > filter files change (SVN does not detect a modification).
>
> > > Note: I created the table first then ran propel:build-all-load, I then
> > > created a config/app.yml file and included the following -
> > > all:
> > > sf_guard_plugin:
> > > success_signout_url: @homepage
> > > profile_class: UserProfile
>
> > > Then I ran the propel:build-all-load command again followed by
> > > propel:build-forms and propel:build-filters because propel:build-all-
> > > load gave the following warning:
>
> > > Phing was run before and used many custom classes that might conflict
> > > with
> > > your model classes. In case of errors try running "propel:build-
> > > forms" and
> > > "propel:build-filters" alone. This is due to a PHP limitation that
> > > cannot be
> > > fixed in symfony.
>
> > > A stack trace of the 500 error:
>
> > > 500 | Internal Server Error | PropelException
> > > Unable to execute INSERT statement. [wrapped: SQLSTATE[HY000]: General
> > > error: 1364 Field 'first_name' doesn't have a default value]
> > > stack trace
>
> > > * at ()
> > > in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib
> > > \vendor\propel\util\BasePeer.php line 299 ...
> > > 296.
> > > 297. } catch (Exception $e) {
> > > 298. Propel::log($e->getMessage(),
> > > Propel::LOG_ERR);
> > > 299. throw new PropelException("Unable to
> > > execute INSERT statement.", $e);
> > > 300. }
> > > 301.
> > > 302. // If the primary key column is auto-
> > > incremented, get the id now.
> > > * at BasePeer::doInsert(object('Criteria'), object('DebugPDO'))
> > > in SF_ROOT_DIR\lib\model\om\BaseUserProfilePeer.php line 819 ...
> > > 816. // use transaction because $criteria
> > > could contain info
> > > 817. // for more than one table (I guess,
> > > conceivably)
> > > 818. $con->beginTransaction();
> > > 819. $pk = BasePeer::doInsert($criteria,
> > > $con);
> > > 820. $con->commit();
> > > 821. } catch(PropelException $e) {
> > > 822. $con->rollBack();
> > > * at BaseUserProfilePeer::doInsert(object('UserProfile'), object
> > > ('DebugPDO'))
> > > in SF_ROOT_DIR\lib\model\om\BaseUserProfile.php line 1010 ...
> > > 1007. // If this object has been modified,
> > > then save it to the database.
> > > 1008. if ($this->isModified()) {
> > > 1009. if ($this->isNew()) {
> > > 1010. $pk = UserProfilePeer::doInsert
> > > ($this, $con);
> > > 1011. $affectedRows += 1; // we are
> > > assuming that there is only 1 row per doInsert() which
> > > 1012. // should
> > > always be true here (even though technically
> > > 1013. //
> > > BasePeer::doInsert() can insert multiple rows).
> > > * at BaseUserProfile->doSave(object('DebugPDO'))
> > > in SF_ROOT_DIR\lib\model\om\BaseUserProfile.php line 959 ...
> > > 956.
> > > 957. $con->beginTransaction();
> > > 958. try {
> > > 959. $affectedRows = $this->doSave($con);
> > > 960. $con->commit();
> > > 961. foreach (sfMixer::getCallables
> > > ('BaseUserProfile:save:post') as $callable)
> > > 962. {
> > > * at BaseUserProfile->save(object('DebugPDO'))
> > > in SF_ROOT_DIR\plugins\sfGuardPlugin\lib\model\om
> > > \BasesfGuardUser.php line 847 ...
> > > 844. if ($this->collUserProfiles !== null) {
> > > 845. foreach ($this->collUserProfiles as
> > > $referrerFK) {
> > > 846. if (!$referrerFK->isDeleted()) {
> > > 847. $affectedRows +=
> > > $referrerFK->save($con);
>
> > > 848. }
> > > 849. }
> > > 850. }
> > > * at BasesfGuardUser->doSave(object('DebugPDO'))
> > > in SF_ROOT_DIR\plugins\sfGuardPlugin\lib\model\om
> > > \BasesfGuardUser.php line 790 ...
> > > 787.
> > > 788. $con->beginTransaction();
> > > 789. try {
> > > 790. $affectedRows = $this->doSave($con);
> > > 791. $con->commit();
> > > 792. foreach (sfMixer::getCallables
> > > ('BasesfGuardUser:save:post') as $callable)
> > > 793. {
> > > * at BasesfGuardUser->save(null)
> > > in SF_ROOT_DIR\plugins\sfGuardPlugin\lib\user
> > > \sfGuardSecurityUser.class.php line 83 ...
> > > 80.
> > > 81. // save last login
> > > 82. $user->setLastLogin(time());
> > > 83. $user->save($con);
> > > 84.
> > > 85. // remember?
> > > 86. if ($remember)
> > > * at sfGuardSecurityUser->signIn(object('sfGuardUser'), '')
> > > in SF_ROOT_DIR\plugins\sfGuardPlugin\modules\sfGuardAuth\lib
> > > \BasesfGuardAuthActions.class.php line 37 ...
> > > 34. if ($this->form->isValid())
> > > 35. {
> > > 36. $values = $this->form->getValues();
> > > 37. $this->getUser()->signin($values['user'],
> > > array_key_exists('remember', $values) ? $values['remember'] : false);
> > > 38.
> > > 39. // always redirect to a URL set in app.yml
> > > 40. // or to the referer
> > > * at BasesfGuardAuthActions->executeSignin(object('sfWebRequest'))
> > > in SF_ROOT_DIR\lib\vendor\symfony\lib\action\sfActions.class.php
> > > line 53 ...
> > > 50. }
> > > 51.
> > > 52. // run action
> > > 53. return $this->$actionToRun($request);
> > > 54. }
> > > 55. }
> > > 56.
> > > * at sfActions->execute(object('sfWebRequest'))
> > > in SF_ROOT_DIR\lib\vendor\symfony\lib\filter
> > > \sfExecutionFilter.class.php line 90 ...
> > > 87. {
> > > 88. // execute the action
> > > 89. $actionInstance->preExecute();
> > > 90. $viewName =
> > > $actionInstance->execute($this->context->getRequest());
>
> > > 91. $actionInstance->postExecute();
> > > 92.
> > > 93. return is_null($viewName) ? sfView::SUCCESS :
> > > $viewName;
> > > * at sfExecutionFilter->executeAction(object
> > > ('sfGuardAuthActions'))
> > > in SF_ROOT_DIR\lib\vendor\symfony\lib\filter
> > > \sfExecutionFilter.class.php line 76 ...
> > > 73. return sfView::SUCCESS;
> > > 74. }
> > > 75.
> > > 76. return $this->executeAction($actionInstance);
> > > 77. }
> > > 78.
> > > 79. /**
> > > * at sfExecutionFilter->handleAction(object('sfFilterChain'),
> > > object('sfGuardAuthActions'))
> > > in SF_ROOT_DIR\lib\vendor\symfony\lib\filter
> > > \sfExecutionFilter.class.php line 42 ...
> > > 39. {
> > > 40. $timer = sfTimerManager::getTimer(sprintf
> > > ('Action "%s/%s"', $actionInstance->getModuleName(),
> > > $actionInstance->getActionName()));
>
> > > 41.
> > >
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---