Hi,

  Suppose you have an old "dirty" table named "news_website" :

ID  |   NAME    |    TAGS      |    CATEGORY1   |      CATEGORY2    |
CATEGORY3

Define it in Doctrine with an "old" prefix :


oldNewsWebsite:
  columns:
    id:        { type: integer(4), primary: true }
    name:      { type: varchar(64) }
    tags:      { type: varchar(255) }
    category1: { type: string(32) }
    category2: { ... }
    category3: { type: string(32) }


Do not try to make some "clean" model, define it as it is.

Now, in your oldNewsWebsite class, define for example a method :
getCleanNews.

This method must returns an object with the new schema definition :

$news = new News();
$topic = $this->getTable()->getCleanTopic(); // Returns the news topic named
"Website"
$news->setTopic($topic);
$tags = explode(", ", $this->getTags());
foreach ($tags as $tagName)
{
  Doctrine::getTable('oldTag')->getCleanTag($tagName);
}
if ($category1 = $this->getCleanCategory1())
{
  $news->addCategory($category1);
}
// and so on...
return $news;


And after, the idea is to retrieve old objects one by one, extract the clean
objects and save them.

The aim is to remove this "old" schema after the transition is complete.

Do you understand the idea ?

Alexandre


  Feel free to put schema definition in a "oldPlugin", to isolate it and
remove it when not needed anymore.

2009/12/14 Alexandru-Emil Lupu <gang.al...@gmail.com>

> Well... do your stuff using symfony ... and pretend that you still
> work on that application ... and take some days off :)
> To be ready for the moment when they will say "Hey, we have a bug
> there..." (of course in the non sf version)... then you refactorize
> that area as well ...
> I have manage convince my boss that is better to that with symfony,
> because is much more maintainable and extensibile ...
> if they cannot afford a cool / secure / organized application ... then
> i might recommend you something (heard from others ): "Change your
> job, or change your job." or, of course the client ...
> Alecs
>
> On Mon, Dec 14, 2009 at 10:46 PM, Campezzi <campe...@gmail.com> wrote:
> > Hi Alecs, thanks for your replies! My initial idea was to upgrade
> > their entire plataform to run on symfony, but they didn't approve that
> > idea for two reasons: one, it would go over their budget... and two,
> > they had several random screens scattered all over the server that
> > were used by different team members on random occasions... They didn't
> > even know the full range of capabilities of their system because of
> > that LOL :)
> >
> > I think I'll end up going with pure php, or maybe disabling the ORM
> > entirely and doing all database interactions by hand... ugh! :(
> >
> > Unless, of course, someone else has a magical solution ;)
> >
> > Thanks again and best regards,
> >
> > Thiago Campezzi
> > campe...@gmail.com
> >
> > On 14 dez, 16:57, Alexandru-Emil Lupu <gang.al...@gmail.com> wrote:
> >> Sorry for my previous mail.
> >> i was on the move and i just remembered "Symfony 1.2" ... instead of
> >> "symfony (1.4,
> >> doctrine 1.2)"
> >>
> >> About your initial qustestion: try implement the whole system as a
> >> symfony platform. That will allow you to put some order in your
> >> code...
> >> Those automatizations like sending notifications mails could resume to
> >> 2 symfony commands run from a cron job.
> >>
> >> symfony yourapp:build-notifications
> >> symfony project:send-emails
> >>
> >> Also, the interface could be easily built be using the crud.
> >>
> >> Alecs
> >>
> >> On Mon, Dec 14, 2009 at 8:58 PM, Alexandru-Emil Lupu
> >>
> >>
> >>
> >>
> >>
> >> <gang.al...@gmail.com> wrote:
> >> > How complex is the "old" application? Using symfony, it might be play
> in the
> >> > park to reorganize your old code, and make your necesarilly
> adjustments on
> >> > the schema as you need, or you consider proper.
> >> > Btw... do yourself a favor and code it with 1.4 . I will tell you why
> in 30
> >> > mins
> >> > Alecs
> >>
> >> > sent via htc magic
> >>
> >> > On Dec 14, 2009 8:24 PM, "Campezzi" <campe...@gmail.com> wrote:
> >>
> >> > Hello everyone, I'm starting a new project and I'd like some input
> >> > from the community as to what is the best way to approach this
> >> > implementation. Here it goes:
> >>
> >> > The project goal is to automate the client's invoice generation and
> >> > management (email notifications,etc). The client already has a custom
> >> > system in place (pure php + mysql) that includes a database of clients
> >> > and projects and also some basic accounting screens. This new project
> >> > should interact with these systems that are already in place (i.e.
> >> > getting client e-mail addresses from the database to send invoices,
> >> > creating accounting entries when invoices are paid, etc.)
> >>
> >> > As you can expect, their systems are currently a mess of unmanageable
> >> > code, and I wanted to create the invoicing system using symfony (1.4,
> >> > doctrine 1.2). Here's where your input is appreciated: how should I go
> >> > about integrating the new sf-based project with the old database where
> >> > necessary?
> >>
> >> > So far, my only idea is to duplicate the old database layout in my
> >> > schema.yml file but I'd like to avoid that since the current db is
> >> > really, really messy...
> >>
> >> > Any ideas?
> >>
> >> > --
> >>
> >> > You received this message because you are subscribed to the Google
> Groups
> >> > "symfony users" group.
> >> > To post to this group, send email to symfony-us...@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/symfony-users?hl=en.
> >>
> >> --
> >> Have a nice day!
> >> Alecs
> >>
> >> As programmers create bigger & better idiot proof programs, so the
> >> universe creates bigger & better idiots!
> >> I am on web:  http://www.alecslupu.ro/
> >> I am on twitter:http://twitter.com/alecslupu
> >> I am on linkedIn:http://www.linkedin.com/in/alecslupu
> >> Tel: (+4)0748.543.798
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> > To post to this group, send email to symfony-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> > For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> >
> >
> >
>
>
>
> --
> Have a nice day!
> Alecs
>
> As programmers create bigger & better idiot proof programs, so the
> universe creates bigger & better idiots!
> I am on web:  http://www.alecslupu.ro/
> I am on twitter: http://twitter.com/alecslupu
> I am on linkedIn: http://www.linkedin.com/in/alecslupu
> Tel: (+4)0748.543.798
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to symfony-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>
>


-- 
Alexandre Salomé
http://alexandre-salome.fr

--

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


Reply via email to