I have another quick question about what I've posted. In the model of
de record, let's say the model "Image" following my last post.. I need
to override the "save" function to add the logic to generate
thumbnails and to delete files if needed. Let's say that my function
is the one that posted before:

public function save( Doctrine_Connection $con = null )
{
      // .. more functions.. generateThumbnails()... deleteImages()..
etc

      // if getLink() returns '' it means that an image needs to be
added
      if ( $this->getLink() !== '' )
      {
            if ( !$this->isNew() )
            {
                   $this->deleteImages();
            }

            $this->generateThumbnails();
      }

      parent::save( $con );

}

But there's a problem. If I DON'T modify the image, symfony puts the
value of the original link in the input anyway. So, when I submit the
form, the "getLink" accessor returns the original link. What's the
best way to check if the "link" was modified? (I mean, for example, if
the user wants to modify an image with another). I tried with
Doctrine_Record's "getModified" but it returns the new link always,
even if the user didn't modify it. I have to retrieve the original
record from the DB with a query and check against it?

And the final question.. if I use sfWidgetFormInputFileEditable.. how
would I handle the "delete" field? I can show it without a problem but
when I select "delete the current file" the only thing it does is
clear the "link" field from the DB. Which function should I override
to delete the image object if this field is checked? How could I do
this?


Thanks in advance and sorry for the long post.. but if I knowing this
things I can manage the 90% of the cases in my project.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to