Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:36:09+00:00 2026-05-13T15:36:09+00:00

Assume a Doctrine model Profile : # This is example of my schema.yml Profile:

  • 0

Assume a Doctrine model Profile:

# This is example of my schema.yml
Profile:
 columns:
   avatar:
     type: string(255)
     notnull: true

My goal is to generate profile’s avatar from uploaded file:

class Avatar extends BaseAvatar{
  public function postSave($e){
    if($this->getAvatar()){
      // resize/crop it to 100x100
      // and save
    }
}

That logic is fine for me now. But my Profile associated record is updated on every request with some extra info. And, as you can see, avatar file is generated over and over in spite of the fact that avatar field may stay the same.

Question: How can framework determine whether the particular field is updated or not?

Note: I don’t need updating in symfony’s actions because of code repeating in several apps. Or maybe I need?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:36:10+00:00Added an answer on May 13, 2026 at 3:36 pm

    If you are using a Form to render the profile editing fields I would suggest moving your resizing code into there by overriding the saveFile method you inherit from sfFormDoctrine:

    protected function saveFile($field, $filename = null, sfValidatedFile $file = null)
    {
      $finalFilename = parent::saveFile($field, $filename, $file);
      if($field == 'avatar')
      {
        // generate thumbnail from $finalFilename
      }
    }
    

    That will get called when the save() method is called on your form. Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what I assume is a configuration problem with my Doctrine schema.yml, but
Assume this model class : public class Car extends Vehicle implements Visitable { .....
I have a little problem with Doctrine model hydrate() method. I use this method
Assume two classes, simplified Class Room { String Name {get; set;} String Type {get;set;}
Assume I have two tables, Student Test Id Name TestId Type StudentId -- ----
Assume this code works: left '*' left '+' expr: expr '+' expr | expr
Assume I have a set of numbers like 1,2,3,4,5,6,7 input as a single String
Assume i have a class: public class Products { public string ID { get;
Assume you are doing something like the following List<string> myitems = new List<string> {
Assume I have 3 files in my project: data model file, dealing with Core

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.