addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

NY Symfony - The PHP Framework Meetup Message Board › QUICK AND DIRTY: Creating new symfony2 project based on legacy schema

QUICK AND DIRTY: Creating new symfony2 project based on legacy schema

A former member
Post #: 21
Install doctrine2 via pear
http://www.doctrine-p...­

Make sure pear libraries are in your php ini's include path:
http://pear.php.net/m...­

Use the script located at:
http://jejakroda.word...­

Move the classes output by that script into your {symfony_root}/src/{company_name}/{bundl­e_name}/Entity folder

Replace the @ symbol in front of all instances of @Table, @Entity, @Id, @Column, @GeneratedValue with @orm:

Change any Id column's GeneratedValue(strategy="NONE"­) to GeneratedValue(strategy="AUTO"­) if you want them to auto-increment.

Add the bundle's namespace to the top of the file
namespace {company_name}\{bundle_name}\Entity;

If you want lifecycle events on this object add the following annotation to the Class phpdoc

* @orm:HasLifecycleCallbacks

Add the following if you want automatic created_at and updated_at fields on the entity:


/**
* @orm:Column(type="datetime", name="created_at")
*
* @var DateTime $createdAt
*/
protected $createdAt;

/**
* @orm:Column(type="datetime", name="updated_at", nullable="true")
*
* @var DateTime $updatedAt
*/
protected $updatedAt;

/**
* Constructs a new instance of User
*/
public function __construct()
{
$this->createdAt = new \DateTime();
}

/**
* Invoked before the entity is updated.
*
* @orm:PreUpdate
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
Powered by mvnForum

Our Sponsors

  • eZ Systems

    eZ provides logistics and organization horsepower as well as goodies.

  • NYPHP

    Community Partner.

  • NYCCAMP

    NYC (Nice) CAMP has provided fun squishy ball swag in the past.

  • Spotify

    Spotify has provided space, food and beverages for us in the past.

  • The Orchard

    The Orchard has provided space, food and beverages for us in the past.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy