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 6240523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:35:08+00:00 2026-05-24T11:35:08+00:00

I also need to create a copy action in symfony. I already looked at

  • 0

I also need to create a copy action in symfony. I already looked at these question and answer: symfony 1.4: creating "Copy" action. It seems to work fine, but when I try to save a get these error message: “csrf token: CSRF attack detected”. I reckon it’s because I don’t know where to change the form attribute action.

Any help much appreciated!

Here is my code:

actions.class.php:

class eventActions extends autoEventActions {

  public function executeCopy(sfWebRequest $request)
  {

    $this->form = new EventCopyForm($this->getRoute()->getObject());
    $this->event = $this->form->getObject();
    $this->setTemplate('copy');
  }

  public function executeUpdatecopy(sfWebRequest $request)
  {
    $this->form = new EventCopyForm($this->getRoute()->getObject());
    $this->processForm($request, $this->form);
    $this->setTemplate('copy');
  }
}

EvenCopyForm.class.php:

class EventCopyForm extends EventForm {

  public function doSave($conn = null)
  {
    $this->updateObject();
    $event = $this->getObject()->copy();
    $event->save();
  }  
}

copySuccess.php:

<?php use_helper('I18N', 'Date') ?>
<?php include_partial('event/assets') ?>

<div id="sf_admin_container">
  <h1><?php echo __('Copy Event', array(), 'messages') ?></h1>

  <?php include_partial('event/flashes') ?>

  <div id="sf_admin_header">
    <?php include_partial('event/form_header', array('event' => $event, 'form' => $form, 'configuration' => $configuration)) ?>
  </div>
  <div id="sf_admin_content">
    <?php include_partial('event/form', array('event' => $event, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?>
  </div>
  <div id="sf_admin_footer">
    <?php include_partial('event/form_footer', array('event' => $event, 'form' => $form, 'configuration' => $configuration)) ?>
  </div>
</div>
  • 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-24T11:35:09+00:00Added an answer on May 24, 2026 at 11:35 am

    I have done it now in a different way:
    + I get the object as an array:

    $original->toArray(false);
    
    • then unset the id:

      unset($originalValues[‘id’]);

    • make a copy object which I save:

      $copy = new Event();
      $copy->fromArray($originalValues);
      $copy->save();

    That works fine for me.

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

Sidebar

Related Questions

I need to create an ejabberd user from a PHP script. I also need
I want to create a cookie using php,an also i need to read it
I need a dictionary but I also need to store a boolean value about
I need a collection that behaves something like C++ multimap, but I also need
How can I construct an object using a query if I also need to
I retrieve mail using net/pop , but I also need to parse through the
I'm trying to deploy a Java applet on my website. I also need to
I'm using the PHP edition of Eclipse, but was told that I also need
I am trying to center a Window to the owner window. I also need
I can use GetModuleHandle to get its base offset, but I also need to

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.