[symfony-users] Re: Shared hosting, Symfony and PHP

2008-09-18 Thread lionslair



On Sep 18, 10:09 pm, "Tom Boutell" <[EMAIL PROTECTED]> wrote:
> We are evaluating whether it is possible to deploy Symfony on a shared
> hosting server in a reasonably safe manner.
>
> So far my impression is that it can't really be done in a typical
> shared hosting environment. This is because Symfony needs to write to
> the cache folder, and the cache folder must be writable by "nobody."
> And our user account on the shared hosting server can only grant that
> permission by making the cache folder world writable.
>
> Since the cache folder is mapped into web server space and is visible
> in file system space to all of the other hosting customers on the box,
> this means that any customer on the box can simply modify the PHP
> files there to do whatever they'd like and then access our potential
> client's site in order to invoke them. Boom... we're pwn3d. (:
>
> There is a newer technique for executing PHP scripts called suPHP
> which allows PHP scripts to be invoked as the owner rather than as
> nobody, however this involves the overhead of running PHP as CGI and
> most shared hosting companies just don't offer it.
>
> * * *
>
> "World-writable" seems to be only part of the problem.
> "World-readable" is the other half. Some PHP applications avoid the
> filesystem entirely, relying entirely on the database. But your
> database password has to live in a PHP file somewhere, and that file
> has to be readable by nobody... which means that anyone else on the
> shared hosting server can get into your database and do whatever they
> darn well please.
>
> * * *
>
> Therefore my conclusion, so far, is that running Symfony on a shared
> host is not a safe choice, but that's probably true for pretty much
> any PHP site - Symfony based or otherwise. If you want to be even
> remotely safe, you must either use (1) suPHP or some other setup where
> PHP or all of Apache runs "as you," (2) a virtual machine (you have
> root and no one else can see your file system at all), or (3) a
> dedicated physical machine.
>
> This is so unpleasant, it seems like it must be overstating the case.
> Many reputable providers (pair.com, for instance) provide many tiers
> of shared hosting plans with increased features at each level, etc.
> etc. Can it really be true that it's all completely unsafe from the
> get-go? Or am I missing something?
>
> Thanks for your input folks!
>
> --
> Tom Boutell
>
> www.punkave.comwww.boutell.com


Have you read these links

http://trac.symfony-project.org/wiki/Deploying1.0ToASharedHost

http://trac.symfony-project.org/wiki/InstallingSymfonyOnSharedHostNoSsh

http://trac.symfony-project.org/wiki/HowToRedirectPublicHtmlToWebFolder

and this

http://trac.symfony-project.org/wiki/HostsSupportingSymfony

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Hosting images on a separate domain

2008-10-10 Thread lionslair

Maybe just app the path in your app folder.  Or over-ride the
sf_image_path

On Oct 10, 1:24 pm, Sumedh <[EMAIL PROTECTED]> wrote:
> Hi friends,
>
> I have been using web/images folder so far for storing images...
>
> But now I want to use a separate domain for images
> (images.example.com)...I'll continue to host them on same sever, but
> just configure the DNS for a separate images subdomain...
>
> Is there a ready made way to do this in symfony? Is image_path()
> helper useful in this case?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Hosting images on a separate domain

2008-10-12 Thread lionslair

You

On Oct 11, 2:57 pm, Sumedh <[EMAIL PROTECTED]> wrote:
> Thanks guys...
>
> Lionslair, how do I override the sf_image_path?
>
> On Oct 10, 2:16 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > Maybe just app the path in your app folder.  Or over-ride the
> > sf_image_path
>
> > On Oct 10, 1:24 pm, Sumedh <[EMAIL PROTECTED]> wrote:
>
> > > Hi friends,
>
> > > I have been using web/images folder so far for storing images...
>
> > > But now I want to use a separate domain for images
> > > (images.example.com)...I'll continue to host them on same sever, but
> > > just configure the DNS for a separate images subdomain...
>
> > > Is there a ready made way to do this in symfony? Is image_path()
> > > helper useful in this case?

I think if

sf_image_dir_name

and set it in the applications config/app.yml
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] symfony 1.2 nested sets schema generation

2008-12-03 Thread lionslair

According to the propel documentation you need to specify in the
schema.xml which field are to be the special fields used for nested
set implementations.

That's fine. However I generate my schema from my database so every
time I generate the schema from the database IO would loose the
settings for the nested set. Is there a way to pass or set as a
configuration for the symfony propel-build-schema --xml task the
settings for what fields in a specific table are that which should be
used for the nested set?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-15 Thread lionslair

Did either of you find a solution to how to make this work?

On Feb 6, 6:25 am, Timmy  wrote:
> I have two forms form 1 and form 2. Form 2 is embedded into form 1. On
> save form1 must be saved as a new row and therefore recieving a
> primary key, Afterwards this foreign key needs to be injected into
> form 2 before it can save.
>
> The only way i have figured out at the mo is after the form is valid.
> Instantiate the two models, populate them, add form2 model to form 1
> model then save.
>
> Isn't there an easier way?
>
> Thanx
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-15 Thread lionslair

I think that is basically same as what I have here.


The ServerForm

// ServerFormClass extends BaseServerForm

  public function configure()
  {

// remove some fields from the form
unset($this['created_at'], $this['updated_at'], $this
['server_key']);

//if ($this->isNew())
//{
//  unset($this['hardware_information']['server_id']);
//} // end if


$maintain_options = array(
   'Y' => 'Yes',
   'N' => 'No',
);

$this->widgetSchema['maintain']   = new sfWidgetFormChoice
(array('choices' => $maintain_options));
//$this->widgetSchema['contact_id']   = new
sfWidgetFormInputHidden();
$this->widgetSchema['contact_id'] = new
sfWidgetFormPropelChoice(array('model' => 'Contact', 'order_by' =>
array('Name', 'asc'), 'label' => 'Contact'));
$this->widgetSchema['server_type_id'] = new
sfWidgetFormPropelChoice(array('model' => 'ServerType', 'order_by' =>
array('Name', 'asc'), 'label' => 'Server Type', 'expanded' => true));
//  'default' => ServerTypePeer :: retrieveIdByName('server')


//echo $this->getObject()->getInstallDate("Y");
$years = range(date('Y') - 10, date('Y') + 15);


//$server_info = $this->getObject()->getServer


/*
 * check if the object is new
 */
if ($this->getObject()->isNew())
{
  $this->widgetSchema['install_date'] = new sfWidgetFormDate(array
('format' => '%day%/%month%/%year%', 'years' => array_combine($years,
$years), 'empty_values' => array('year' => date("Y"), 'month' => date
('m'), 'day' => date('d';
  $this->widgetSchema['next_date']= new sfWidgetFormDate(array
('format' => '%day%/%month%/%year%', 'years' => array_combine($years,
$years), 'empty_values' => array('year' => date('Y'), 'month' => date
('m'), 'day' => date('d';
  //  $this->widgetSchema['server_type_id']->setDefault
(ServerTypePeer :: retrieveIdByName('server'));
}
else
{
  $this->widgetSchema['install_date'] = new sfWidgetFormDate(array
('format' => '%day%/%month%/%year%', 'years' => array_combine($years,
$years), 'empty_values' => array('year' => $this->getObject()-
>getInstallDate('Y'), 'month' => $this->getObject()->getInstallDate
('m'), 'day' => $this->getObject()->getInstallDate('d';
  $this->widgetSchema['next_date'] = new sfWidgetFormDate(array
('format' => '%day%/%month%/%year%', 'years' => array_combine($years,
$years), 'empty_values' => array('year' => $this->getObject()-
>getNextDate('Y'), 'month' => $this->getObject()->getNextDate('m'),
'day' => $this->getObject()->getNextDate('d';
} // end if else

$this->widgetSchema->setLabels(array('notes' => 'Comments'));


// only embed if there is a type object (edit vs create)
if (!$this->getObject()->isNew())
{
  $this->embedForm('information', $this->getServerInfoObject());
  //  $this->embedForm('Hardware Information', new
ServerInfoForm(ServerInfoPeer :: retrieveByServerId($this->getObject()-
>getId(;
}
else
{
  $server_info_form = new ServerInfoForm();
  $server_info_form->getObject()->setServerId($this->getObject()-
>getId());
  $this->embedForm('Hardware Information', $server_info_form);

  unset($server_info_form['server_id']);
}

// unset($this['server_id']);
  }



How ever when I then save this new server and new record I get the two
records inserted and the server_id field within the server_info table
is not getting the id (server.id) value from the server table added to
it.

I have spent so much time trying to work this out.  All I want is when
the new server record is created and the embbed server_info fields are
submitted that the server_info record that is created then uses the
newly created server.id field that should populate the server_id field
of the server_info table

It is the exact same principle as the user and user profile
relationship.


On Mar 16, 12:42 am, justin_davis  wrote:
> I'm doing something like this, and this is my solution:
>
> Let's say you have two forms, one is an sfGuardUser form (Form 1), the
> other is a Profile form (Form 2) (representing those two models).
> When a new user is created, a new profile must be also created that
> depends on that record (Profile depends on sfGuardUser):
>
> (this is sfGuardUserForm.class.php):
>
>           $profileForm = new ProfileForm();
>           $profileForm->getObject()->setsfGuardUserId($this->getObject());
>           $this->embedForm('profile', $profileForm);
>
> You'll also want to unset the sfGuardUserId field: unset($profileForm
> ['sf_guard_user_id']);
>
> So, it's basically creating a ProfileForm, getting the object related
> to it, then telling symfony to set that object's sfUserGuardId to
> equal the sfGuardUser object that this class represents.
>
> Does that make sense?  Hope this helps.  I'm somewhat of a newb
> myself, so I may be telling you something that doesn't apply.
>
> 

[symfony-users] Re: saving multiple objects in a form save

2009-03-16 Thread lionslair

I think he is suggesting something like

public function save()
{
  parent :: save($this);

  // then mabye call
  $this->saveEmbeddedForms($this);
}

On Mar 16, 4:04 pm, maestro  wrote:
> Hi Gareth,
>
> Thanx for the reply!
>
> Am not sure that i understand you correctly. Am overriding the form's
> save() not the propel object's save(). Propel form's original save
> calls the form's object->save() and returns the object.
>
> I'm now trying to do this in another way (in another forum thread) but
> end up with the same problem. It seems like a propel related issue.
>
> On Mar 16, 2:05 pm, Gareth McCumskey  wrote:
>
> > Its because the save function in the base calss retrieves the ID but you are
> > overiding the save mechanism. Try using the parent classes save mechanism in
> > order to let it do that save for you as well as return the ID.
>
> > On Sun, Mar 15, 2009 at 7:42 PM, maestro  wrote:
>
> > > Hello gentlemen,
>
> > > I have a propel form class in which i override the save() function. Am
> > > trying to save the main form object and some related objects. But when
> > > i try to use the id of the just-added main object i find it empty. It
> > > says in the docs. that once a propel object is saved the id should get
> > > set and can be retrieved by getId(). Also I see the main object being
> > > saved in the DB. Why does getId() return null? Is there any other way
> > > to implement this logic?
>
> > > thanks.
>
> > > Here is my code
>
> > >  public function save($con = null)
> > >  {
> > >    try
> > >    {
> > >        $con->beginTransaction();
> > >        $this->object->save();
> > >        $con->commit();
>
> > >        $con->beginTransaction();
>
> > >        foreach($receivers as $reciever){
> > >          $msg_reciever = new MessageReciever();
> > >          if (sfConfig::get('sf_logging_enabled'))
> > >          {
> > >            sfContext::getInstance()->getLogger()->info("MsgId:
> > > " . $this->object->getId());
> > >          }
> > >          $msg_reciever->setMessageId($this->object->getId());
> > >          ...
> > >          ...
> > >          $msg_reciever->save();
> > >        }
> > >      $con->commit();
> > >    }
> > >    catch (Exception $e)
> > >    {
> > >      $con->rollBack();
> > >      throw $e;
> > >    }
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-16 Thread lionslair

Can you show me your database schema.  If it works on one I don't know
why it doesn't work on the other.



On Mar 16, 3:52 pm, maestro  wrote:
> Am stumped by the same problem. I have a form that corresponds to the
> main db object, and in it i have a bunch of embedded forms with
> related objects. I need the ID generated for the main object to pass
> to the related objects. The main object is being saved fine (I see it
> in the DB), but when i try to do this 'this->getObject()-getId()' I
> get back a null value. I have done the exact same thing with another
> form and it is working fine. What am I doing wrong? Here is the code
> in my embedded form?
>
>         public function saveEmbeddedForms($con = null, $forms= null)
>         {
>                 ...
>                 ...
>
>                 foreach($receivers as $reciever){
>                         $msg_reciever = new MessageReciever();
>                         
> $msg_reciever->setMessageId($this->getObject()->getId());
>
>                         $msg_reciever->setRecieverId($reciever->getId
> ());
>                         
> $msg_reciever->setStatus($this->getObject()->getStatus());
>
>                         $msg_reciever->save();
>                 }
>         }
>
> and this is how i embed the form
>
>       $recivers_form = new MessageRecieverForm($this->getObject());
>       $this->embedForm('recievers', $recievers_form);
>
> I don't know if this the best way to do this, but, by God, it has
> worked before..
>
> I hope someone can get to the bottom of this..
> cheers,
>
> On Mar 16, 11:38 am, lionslair  wrote:
>
> > I think that is basically same as what I have here.
>
> > The ServerForm
>
> > // ServerFormClass extends BaseServerForm
>
> >   public function configure()
> >   {
>
> >     // remove some fields from the form
> >     unset($this['created_at'], $this['updated_at'], $this
> > ['server_key']);
>
> >     //    if ($this->isNew())
> >     //    {
> >     //      unset($this['hardware_information']['server_id']);
> >     //    } // end if
>
> >     $maintain_options = array(
> >                                'Y' => 'Yes',
> >                                'N' => 'No',
> >     );
>
> >     $this->widgetSchema['maintain']       = new sfWidgetFormChoice
> > (array('choices' => $maintain_options));
> >     //    $this->widgetSchema['contact_id']   = new
> > sfWidgetFormInputHidden();
> >     $this->widgetSchema['contact_id']     = new
> > sfWidgetFormPropelChoice(array('model' => 'Contact', 'order_by' =>
> > array('Name', 'asc'), 'label' => 'Contact'));
> >     $this->widgetSchema['server_type_id'] = new
> > sfWidgetFormPropelChoice(array('model' => 'ServerType', 'order_by' =>
> > array('Name', 'asc'), 'label' => 'Server Type', 'expanded' => true));
> >     //  'default' => ServerTypePeer :: retrieveIdByName('server')
>
> >     //    echo $this->getObject()->getInstallDate("Y");
> >     $years = range(date('Y') - 10, date('Y') + 15);
>
> > //    $server_info = $this->getObject()->getServer
>
> >     /*
> >      * check if the object is new
> >      */
> >     if ($this->getObject()->isNew())
> >     {
> >       $this->widgetSchema['install_date'] = new sfWidgetFormDate(array
> > ('format' => '%day%/%month%/%year%', 'years' => array_combine($years,
> > $years), 'empty_values' => array('year' => date("Y"), 'month' => date
> > ('m'), 'day' => date('d';
> >       $this->widgetSchema['next_date']    = new sfWidgetFormDate(array
> > ('format' => '%day%/%month%/%year%', 'years' => array_combine($years,
> > $years), 'empty_values' => array('year' => date('Y'), 'month' => date
> > ('m'), 'day' => date('d';
> >       //      $this->widgetSchema['server_type_id']->setDefault
> > (ServerTypePeer :: retrieveIdByName('server'));
> >     }
> &g

[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-16 Thread lionslair

These are the import functin out of the sfFormPropel.class.php

See how the main object is saved then it deals with the childs. It
works fine when the child exists but I don't know why it is not making
the  connection on the creation of new records that are made at the
same timer as main.


349
350   /**
351* Updates and saves the current object.
352*
353* If you want to add some logic before saving or save other
associated objects,
354* this is the method to override.
355*
356* @param PropelPDO $con An optional PropelPDO object
357*/
358   protected function doSave($con = null)
359   {
360 if (is_null($con))
361 {
362   $con = $this->getConnection();
363 }
364
365 $this->updateObject();
366
367 $this->object->save($con);
368
369 // embedded forms
370 $this->saveEmbeddedForms($con);
371   }
372
373   /**
374* Saves embedded form objects.
375*
376* @param PropelPDO $con   An optional PropelPDO object
377* @param array $forms An array of forms
378*/
379   public function saveEmbeddedForms($con = null, $forms = null)
380   {
381 if (is_null($con))
382 {
383   $con = $this->getConnection();
384 }
385
386 if (is_null($forms))
387 {
388   $forms = $this->embeddedForms;
389 }
390
391 foreach ($forms as $form)
392 {
393   if ($form instanceof sfFormPropel)
394   {
395 $form->saveEmbeddedForms($con);
396 $form->getObject()->save($con);
397   }
398   else
399   {
400 $this->saveEmbeddedForms($con, $form->getEmbeddedForms
());
401   }
402 }
403   }


On Mar 16, 3:52 pm, maestro  wrote:
> Am stumped by the same problem. I have a form that corresponds to the
> main db object, and in it i have a bunch of embedded forms with
> related objects. I need the ID generated for the main object to pass
> to the related objects. The main object is being saved fine (I see it
> in the DB), but when i try to do this 'this->getObject()-getId()' I
> get back a null value. I have done the exact same thing with another
> form and it is working fine. What am I doing wrong? Here is the code
> in my embedded form?
>
>         public function saveEmbeddedForms($con = null, $forms= null)
>         {
>                 ...
>                 ...
>
>                 foreach($receivers as $reciever){
>                         $msg_reciever = new MessageReciever();
>                         
> $msg_reciever->setMessageId($this->getObject()->getId());
>
>                         $msg_reciever->setRecieverId($reciever->getId
> ());
>                         
> $msg_reciever->setStatus($this->getObject()->getStatus());
>
>                         $msg_reciever->save();
>                 }
>         }
>
> and this is how i embed the form
>
>       $recivers_form = new MessageRecieverForm($this->getObject());
>       $this->embedForm('recievers', $recievers_form);
>
> I don't know if this the best way to do this, but, by God, it has
> worked before..
>
> I hope someone can get to the bottom of this..
> cheers,
>
> On Mar 16, 11:38 am, lionslair  wrote:
>
> > I think that is basically same as what I have here.
>
> > The ServerForm
>
> > // ServerFormClass extends BaseServerForm
>
> >   public function configure()
> >   {
>
> >     // remove some fields from the form
> >     unset($this['created_at'], $this['updated_at'], $this
> > ['server_key']);
>
> >     //    if ($this->isNew())
> >     //    {
> >     //      unset($this['hardware_information']['server_id']);
> >     //    } // end if
>
> >     $maintain_options = array(
> >                                'Y' => 'Yes',
> >                                'N' => 'No',
> >     );
>
> >     $this->widgetSchema['maintain']       = new sfWidgetFormChoice
> > (array('choices' => $maintain_options));
> >     //    $this->widgetSchema['contact_id']   = new
> > sfWidgetFormInputHidden();
> >     $this->widgetSchema['contact_id']     = new
> > sfWidgetFormPropelChoice(array('model' => 'Contact', 'order_by' =>
> > array('Name', 'asc'), 'label' => 'Contact'));
> >     $this->widgetSchema['server_type_id'] = 

[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-16 Thread lionslair
ion:
_attributes: { phpName: ServerOsTypeVersion }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement:
true, required: true }
created_at: { type: TIMESTAMP, required: false }
updated_at: { type: TIMESTAMP, required: false }
server_os_type_id: { type: INTEGER, size: '11', required: true,
defaultValue: '0', foreignTable: server_os_type, foreignReference: id,
onDelete: cascade }
title: { type: VARCHAR, size: '250', required: false }
_indexes: { server_os_type_id: [server_os_type_id] }
  server_software:
_attributes: { phpName: ServerSoftware }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement:
true, required: true }
created_at: { type: TIMESTAMP, required: false }
updated_at: { type: TIMESTAMP, required: false }
server_id: { type: INTEGER, size: '11', required: true,
defaultValue: '0', foreignTable: server, foreignReference: id,
onDelete: cascade }
virus: { type: VARCHAR, size: '150', required: false,
defaultValue: unknown }
server_os_type_id: { type: INTEGER, size: '11', required: true,
defaultValue: '0', foreignTable: server_os_type, foreignReference: id,
onDelete: cascade }
server_os_version_id: { type: INTEGER, size: '11', required: true,
defaultValue: '0', foreignTable: server_os_type_version,
foreignReference: id, onDelete: cascade }
notes: { type: CLOB, required: false }
_indexes: { server_id: [server_id], os_type_id:
[server_os_type_id], os_version_id: [server_os_version_id] }
  server_type:
_attributes: { phpName: ServerType }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement:
true, required: true }
created_at: { type: TIMESTAMP, required: false }
updated_at: { type: TIMESTAMP, required: false }
name: { type: VARCHAR, size: '100', required: false }
  server_users:
_attributes: { phpName: ServerUsers }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement:
true, required: true }
created_at: { type: TIMESTAMP, required: false }
updated_at: { type: TIMESTAMP, required: false }
server_id: { type: INTEGER, size: '11', required: false }
passwd: { type: VARCHAR, size: '50', required: false }
uptime: { type: VARCHAR, size: '150', required: false }
ip: { type: VARCHAR, size: '50', required: false }
request_ip: { type: VARCHAR, size: '50', required: false }
pop3: { type: CHAR, size: '1', required: false, defaultValue:
'N' }
smtp: { type: CHAR, size: '1', required: false, defaultValue:
'N' }
dns: { type: CHAR, size: '1', required: false, defaultValue: 'N' }
upgrade_date: { type: TIMESTAMP, required: false }
notes: { type: CLOB, required: false }
server_key: { type: VARCHAR, size: '40', required: false,
foreignTable: server, foreignReference: server_key }
server_fqdn: { type: VARCHAR, size: '255', required: false }
_indexes: { server_id: [server_id] }
  staff:
_attributes: { phpName: Staff }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement:
true, required: true }
created_at: { type: TIMESTAMP, required: false }
updated_at: { type: TIMESTAMP, required: false }
name: { type: VARCHAR, size: '150', required: false }
email: { type: VARCHAR, size: '150', required: false }
mobile: { type: VARCHAR, size: '50', required: false }










On Mar 16, 6:03 pm, maestro  wrote:
> Am still on it.. here is my schema.
> 
>
> message:
>     _attributes: { phpName: Message }
>     id:
>     sender_id:
>     subject:
>     body:
>     status_id:
>     created_at:
>
> message_reciever:
>     _attributes: { phpName: MessageReciever }
>     id: { type: BIGINT, primaryKey: true, required: true }
>     message_id: { type: BIGINT, required: true, foreignTable: message,
> foreignReference: id }
>     reciever_id: { type: BIGINT, autoIncrement: true, required: true,
> foreignTable: member, foreignReference: id }
>     status_id: { type: BIGINT, autoIncrement: true, required: true,
> foreignTable: status, foreignReference: id }
> 
>
> On Mar 16, 4:48 pm, lionslair  wrote:
>
> > Can you show me your database schema.  If it works on one I don't know
> > why it doesn't work on the other.
>
> > On Mar 16, 3:52 pm, maestro  wrote:
>
> > > Am stumped by the same problem. I have a form that corresponds to the
> > > main db object, and in it i have a bunch of embedded forms with
> > > related objects. I need the ID generated for the main object to pass
> > > to the related objects. The main obje

[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-16 Thread lionslair

Maybe the schemas need to be done like this as I have just re-read in
the documentation.

Listing 8-28 - Foreign Key Alternative Syntax

propel:
  blog_article:
id:
title:   varchar(50)
user_id: { type: integer }
_foreignKeys:
  -
foreignTable: blog_user
onDelete: cascade
references:
  - { local: user_id, foreign: id }

The alternative syntax is useful for multiple-reference foreign keys
and to give foreign keys a name, as shown in Listing 8-29.

Listing 8-29 - Foreign Key Alternative Syntax Applied to Multiple
Reference Foreign Key

_foreignKeys:
  my_foreign_key:
foreignTable:  db_user
onDelete:  cascade
references:
  - { local: user_id, foreign: id }
  - { local: post_id, foreign: id }


On Mar 16, 6:03 pm, maestro  wrote:
> Am still on it.. here is my schema.
> 
>
> message:
>     _attributes: { phpName: Message }
>     id:
>     sender_id:
>     subject:
>     body:
>     status_id:
>     created_at:
>
> message_reciever:
>     _attributes: { phpName: MessageReciever }
>     id: { type: BIGINT, primaryKey: true, required: true }
>     message_id: { type: BIGINT, required: true, foreignTable: message,
> foreignReference: id }
>     reciever_id: { type: BIGINT, autoIncrement: true, required: true,
> foreignTable: member, foreignReference: id }
>     status_id: { type: BIGINT, autoIncrement: true, required: true,
> foreignTable: status, foreignReference: id }
> 
>
> On Mar 16, 4:48 pm, lionslair  wrote:
>
> > Can you show me your database schema.  If it works on one I don't know
> > why it doesn't work on the other.
>
> > On Mar 16, 3:52 pm, maestro  wrote:
>
> > > Am stumped by the same problem. I have a form that corresponds to the
> > > main db object, and in it i have a bunch of embedded forms with
> > > related objects. I need the ID generated for the main object to pass
> > > to the related objects. The main object is being saved fine (I see it
> > > in the DB), but when i try to do this 'this->getObject()-getId()' I
> > > get back a null value. I have done the exact same thing with another
> > > form and it is working fine. What am I doing wrong? Here is the code
> > > in my embedded form?
>
> > >         public function saveEmbeddedForms($con = null, $forms= null)
> > >         {
> > >                 ...
> > >                 ...
>
> > >                 foreach($receivers as $reciever){
> > >                         $msg_reciever = new MessageReciever();
> > >                         
> > > $msg_reciever->setMessageId($this->getObject()->getId());
>
> > >                         $msg_reciever->setRecieverId($reciever->getId
> > > ());
> > >                         
> > > $msg_reciever->setStatus($this->getObject()->getStatus());
>
> > >                         $msg_reciever->save();
> > >                 }
> > >         }
>
> > > and this is how i embed the form
>
> > >       $recivers_form = new MessageRecieverForm($this->getObject());
> > >       $this->embedForm('recievers', $recievers_form);
>
> > > I don't know if this the best way to do this, but, by God, it has
> > > worked before..
>
> > > I hope someone can get to the bottom of this..
> > > cheers,
>
> > > On Mar 16, 11:38 am, lionslair  wrote:
>
> > > > I think that is basically same as what I have here.
>
> > > > The ServerForm
>
> > > > // ServerFormClass extends BaseServerForm
>
> > > >   public function configure()
> > > >   {
>
> > > >     // remove some fields from the form
> > > >     unset($this['created_at'], $this['updated_at'], $this
> > > > ['server_key']);
>
> > > >     //    if ($this->isNew())
> > > >     //    {
> > > >     //      unset($this['hardware_information']['server_id']);
> > > >     //    } // end if
>
> > > >     $maintain_options = array(
> > > >                                'Y' => 'Yes',
> > > >                                'N' => 'No',
> > > >     );
>
> > > >     $this->widgetSchema['maintain']       = new sfWidgetFormChoice
> > > > (array('choices' => $maintain_options));
> > > >     //    $this->widgetSchema['contact_id']   

[symfony-users] Re: Save an embedded form that relies on the other form

2009-03-16 Thread lionslair

I finally cracked in.  These two functions in my ServerForm class


  public function bind(array $taintedValues = null, array
$taintedFiles = null)
  {
$ret = parent::bind($taintedValues, $taintedFiles);
foreach ($this->embeddedForms as $name => $form) {
  $this->embeddedForms[$name]->isBound = true;
  $this->embeddedForms[$name]->values = $this->values[$name];
}

return $ret;
  }


  public function saveEmbeddedForms($con = null, $forms = null)
  {
foreach($this->getEmbeddedForms() as $closeForm)
{

  $entry=$closeForm->save();
  $entry->setServerId($this->getObject()->getId());
  //mail('nat...@lionslair.net.au', 'debug', print_r
($entry, true));
  $entry->save();
}
  }

On Mar 16, 12:42 am, justin_davis  wrote:
> I'm doing something like this, and this is my solution:
>
> Let's say you have two forms, one is an sfGuardUser form (Form 1), the
> other is a Profile form (Form 2) (representing those two models).
> When a new user is created, a new profile must be also created that
> depends on that record (Profile depends on sfGuardUser):
>
> (this is sfGuardUserForm.class.php):
>
>           $profileForm = new ProfileForm();
>           $profileForm->getObject()->setsfGuardUserId($this->getObject());
>           $this->embedForm('profile', $profileForm);
>
> You'll also want to unset the sfGuardUserId field: unset($profileForm
> ['sf_guard_user_id']);
>
> So, it's basically creating a ProfileForm, getting the object related
> to it, then telling symfony to set that object's sfUserGuardId to
> equal the sfGuardUser object that this class represents.
>
> Does that make sense?  Hope this helps.  I'm somewhat of a newb
> myself, so I may be telling you something that doesn't apply.
>
> Good luck!
>
> Justin
>
> On Feb 5, 4:25 pm, Timmy  wrote:
>
> > I have two forms form 1 and form 2. Form 2 is embedded into form 1. On
> > save form1 must be saved as a new row and therefore recieving a
> > primary key, Afterwards this foreign key needs to be injected into
> > form 2 before it can save.
>
> > The only way i have figured out at the mo is after the form is valid.
> > Instantiate the two models, populate them, add form2 model to form 1
> > model then save.
>
> > Isn't there an easier way?
>
> > Thanx
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: how to use propel class in task

2009-03-25 Thread lionslair

I have this task and no matter what I try I keep getting Connection
configuration required

addArguments(array(
//   new sfCommandArgument('my_arg', sfCommandArgument::REQUIRED,
'My argument'),
// ));

$this->addOptions(array(
  new sfCommandoption('application', null,
sfCommandOption::PARAMETER_REQUIRED, 'the application that this is
running as', 'webmaster'),
  new sfCommandOption('env', null,
sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
  new sfCommandOption('connection', null,
sfCommandOption::PARAMETER_REQUIRED, 'the connection name', 'propel'),
  new sfCommandOption('verbose', null,
sfCommandOption::PARAMETER_REQUIRED, 'Enables verbose output', false),
  // add your own options here
));

$this->namespace= 'hopcon';
$this->name = 'check-current-status';
$this->briefDescription = 'This task will check on the current
stauts of servers and notify the required people whe the status
changes';
$this->detailedDescription = <addOption('verbose', null,
sfCommandOption::PARAMETER_REQUIRED, 'Enables verbose output', false);
//$this->addOption('connection', null,
sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel');
//$this->addOption('env', null,
sfCommandOption::PARAMETER_REQUIRED, 'The enviroment', 'dev');
  }

  protected function execute($arguments = array(), $options = array())
  {
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options
['connection'] ? $options['connection'] : '')->getConnection();

//$databaseManager = new sfDatabaseManager($configuration);


//echo "connection: ".print_r($connection, true)."\n";
//echo "databaseManager: ".print_r($databaseManager, true)."\n";
//echo "configuration: ".print_r($this->configuration, true)."\n";

//mail('nat...@lionslair.net.au', 'debug', print_r($this-
>configuration, true));



// add your code here

/*
 * Get all current status's
 */
$server_users = ServerUsersPeer :: doSelect(new Criteria());


$status_indicators = StatusIndicatorPeer :: getAll();



/*
 * Only continue if there are server_users
 */
if ($server_users)
{

  /*
   *  for each of records
   */
  foreach ($server_users as $server)
  {


if ($status_indicators)
{
  foreach ($status_indicators as $status_indicator)
  {
/*
 * find the match
 */
$timestamp = date(sfConfig::get('app_date_format_save'),
strtotime("-".$status_indicator->getPeriod()." minutes"));
$updated_timstamp = ServerUsersPeer ::
getUpdatedAtByServerKey($server->getServerKey());
//$value = eval("\$updated_timstamp \$status_indicator-
>getComparison() \$timestamp");
$value = $updated_timstamp.' '.$status_indicator-
>getComparison().' '.$timestamp;
//$value = eval($updated_timstamp).' '.$status_indicator-
>getComparison().' '.eval($timestamp);
//echo 'value: '.$value."\n";
if ($value)
{

// ok now send the email or what ever
nahoMail::send('test email', 'test body',
'nat...@lionslair.net.au');




} // end if

  } // end foreach
} // end if


  } // end foreach
} // end if




  } // end function execute
}


On Mar 11, 1:57 am, Frank He  wrote:
> Sorry guys, it is my fault, they can be called. Love symfony so much!
>
> On Tue, Mar 10, 2009 at 12:54 PM, xhe  wrote:
>
> > I used this line to create a task:
>
> > class sendEmailAlertTask extends  sfPropelBaseTask
>
> > But whenever I want to use the propel class, I got fatal error, the
> > class can not be found. So can anyone help me to tell how to use class
> > in the task command line?
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] sfGuard

2007-10-31 Thread lionslair

There seems to be a lot of missing documentation for the
sfGuardPlugin.  The login works thats easy.  But when it comes to
having security.yml files on the config directories of my modules
things seem to stop working.  I assign the group member to a indvidual
member.  My way of thinking is that a user logging in with the
assigned group member should have access to all secured modules/
actions with the credential member.  However this does not seem to be
the case.

I have also added permissions but if you have an edit action in
multiple modules how can you specify the permission edit for each
module action where needed?

Are permissions credentials or are they the reference to the actions
you are trying to protect?  And if that is true then how does the
members group then take effect.

A lot of the sfGuardPlugin is very hard to work out when it comes to
using it to protect each of the actions and modules you are trying to
protect.

I think others have had this same trouble and not really got a
response so I hope this helps to get useful help from the community.

Thank you.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] sfPropelActAsNestedSetBehavior help

2007-11-16 Thread lionslair

I need some help with the nested sets plugin.  I am adding a gallery
to my site and allowing members to add albums.  They can add root
albums and sub albums but am not able to add child albums.

Here is my action.

  /**
* Execute action AddAlbum
*
*/
  public function executeAddAlbum()
  {
if ($this->getRequest()->getMethod() != sfRequest::POST)
{
   return sfView::SUCCESS;
}
else
{

$album = new GalleryAlbum(); // create new instance of the
gallery album object

// there is no parent album set so make this album a root
album
if (!$this->getRequestParameter('album_parent_id'))
{
  $album->makeRoot(); // all the function to build a new root
node object for the new albumn
}
else
{
  // make this a child of an existing node
  $album->insertAsFirstChildOf($this-
>getRequestParameter('album_parent_id'));
}

$album->setUserId($this->getRequestParameter('user_id'));
$album->setTitle($this->getRequestParameter('title'));
$album->setDescription($this-
>getRequestParameter('description'));
$album->setDate($this->getRequestParameter('date'));
$album->setDisplay($this->getRequestParameter('display'));
$album->save();

$this->setFlash('class', 'confirmation');
$this->setFlash('msg', 'Your new album has been created');
$this->redirect('@photo_management');

}
  } // end function executeAddAlbum


The root albums seem to work but I can not add child albums.  Can
someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-17 Thread lionslair

So I need to retrive from the database the record using the parentid
field with propel and pass that to the function;

$parentNode = GalleryAlbumPeer::retrievebypk($this-
>getRequestParameter('album_parent_id'));

$album->insertAsFirstChildOf($parentNode);

I will give this a go let you know how I go.  (I know the code above
may not be exactly correct but I think I follow your reply.)


On Nov 18, 5:56 am, "Carsten Schumann"
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Your line
>
> $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'));
>
> is wrong. This function expects an object (the parent node) and not an
> id/pkey of the object.
>
> Carsten
>
> On Nov 17, 2007 8:52 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
>
>
> > I need some help with the nested sets plugin.  I am adding a gallery
> > to my site and allowing members to add albums.  They can add root
> > albums and sub albums but am not able to add child albums.
>
> > Here is my action.
>
> >   /**
> > * Execute action AddAlbum
> > *
> > */
> >   public function executeAddAlbum()
> >   {
> > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > {
> >return sfView::SUCCESS;
> > }
> > else
> > {
>
> > $album = new GalleryAlbum(); // create new instance of the
> > gallery album object
>
> > // there is no parent album set so make this album a root
> > album
> > if (!$this->getRequestParameter('album_parent_id'))
> > {
> >   $album->makeRoot(); // all the function to build a new root
> > node object for the new albumn
> > }
> > else
> > {
> >   // make this a child of an existing node
> >   $album->insertAsFirstChildOf($this-
> > >getRequestParameter('album_parent_id'));
> > }
>
> > $album->setUserId($this->getRequestParameter('user_id'));
> > $album->setTitle($this->getRequestParameter('title'));
> > $album->setDescription($this-
> > >getRequestParameter('description'));
> > $album->setDate($this->getRequestParameter('date'));
> > $album->setDisplay($this->getRequestParameter('display'));
> > $album->save();
>
> > $this->setFlash('class', 'confirmation');
> > $this->setFlash('msg', 'Your new album has been created');
> > $this->redirect('@photo_management');
>
> > }
> >   } // end function executeAddAlbum
>
> > The root albums seem to work but I can not add child albums.  Can
> > someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-17 Thread lionslair

This method seems to have4 worked but the scope field of the table
remains at 0 no matter how many root trees with x number of subs are
created.  Is this correct?


  /**
* Execute action AddAlbum
*
*/
  public function executeAddAlbum()
  {
if ($this->getRequest()->getMethod() != sfRequest::POST)
{
   return sfView::SUCCESS;
}
else
{

$album = new GalleryAlbum(); // create new instance of the
gallery album object

// there is no parent album set so make this album a root
album
if (!$this->getRequestParameter('album_parent_id'))
{
  $album->makeRoot(); // all the function to build a new root
node object for the new albumn
}
else
{
  // retrieve the record of the parent ID
  $parentAlbum =  GalleryAlbumPeer::retrieveByPK($this-
>getRequestParameter('album_parent_id'));

  if ($parentAlbum)
  {
// make this a child of an existing node
$album->insertAsFirstChildOf($parentAlbum);
  } // end if
} // end if else

$album->setUserId($this->getRequestParameter('user_id'));
$album->setTitle($this->getRequestParameter('title'));
$album->setDescription($this-
>getRequestParameter('description'));
$album->setDate($this->getRequestParameter('date'));
$album->setDisplay($this->getRequestParameter('display'));
$album->save();

$this->setFlash('class', 'confirmation');
$this->setFlash('msg', 'Your new album has been created');
$this->redirect('@photo_management');

}
  } // end function executeAddAlbum


On Nov 18, 5:56 am, "Carsten Schumann"
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Your line
>
> $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'));
>
> is wrong. This function expects an object (the parent node) and not an
> id/pkey of the object.
>
> Carsten
>
> On Nov 17, 2007 8:52 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
>
>
> > I need some help with the nested sets plugin.  I am adding a gallery
> > to my site and allowing members to add albums.  They can add root
> > albums and sub albums but am not able to add child albums.
>
> > Here is my action.
>
> >   /**
> > * Execute action AddAlbum
> > *
> > */
> >   public function executeAddAlbum()
> >   {
> > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > {
> >return sfView::SUCCESS;
> > }
> > else
> > {
>
> > $album = new GalleryAlbum(); // create new instance of the
> > gallery album object
>
> > // there is no parent album set so make this album a root
> > album
> > if (!$this->getRequestParameter('album_parent_id'))
> > {
> >   $album->makeRoot(); // all the function to build a new root
> > node object for the new albumn
> > }
> > else
> > {
> >   // make this a child of an existing node
> >   $album->insertAsFirstChildOf($this-
> > >getRequestParameter('album_parent_id'));
> > }
>
> > $album->setUserId($this->getRequestParameter('user_id'));
> > $album->setTitle($this->getRequestParameter('title'));
> > $album->setDescription($this-
> > >getRequestParameter('description'));
> > $album->setDate($this->getRequestParameter('date'));
> > $album->setDisplay($this->getRequestParameter('display'));
> > $album->save();
>
> > $this->setFlash('class', 'confirmation');
> > $this->setFlash('msg', 'Your new album has been created');
> > $this->redirect('@photo_management');
>
> > }
> >   } // end function executeAddAlbum
>
> > The root albums seem to work but I can not add child albums.  Can
> > someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-17 Thread lionslair

Does the Scope filed get set manually by the user only when making the
root node.

How can you set a scope value when you have not yet saved the record?

On Nov 18, 5:56 am, "Carsten Schumann"
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Your line
>
> $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'));
>
> is wrong. This function expects an object (the parent node) and not an
> id/pkey of the object.
>
> Carsten
>
> On Nov 17, 2007 8:52 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
>
>
> > I need some help with the nested sets plugin.  I am adding a gallery
> > to my site and allowing members to add albums.  They can add root
> > albums and sub albums but am not able to add child albums.
>
> > Here is my action.
>
> >   /**
> > * Execute action AddAlbum
> > *
> > */
> >   public function executeAddAlbum()
> >   {
> > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > {
> >return sfView::SUCCESS;
> > }
> > else
> > {
>
> > $album = new GalleryAlbum(); // create new instance of the
> > gallery album object
>
> > // there is no parent album set so make this album a root
> > album
> > if (!$this->getRequestParameter('album_parent_id'))
> > {
> >   $album->makeRoot(); // all the function to build a new root
> > node object for the new albumn
> > }
> > else
> > {
> >   // make this a child of an existing node
> >   $album->insertAsFirstChildOf($this-
> > >getRequestParameter('album_parent_id'));
> > }
>
> > $album->setUserId($this->getRequestParameter('user_id'));
> > $album->setTitle($this->getRequestParameter('title'));
> > $album->setDescription($this-
> > >getRequestParameter('description'));
> > $album->setDate($this->getRequestParameter('date'));
> > $album->setDisplay($this->getRequestParameter('display'));
> > $album->save();
>
> > $this->setFlash('class', 'confirmation');
> > $this->setFlash('msg', 'Your new album has been created');
> > $this->redirect('@photo_management');
>
> > }
> >   } // end function executeAddAlbum
>
> > The root albums seem to work but I can not add child albums.  Can
> > someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-18 Thread lionslair

I now got this sorted and working.

On Nov 17, 4:52 pm, lionslair <[EMAIL PROTECTED]> wrote:
> I need some help with the nested sets plugin.  I am adding a gallery
> to my site and allowing members to add albums.  They can add root
> albums and sub albums but am not able to add child albums.
>
> Here is my action.
>
>   /**
> * Execute action AddAlbum
> *
> */
>   public function executeAddAlbum()
>   {
> if ($this->getRequest()->getMethod() != sfRequest::POST)
> {
>return sfView::SUCCESS;
> }
> else
> {
>
> $album = new GalleryAlbum(); // create new instance of the
> gallery album object
>
> // there is no parent album set so make this album a root
> album
> if (!$this->getRequestParameter('album_parent_id'))
> {
>   $album->makeRoot(); // all the function to build a new root
> node object for the new albumn
> }
> else
> {
>   // make this a child of an existing node
>   
> $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'));
>
> }
>
> $album->setUserId($this->getRequestParameter('user_id'));
> $album->setTitle($this->getRequestParameter('title'));
> $album->setDescription($this->getRequestParameter('description'));
>
> $album->setDate($this->getRequestParameter('date'));
> $album->setDisplay($this->getRequestParameter('display'));
> $album->save();
>
> $this->setFlash('class', 'confirmation');
> $this->setFlash('msg', 'Your new album has been created');
> $this->redirect('@photo_management');
>
> }
>   } // end function executeAddAlbum
>
> The root albums seem to work but I can not add child albums.  Can
> someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-19 Thread lionslair

Sure

My action for adding a new album.  Turns out that you make the root
then set the id for that row .  Continue setting your other values and
call a second save.  The other methods of the plugin then use the
scope value as expected.

 /**
* Execute action AddAlbum
*
*/
  public function executeAddAlbum()
  {
if ($this->getRequest()->getMethod() != sfRequest::POST)
{
   $this->album_options =
GalleryAlbumTools::nested_dropdown_albums($this->getUser()-
>getProfile()->getUserId());
   return sfView::SUCCESS;
}
else
{

$album = new GalleryAlbum(); // create new instance of the
gallery album object

// there is no parent album set so make this album a root
album
if (!$this->getRequestParameter('album_parent_id'))
{
  $album->makeRoot(); // all the function to build a new root
node object for the new albumn
  $album->save();
  $album->setScope($album->getId());
}
else
{
  // retrieve the record of the parent ID
  $parentAlbum =  GalleryAlbumPeer::retrieveByPK($this-
>getRequestParameter('album_parent_id'));

  if ($parentAlbum)
  {
// make this a child of an existing node
$album->insertAsFirstChildOf($parentAlbum);
  } // end if
} // end if else

$album->setUserId($this->getRequestParameter('user_id'));
$album->setTitle($this->getRequestParameter('title'));
$album->setDescription($this-
>getRequestParameter('description'));
$album->setDate($this->getRequestParameter('date'));
$album->setDisplay($this->getRequestParameter('display'));
$album->save();

$this->setFlash('class', 'confirmation');
$this->setFlash('msg', 'Your new album has been created');
$this->redirect('@photo_management');

}
  } // end function executeAddAlbum

On Nov 18, 11:56 pm, gestadieu <[EMAIL PROTECTED]> wrote:
> Can you share your finding? I will have to deal with this plugin soon
> and I am interested to get your experience on this. Thx
>
> On Nov 18, 5:00 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > I now got this sorted and working.
>
> > On Nov 17, 4:52 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > > I need some help with the nested sets plugin.  I am adding a gallery
> > > to my site and allowing members to add albums.  They can add root
> > > albums and sub albums but am not able to add child albums.
>
> > > Here is my action.
>
> > >   /**
> > > * Execute action AddAlbum
> > > *
> > > */
> > >   public function executeAddAlbum()
> > >   {
> > > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > > {
> > >return sfView::SUCCESS;
> > > }
> > > else
> > > {
>
> > > $album = new GalleryAlbum(); // create new instance of the
> > > gallery album object
>
> > > // there is no parent album set so make this album a root
> > > album
> > > if (!$this->getRequestParameter('album_parent_id'))
> > > {
> > >   $album->makeRoot(); // all the function to build a new root
> > > node object for the new albumn
> > > }
> > > else
> > > {
> > >   // make this a child of an existing node
> > >   
> > > $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'))
> > >  ;
>
> > > }
>
> > > $album->setUserId($this->getRequestParameter('user_id'));
> > > $album->setTitle($this->getRequestParameter('title'));
> > > $album->setDescription($this->getRequestParameter('description'));
>
> > > $album->setDate($this->getRequestParameter('date'));
> > > $album->setDisplay($this->getRequestParameter('display'));
> > > $album->save();
>
> > > $this->setFlash('class', 'confirmation');
> > > $this->setFlash('msg', 'Your new album has been created');
> > > $this->redirect('@photo_management');
>
> > > }
> > >   } // end function executeAddAlbum
>
> > > The root albums seem to work but I can not add child albums.  Can
> > > someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-19 Thread lionslair

I also make a tool class to generate the tree for use in a dropdown
list as the symfony methods would not produce the formatting I needed.

add(GalleryAlbumPeer::USER_ID, $userid);
$c->add(GalleryAlbumPeer::TREE_PARENT, 0);
$c->addAscendingOrderByColumn(GalleryAlbumPeer::TREE_LEFT);
$c->addAscendingOrderByColumn(GalleryAlbumPeer::TITLE);

$rootAlbums = GalleryAlbumPeer::doSelect($c);

$album_options = array();


foreach ($rootAlbums AS $parent)
{
  $album_options[$parent->getId()] = $parent->getTitle();
  if ($parent->hasChildren())
  {
foreach ($parent->getDescendants($peer_method = 'doSelect') AS
$child)
{
  $album_options[$child->getId()] = str_repeat('-',$child-
>getLevel()).$child->getTitle();
}  // end foreach
  }
}

return $album_options;
  } // end function nested_dropdown_albums

} // end class
?>

On Nov 18, 11:56 pm, gestadieu <[EMAIL PROTECTED]> wrote:
> Can you share your finding? I will have to deal with this plugin soon
> and I am interested to get your experience on this. Thx
>
> On Nov 18, 5:00 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > I now got this sorted and working.
>
> > On Nov 17, 4:52 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > > I need some help with the nested sets plugin.  I am adding a gallery
> > > to my site and allowing members to add albums.  They can add root
> > > albums and sub albums but am not able to add child albums.
>
> > > Here is my action.
>
> > >   /**
> > > * Execute action AddAlbum
> > > *
> > > */
> > >   public function executeAddAlbum()
> > >   {
> > > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > > {
> > >return sfView::SUCCESS;
> > > }
> > > else
> > > {
>
> > > $album = new GalleryAlbum(); // create new instance of the
> > > gallery album object
>
> > > // there is no parent album set so make this album a root
> > > album
> > > if (!$this->getRequestParameter('album_parent_id'))
> > > {
> > >   $album->makeRoot(); // all the function to build a new root
> > > node object for the new albumn
> > > }
> > > else
> > > {
> > >   // make this a child of an existing node
> > >   
> > > $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'))
> > >  ;
>
> > > }
>
> > > $album->setUserId($this->getRequestParameter('user_id'));
> > > $album->setTitle($this->getRequestParameter('title'));
> > > $album->setDescription($this->getRequestParameter('description'));
>
> > > $album->setDate($this->getRequestParameter('date'));
> > > $album->setDisplay($this->getRequestParameter('display'));
> > > $album->save();
>
> > > $this->setFlash('class', 'confirmation');
> > > $this->setFlash('msg', 'Your new album has been created');
> > > $this->redirect('@photo_management');
>
> > > }
> > >   } // end function executeAddAlbum
>
> > > The root albums seem to work but I can not add child albums.  Can
> > > someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Multiple file uploads in Symfony Help please

2007-11-20 Thread lionslair

I can confirm that the files are being uploaded as per the globals
data of the debug toolbar.  See below.



files:
  newFile:
name:
  - IMGP0008.JPG
  - IMGP0012.JPG
  - IMGP0023.JPG
  -
  -
type:
  - image/jpeg
  - image/jpeg
  - image/jpeg
  -
  -
tmp_name:
  - /tmp/phpfUF14o
  - /tmp/phpx28E56
  - /tmp/php1Lgh5g
  -
  -
error:
  - 0
  - 0
  - 0
  - 4
  - 4
size:
  - 2161103
  - 2389461
  - 2324898
  - 0
  - 0
get:
post:
  album_parent_id: 3
  commit: Upload file
  user_id: 2


This leads me to belive the files do exist but then are not being
accessed by Symfony or I am trying to access them incorrectly.


On Nov 20, 7:11 pm, "Carsten Schumann"
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Did you check the upload file limit in your php.ini? Most of the
> upload issues we had in the past were related to this limit.
>
> If it is fine, please check if php is aware of the uploaded files. You
> can do it by writing var_dump($_FILES) in your action.
>
> Carsten
>
> On Nov 20, 2007 10:54 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
>
>
> > Note: I have posted the on the forum but not really received a lot of
> > help or a solution to this yet.
>
> > Can someone Please help me with this. I have been trying to work this
> > out for hours with no success.
>
> > I tried uploading a single file and that worked fine. However when I
> > then try and upload multiple files then the result is nothing. No
> > error and no file upload.
>
> > See my view that makes the form.
>
> > 
>
> > getProfile()-
> > >getUserId()); ?>
>
> > 
> > Upload Photos
>
> >   
> >
> > >GalleryAlbumTools::nested_dropdown_albums($sf_user->getProfile()-
> > >getUserId()),
> >$sf_params->get('album_parent_id'),
> >'include_blank=true'
> >)) ?>
> >   
> >   
> >   
> > 
> > 
> >   
> >   
>
> >   
> >
> >   
>
> > 
> > 
>
> > And the resulting action
>
> >   /**
> > *   Execute Action Upload photo
> > *
> > */
> >   public function executeUpload()
> >   {
> > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > {
>
> >   return sfView::SUCCESS;
> > }
> > else
> > {
> >   if ($this->getRequest()->hasFiles())
> >   {
>
> > foreach ($this->getRequest()->getFileNames() as $fileName)
> > {
> >   //$this->logMessage(' uploaded image: '.
> > print_r($fileName),'err');
> >   $fileSize  = $this->getRequest()->getFileSize($fileName);
> >   $fileType  = $this->getRequest()->getFileType($fileName);
> >   $fileError = $this->getRequest()->hasFileError($fileName);
> >   $fileRealName = $this->getRequest()->getFileName($fileName);
> >   $uploadDir =
> > sfConfig::get('sf_upload_dir').sfConfig::get('app_gallery_picture_folder').
> > DIRECTORY_SEPARATOR . $fileName;
> >   //$uploadDir = sfConfig::get('sf_upload_dir');
>
> >   $this->getRequest()->moveFile($fileName, $uploadDir);
> > }  // end foreach
>
> > $this->setFlash('class', 'confirmation');
> > $this->setFlash('msg', 'Your images have been successfully
> > uploaded');
> > $this->redirect('@photo_management');
> >   } // end if file uplaods
>
> > } // end if else
>
> >   } // end function executeUpload
>
> > What is it I am doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Multiple file uploads in Symfony Help please

2007-11-20 Thread lionslair

Note: I have posted the on the forum but not really received a lot of
help or a solution to this yet.

Can someone Please help me with this. I have been trying to work this
out for hours with no success.

I tried uploading a single file and that worked fine. However when I
then try and upload multiple files then the result is nothing. No
error and no file upload.

See my view that makes the form.



getProfile()-
>getUserId()); ?>


Upload Photos

  
   
   getProfile()-
>getUserId()),
   $sf_params->get('album_parent_id'),
   'include_blank=true'
   )) ?>
  
  
  


  
  

  
   
  







And the resulting action

  /**
*   Execute Action Upload photo
*
*/
  public function executeUpload()
  {
if ($this->getRequest()->getMethod() != sfRequest::POST)
{

  return sfView::SUCCESS;
}
else
{
  if ($this->getRequest()->hasFiles())
  {

foreach ($this->getRequest()->getFileNames() as $fileName)
{
  //$this->logMessage(' uploaded image: '.
print_r($fileName),'err');
  $fileSize  = $this->getRequest()->getFileSize($fileName);
  $fileType  = $this->getRequest()->getFileType($fileName);
  $fileError = $this->getRequest()->hasFileError($fileName);
  $fileRealName = $this->getRequest()->getFileName($fileName);
  $uploadDir =
sfConfig::get('sf_upload_dir').sfConfig::get('app_gallery_picture_folder').
DIRECTORY_SEPARATOR . $fileName;
  //$uploadDir = sfConfig::get('sf_upload_dir');

  $this->getRequest()->moveFile($fileName, $uploadDir);
}  // end foreach

$this->setFlash('class', 'confirmation');
$this->setFlash('msg', 'Your images have been successfully
uploaded');
$this->redirect('@photo_management');
  } // end if file uplaods


} // end if else

  } // end function executeUpload




What is it I am doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfPropelActAsNestedSetBehavior help

2007-11-20 Thread lionslair

Yeah I thought it was automated but after looking at it more it does
not appear to be. Not that I can tell.

On Nov 19, 11:09 pm, gestadieu <[EMAIL PROTECTED]> wrote:
> thanks a lot, it helps me to understand how should work the 'scope',
> this is a bit tricky and the only way I found is to save 2 times the
> first root element to set the scope to the element id. This is
> strange, I thought it would work automatically...
>
> thanks also for your nested dropdown, it might be helpful soon.
>
> On Nov 19, 6:12 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > I also make a tool class to generate the tree for use in a dropdown
> > list as the symfony methods would not produce the formatting I needed.
>
> > 
> > class GalleryAlbumTools
> > {
>
> >   static function nested_dropdown_albums($userid)
> >   {
> > // criteria for the object select below
> > $c = new Criteria();
> > $c->add(GalleryAlbumPeer::USER_ID, $userid);
> > $c->add(GalleryAlbumPeer::TREE_PARENT, 0);
> > $c->addAscendingOrderByColumn(GalleryAlbumPeer::TREE_LEFT);
> > $c->addAscendingOrderByColumn(GalleryAlbumPeer::TITLE);
>
> > $rootAlbums = GalleryAlbumPeer::doSelect($c);
>
> > $album_options = array();
>
> > foreach ($rootAlbums AS $parent)
> > {
> >   $album_options[$parent->getId()] = $parent->getTitle();
> >   if ($parent->hasChildren())
> >   {
> > foreach ($parent->getDescendants($peer_method = 'doSelect') AS
> > $child)
> > {
> >   $album_options[$child->getId()] = 
> > str_repeat('-',$child->getLevel()).$child->getTitle();
>
> > }  // end foreach
> >   }
> > }
>
> > return $album_options;
> >   } // end function nested_dropdown_albums
>
> > } // end class
>
> > ?>
>
> > On Nov 18, 11:56 pm, gestadieu <[EMAIL PROTECTED]> wrote:
>
> > > Can you share your finding? I will have to deal with this plugin soon
> > > and I am interested to get your experience on this. Thx
>
> > > On Nov 18, 5:00 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > > > I now got this sorted and working.
>
> > > > On Nov 17, 4:52 pm, lionslair <[EMAIL PROTECTED]> wrote:
>
> > > > > I need some help with the nested sets plugin.  I am adding a gallery
> > > > > to my site and allowing members to add albums.  They can add root
> > > > > albums and sub albums but am not able to add child albums.
>
> > > > > Here is my action.
>
> > > > >   /**
> > > > > * Execute action AddAlbum
> > > > > *
> > > > > */
> > > > >   public function executeAddAlbum()
> > > > >   {
> > > > > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > > > > {
> > > > >return sfView::SUCCESS;
> > > > > }
> > > > > else
> > > > > {
>
> > > > > $album = new GalleryAlbum(); // create new instance of the
> > > > > gallery album object
>
> > > > > // there is no parent album set so make this album a root
> > > > > album
> > > > > if (!$this->getRequestParameter('album_parent_id'))
> > > > > {
> > > > >   $album->makeRoot(); // all the function to build a new root
> > > > > node object for the new albumn
> > > > > }
> > > > > else
> > > > > {
> > > > >   // make this a child of an existing node
> > > > >   
> > > > > $album->insertAsFirstChildOf($this->getRequestParameter('album_parent_id'))
> > > > >  ;
>
> > > > > }
>
> > > > > $album->setUserId($this->getRequestParameter('user_id'));
> > > > > $album->setTitle($this->getRequestParameter('title'));
> > > > > 
> > > > > $album->setDescription($this->getRequestParameter('description'));
>
> > > > > $album->setDate($this->getRequestParameter('date'));
> > > > > $album->setDisplay($this->getRequestParameter('display'));
> > > > > $album->save();
>
> > > > > $this->setFlash('class', 'confirmation');
> > > > > $this->setFlash('msg', 'Your new album has been created');
> > > > > $this->redirect('@photo_management');
>
> > > > > }
> > > > >   } // end function executeAddAlbum
>
> > > > > The root albums seem to work but I can not add child albums.  Can
> > > > > someone point out what I am doing wrong.  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Multiple file uploads in Symfony Help please

2007-11-20 Thread lionslair

calling getFiles instead of getFileNames results in this from a
var_dump() output.

array(1) {
  ["newFile"]=>
  array(5) {
["name"]=>
array(5) {
  [0]=>
  string(12) "IMGP0023.JPG"
  [1]=>
  string(12) "IMGP0029.JPG"
  [2]=>
  string(0) ""
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
}
["type"]=>
array(5) {
  [0]=>
  string(10) "image/jpeg"
  [1]=>
  string(10) "image/jpeg"
  [2]=>
  string(0) ""
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
}
["tmp_name"]=>
array(5) {
  [0]=>
  string(14) "/tmp/phpjKcvSj"
  [1]=>
  string(14) "/tmp/phpD8tyD8"
  [2]=>
  string(0) ""
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
}
["error"]=>
array(5) {
  [0]=>
  int(0)
  [1]=>
  int(0)
  [2]=>
  int(4)
  [3]=>
  int(4)
  [4]=>
  int(4)
}
["size"]=>
array(5) {
  [0]=>
  int(2324898)
  [1]=>
  int(2319065)
  [2]=>
  int(0)
  [3]=>
  int(0)
  [4]=>
  int(0)
}
  }
}

On Nov 20, 7:54 pm, "Carsten Schumann"
<[EMAIL PROTECTED]> wrote:
> Okay, the next step is to trace down where your upload action rejects the 
> files.
>
> Your code looks ok since you copied most of the code from the documentation.
>
> I would put some debugging messages into the code, i.e. var_dump's.
> Before testing you should place an exit; before the redirect to avoid
> redirecting which will discard your debugging output.
>
> Look which operations are successful and trace down the problem.
>
> Carsten
>
> PS: If you end up with the moveFile line you should check if you
> enabled safe mode in php and if there is a file/permssion problem.
>
> On Nov 20, 2007 11:28 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
>
>
> > I can confirm that the files are being uploaded as per the globals
> > data of the debug toolbar.  See below.
>
> > files:
> >   newFile:
> > name:
> >   - IMGP0008.JPG
> >   - IMGP0012.JPG
> >   - IMGP0023.JPG
> >   -
> >   -
> > type:
> >   - image/jpeg
> >   - image/jpeg
> >   - image/jpeg
> >   -
> >   -
> > tmp_name:
> >   - /tmp/phpfUF14o
> >   - /tmp/phpx28E56
> >   - /tmp/php1Lgh5g
> >   -
> >   -
> > error:
> >   - 0
> >   - 0
> >   - 0
> >   - 4
> >   - 4
> > size:
> >   - 2161103
> >   - 2389461
> >   - 2324898
> >   - 0
> >   - 0
> > get:
> > post:
> >   album_parent_id: 3
> >   commit: Upload file
> >   user_id: 2
>
> > This leads me to belive the files do exist but then are not being
> > accessed by Symfony or I am trying to access them incorrectly.
>
> > On Nov 20, 7:11 pm, "Carsten Schumann"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi!
>
> > > Did you check the upload file limit in your php.ini? Most of the
> > > upload issues we had in the past were related to this limit.
>
> > > If it is fine, please check if php is aware of the uploaded files. You
> > > can do it by writing var_dump($_FILES) in your action.
>
> > > Carsten
>
> > > On Nov 20, 2007 10:54 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
> > > > Note: I have posted the on the forum but not really received a lot of
> > > > help or a solution to this yet.
>
> > > > Can someone Please help me with this. I have been trying to work this
> > > > out for hours with no success.
>
> > > > I tried uploading a single file and that worked fine. However when I
> > > > then try and upload multiple files then the result is nothing. No
> > > > error and no file upload.
>
> > > > See my view that makes the form.
>
> > > > 
>
> > > > getProfile()-
> > > > >getUserId()); ?>
>
> > > > 
> > > > Upload Photos
>
> > > >   
> > > >
> > > > > > >GalleryAlbumTools::nested_dropdown_albums($sf_user->getProfile()-
> > > > >getUserId()),
> > > >$sf_params->get('album_parent_id'),
> > > > 

[symfony-users] Re: Multiple file uploads in Symfony Help please

2007-11-20 Thread lionslair

All a var dump of

$this->debug = $this->getRequest()->getFileNames();

is:

 array(1) {
  [0]=>
  string(7) "newFile"
}

That is just then name of the upload field.  Why does this use
getFileNames() and not getFiles()?

On Nov 20, 7:54 pm, "Carsten Schumann"
<[EMAIL PROTECTED]> wrote:
> Okay, the next step is to trace down where your upload action rejects the 
> files.
>
> Your code looks ok since you copied most of the code from the documentation.
>
> I would put some debugging messages into the code, i.e. var_dump's.
> Before testing you should place an exit; before the redirect to avoid
> redirecting which will discard your debugging output.
>
> Look which operations are successful and trace down the problem.
>
> Carsten
>
> PS: If you end up with the moveFile line you should check if you
> enabled safe mode in php and if there is a file/permssion problem.
>
> On Nov 20, 2007 11:28 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
>
>
> > I can confirm that the files are being uploaded as per the globals
> > data of the debug toolbar.  See below.
>
> > files:
> >   newFile:
> > name:
> >   - IMGP0008.JPG
> >   - IMGP0012.JPG
> >   - IMGP0023.JPG
> >   -
> >   -
> > type:
> >   - image/jpeg
> >   - image/jpeg
> >   - image/jpeg
> >   -
> >   -
> > tmp_name:
> >   - /tmp/phpfUF14o
> >   - /tmp/phpx28E56
> >   - /tmp/php1Lgh5g
> >   -
> >   -
> > error:
> >   - 0
> >   - 0
> >   - 0
> >   - 4
> >   - 4
> > size:
> >   - 2161103
> >   - 2389461
> >   - 2324898
> >   - 0
> >   - 0
> > get:
> > post:
> >   album_parent_id: 3
> >   commit: Upload file
> >   user_id: 2
>
> > This leads me to belive the files do exist but then are not being
> > accessed by Symfony or I am trying to access them incorrectly.
>
> > On Nov 20, 7:11 pm, "Carsten Schumann"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi!
>
> > > Did you check the upload file limit in your php.ini? Most of the
> > > upload issues we had in the past were related to this limit.
>
> > > If it is fine, please check if php is aware of the uploaded files. You
> > > can do it by writing var_dump($_FILES) in your action.
>
> > > Carsten
>
> > > On Nov 20, 2007 10:54 AM, lionslair <[EMAIL PROTECTED]> wrote:
>
> > > > Note: I have posted the on the forum but not really received a lot of
> > > > help or a solution to this yet.
>
> > > > Can someone Please help me with this. I have been trying to work this
> > > > out for hours with no success.
>
> > > > I tried uploading a single file and that worked fine. However when I
> > > > then try and upload multiple files then the result is nothing. No
> > > > error and no file upload.
>
> > > > See my view that makes the form.
>
> > > > 
>
> > > > getProfile()-
> > > > >getUserId()); ?>
>
> > > > 
> > > > Upload Photos
>
> > > >   
> > > >
> > > > > > >GalleryAlbumTools::nested_dropdown_albums($sf_user->getProfile()-
> > > > >getUserId()),
> > > >$sf_params->get('album_parent_id'),
> > > >'include_blank=true'
> > > >)) ?>
> > > >   
> > > >   
> > > >   
> > > > 
> > > > 
> > > >   
> > > >   
>
> > > >   
> > > >
> > > >   
>
> > > > 
> > > > 
>
> > > > And the resulting action
>
> > > >   /**
> > > > *   Execute Action Upload photo
> > > > *
> > > > */
> > > >   public function executeUpload()
> > > >   {
> > > > if ($this->getRequest()->getMethod() != sfRequest::POST)
> > > > {
>
> > > >   return sfView::SUCCESS;
> > > > }
> > > > else
> > > > {
> > > >   if ($this->getRequest()->hasFiles())
> > > >   {
>
> > > > foreach ($this->getRequest()->getFileNames() as $fileName)
> > > > {
> > > >   //$this->logMessage(' uploaded image: '.
> >

[symfony-users] Re: Multiple file uploads in Symfony Help please

2007-11-20 Thread lionslair

Yes permissions are 777

On Nov 21, 1:40 am, Wang David <[EMAIL PROTECTED]> wrote:
> silly question, but did you check the permissions of the dir you're
> writing it to?
>
> -d
>
> On Nov 20, 2007, at 7:53 AM, lionslair wrote:
>
>
>
> > calling getFiles instead of getFileNames results in this from a
> > var_dump() output.
>
> > array(1) {
> >  ["newFile"]=>
> >  array(5) {
> >["name"]=>
> >array(5) {
> >  [0]=>
> >  string(12) "IMGP0023.JPG"
> >  [1]=>
> >  string(12) "IMGP0029.JPG"
> >  [2]=>
> >  string(0) ""
> >  [3]=>
> >  string(0) ""
> >  [4]=>
> >  string(0) ""
> >}
> >["type"]=>
> >array(5) {
> >  [0]=>
> >  string(10) "image/jpeg"
> >  [1]=>
> >  string(10) "image/jpeg"
> >  [2]=>
> >  string(0) ""
> >  [3]=>
> >  string(0) ""
> >  [4]=>
> >  string(0) ""
> >}
> >["tmp_name"]=>
> >array(5) {
> >  [0]=>
> >  string(14) "/tmp/phpjKcvSj"
> >  [1]=>
> >  string(14) "/tmp/phpD8tyD8"
> >  [2]=>
> >  string(0) ""
> >  [3]=>
> >  string(0) ""
> >  [4]=>
> >  string(0) ""
> >}
> >["error"]=>
> >array(5) {
> >  [0]=>
> >  int(0)
> >  [1]=>
> >  int(0)
> >  [2]=>
> >  int(4)
> >  [3]=>
> >  int(4)
> >  [4]=>
> >  int(4)
> >}
> >["size"]=>
> >array(5) {
> >  [0]=>
> >  int(2324898)
> >  [1]=>
> >  int(2319065)
> >  [2]=>
> >  int(0)
> >  [3]=>
> >  int(0)
> >  [4]=>
> >  int(0)
> >}
> >  }
> > }
>
> > On Nov 20, 7:54 pm, "Carsten Schumann"
> > <[EMAIL PROTECTED]> wrote:
> >> Okay, the next step is to trace down where your upload action
> >> rejects the files.
>
> >> Your code looks ok since you copied most of the code from the
> >> documentation.
>
> >> I would put some debugging messages into the code, i.e. var_dump's.
> >> Before testing you should place an exit; before the redirect to avoid
> >> redirecting which will discard your debugging output.
>
> >> Look which operations are successful and trace down the problem.
>
> >> Carsten
>
> >> PS: If you end up with the moveFile line you should check if you
> >> enabled safe mode in php and if there is a file/permssion problem.
>
> >> On Nov 20, 2007 11:28 AM, lionslair <[EMAIL PROTECTED]>
> >> wrote:
>
> >>> I can confirm that the files are being uploaded as per the globals
> >>> data of the debug toolbar.  See below.
>
> >>> files:
> >>>  newFile:
> >>>name:
> >>>  - IMGP0008.JPG
> >>>  - IMGP0012.JPG
> >>>  - IMGP0023.JPG
> >>>  -
> >>>  -
> >>>type:
> >>>  - image/jpeg
> >>>  - image/jpeg
> >>>  - image/jpeg
> >>>  -
> >>>  -
> >>>tmp_name:
> >>>  - /tmp/phpfUF14o
> >>>  - /tmp/phpx28E56
> >>>  - /tmp/php1Lgh5g
> >>>  -
> >>>  -
> >>>error:
> >>>  - 0
> >>>  - 0
> >>>  - 0
> >>>  - 4
> >>>  - 4
> >>>size:
> >>>  - 2161103
> >>>  - 2389461
> >>>  - 2324898
> >>>  - 0
> >>>  - 0
> >>> get:
> >>> post:
> >>>  album_parent_id: 3
> >>>  commit: Upload file
> >>>  user_id: 2
>
> >>> This leads me to belive the files do exist but then are not being
> >>> accessed by Symfony or I am trying to access them incorrectly.
>
> >>> On Nov 20, 7:11 pm, "Carsten Schumann"
> >>> <[EMAIL PROTECTED]> wrote:
> >>>> Hi!
>
> >>>> Did you check the upload file limit in your php.ini? Most of the
>

[symfony-users] Re: Multiple file uploads in Symfony Help please

2007-11-21 Thread lionslair

This has been solved.  After reviewing the demo of an unrelated app
written in Symfony it took all but seconds to know how multiple file
uploads work.

The trick is to give each upload field a different name. Not the same
name more an aarray

eg


  


  
  

See the upload field name is


This then produces this form.




Upload Photos

  
   Parent Album   
hawkins
-gloria

  

File:  

File:  


File:  

File:  

File:  


  
 




Because symfony uses the method getFileNames which is using array_keys

each of the uploaded files are made its own array in the $_FILES array
in PHP

when symfony gets the key of this array element it they access all the
elements of the file which has been uploaded by this key.  Know
knowing how this works it actually is a good way of doing it.  I do
hope this help other who get stuck on this like I did.  I am sorry if
this is hard to understand but what I am trying to say is correct and
does work.

On Nov 20, 6:54 pm, lionslair <[EMAIL PROTECTED]> wrote:
> Note: I have posted the on the forum but not really received a lot of
> help or a solution to this yet.
>
> Can someone Please help me with this. I have been trying to work this
> out for hours with no success.
>
> I tried uploading a single file and that worked fine. However when I
> then try and upload multiple files then the result is nothing. No
> error and no file upload.
>
> See my view that makes the form.
>
> 
>
> getProfile()-
>
> >getUserId()); ?>
>
> 
> Upload Photos
>
>   
>
>
> GalleryAlbumTools::nested_dropdown_albums($sf_user->getProfile()->getUserId()),
>
>$sf_params->get('album_parent_id'),
>'include_blank=true'
>)) ?>
>   
>   
>   
> 
> 
>   
>   
>
>   
>
>   
>
> 
> 
>
> And the resulting action
>
>   /**
> *   Execute Action Upload photo
> *
> */
>   public function executeUpload()
>   {
> if ($this->getRequest()->getMethod() != sfRequest::POST)
> {
>
>   return sfView::SUCCESS;
> }
> else
> {
>   if ($this->getRequest()->hasFiles())
>   {
>
> foreach ($this->getRequest()->getFileNames() as $fileName)
> {
>   //$this->logMessage(' uploaded image: '.
> print_r($fileName),'err');
>   $fileSize  = $this->getRequest()->getFileSize($fileName);
>   $fileType  = $this->getRequest()->getFileType($fileName);
>   $fileError = $this->getRequest()->hasFileError($fileName);
>   $fileRealName = $this->getRequest()->getFileName($fileName);
>   $uploadDir =
> sfConfig::get('sf_upload_dir').sfConfig::get('app_gallery_picture_folder').
> DIRECTORY_SEPARATOR . $fileName;
>   //$uploadDir = sfConfig::get('sf_upload_dir');
>
>   $this->getRequest()->moveFile($fileName, $uploadDir);
> }  // end foreach
>
> $this->setFlash('class', 'confirmation');
> $this->setFlash('msg', 'Your images have been successfully
> uploaded');
> $this->redirect('@photo_management');
>   } // end if file uplaods
>
> } // end if else
>
>   } // end function executeUpload
>
> What is it I am doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfGuard plugin - redirect to login page doesn't work

2007-11-28 Thread lionslair

what does the logs show?

On Nov 28, 7:18 pm, StefanM <[EMAIL PROTECTED]> wrote:
> Hello,
>
> After a successful install of sfGuard plugin (and after setting all
> up, as in documentation, wiki etc.), I still cannot get to the login
> page. Tried every solution that popped out from other users, with no
> luck.
> The only page I see is the one with
>
> Credentials Required
> This page is in a restricted area.
>
> You do not have the proper credentials to access this page
> Even though you are already logged in, this page requires special
> credentials that you currently don't have.
>
> If the security is disabled in security.yml, everything works ok
> (adding groups, permissions, users).
>
> I remember that back on 1.0.6, the plugin worked as expected. Now I'm
> 1.0.8. Related in any way?
>
> Thank you.
> Stefan.
>
> My settings are:
>
> /apps/backend/config/security.yml
>
> default:
>   is_secure: on
>
>  /apps/backend/config/settings.yml
>
> all:
>   .actions
> login_module:   sfGuardAuth
> login_action:   signin
> secure_module:  sfGuardAuth
> secure_action:  secure
>   .settings:
> enabled_modules: [default, sfGuardGroup, sfGuardUser,
> sfGuardPermission, sfGuardAuth]
>
> (Also tried with login_action: login, same result)
>
> /apps/config/routing.yml
>
> # default rules
> homepage:
>   url:   /
>   param: { module: default, action: index }
>
> default_symfony:
>   url:   /symfony/:action/*
>   param: { module: default }
>
> default_index:
>   url:   /:module
>   param: { action: index }
>
> default:
>   url:   /:module/:action/*
> #also tried manually registering routes, as in documentation page, no
> luck
>
> /apps/lib/myUser.class.php
>  class myUser extends sfGuardSecurityUser
> {
>
> }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] escaping export data within yml file

2008-01-12 Thread lionslair

Situation:

I have created a batch script to export all the data I want to migrate
from my old website to my new one.  I have placed all the exported
data into a yml file within the fixtures directory.

The issue I am having is importing my blog posts.  I can not seem to
find how to escape the body sections of the blogs in order to import
it via fixtures.  What is the correct way to escape blocks of text
such as blogs within yml files.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: form_remote_tag and updating multiple divs

2008-08-20 Thread lionslair



On Aug 20, 5:15 am, "Pedro Bastos" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I can see two possible solutions for your question:
>
> a) Set a handler on your Ajax.Update object. Insert complete in your
> options. Eg:
>
>    'update'   => 'badgeHolder',
>   'url'      => '@login_badge',
>   'complete' => 'executeWhenFinished(request)'
>  )) ?>
>
>  Then you have to create a javascript handler to update any DOM object.
>
> b) Set a global Ajax handler. Insert this BEFORE you execute Ajax.Updater:
>
> Ajax.Responders.register({
>   onComplete: function(){
>     // handle all Ajax requests
>   }
>
> });
>
> This will handle ALL xmlHttpRequest requests made in your page.
>
> I suggest you to use the first one. It is clean and easy.
>
> Questions? Reply back. :)
>
> Pedro
>
> On Tue, Aug 19, 2008 at 1:29 PM, laura <[EMAIL PROTECTED]> wrote:
>
> > hi-
>
> > i've seen this type of question posted elsewhere, but haven't been
> > able to figure out how to do it. i have a form_remote_tag that logs a
> > user into our site. upon login, it updates the login div to be a
> > logged-in div. but, i also have a component at the top of the page
> > that needs to be updated:
>
> >  >  'update'   => 'badgeHolder',
> >  'url'      => '@login_badge',
> > )) ?>
>
> > there other div has a component in it that would need to be swapped
> > out upon logging in.
>
> > so to summarize, how would i update 2 components upon submitting the
> > form?
>
> > thanks!
>
> > laura

Remote function is what I use

  'badgeHolder',
   'url'  => '@login_badge',
   'complete' => remote_function(array(
 'url' =>
'ModuleName/ActionName',
 ''update =>
'name_of_second_div',
'script' =>
TRUE,
)),
'script' => TRUE,
  )) ?>


Remember to always add 'script' => TRUE, to all of your javascript
helpers.  Even if its nested ADD IT
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---