You'll need to disable foreign key exporting for the models in the other
database.
Example
-----------
User:
attributes:
export: tables
That will only export the tables. You won't be able to build DQL queries
that join across databases like you did above. You'll need to lazy load it
with individual calls.
- Jon
On Tue, Oct 7, 2008 at 11:31 AM, Lee Bolding <[EMAIL PROTECTED]> wrote:
>
> Jonathan,
>
> I was able to successfully build my models, using the method you
> suggested.
>
> However, if I try and create the 2nd database to hold my data (using
> build-all-reload) I get a bunch of foreign key constraint errors, and
> it bails. I guess that's to be expected though - I don't think MySQL
> supports foreign keys in different databases. In which case, should
> Doctrine either alert me when I generate the model, or leave out the
> foreign key definitions?
>
> Also, I've now managed to get something working - I can query objects
> from either database, but when I try and join objects across the 2
> databases I get unknown alias errors... eg
>
> bash-3.2# php symfony doctrine:dql frontend "FROM sfGuardUser u,
> u.Comments c"
> >> doctrine executing: "FROM sfGuardUser u, u.Comments c" ()
>
>
> Unknown relation alias Comments
>
> Should I be able to perform joins across databases with Doctrine? or
> isn't this supported?
>
> Sorry for all the questions - I couldn't find much regarding component
> binding and caveats of using it. I'm not even sure I'm using it the
> way it was intended to be used :-/
>
> Lee
>
> On 6 Oct 2008, at 16:58, Jonathan Wage wrote:
>
> > If you simply copy your schema from your plugin to your project
> > schema folder then you can customize the schema.
> >
> > Then you can just add "connection: conn_name" to the top of the
> > schema file or within the models you wish to bind to a certain
> > connection.
> >
> > - Jon
> >
> > On Mon, Oct 6, 2008 at 10:53 AM, Thomas Rabaix <[EMAIL PROTECTED]
> > > wrote:
> >
> > Hello,
> >
> > I have not try this with doctrine. Cannot say...
> >
> > Thomas
> >
> > On Mon, Oct 6, 2008 at 5:34 PM, Lee Bolding <[EMAIL PROTECTED]> wrote:
> > >
> > > Thanks Thomas, that looks promising.
> > >
> > > How do I bind sfGuard* to a different database though?
> > >
> > > At the moment I've got something like this in my
> > > frontendConfiguration.class.php - but haven't yet tried it
> > >
> > > class ProjectConfiguration extends sfProjectConfiguration
> > > {
> > > public function setup()
> > > {
> > > Doctrine_Manager::connection('mysql://root:[EMAIL PROTECTED]/
> > > global', 'global');
> > > Doctrine_Manager::bindComponent('sfGuardUser', 'global');
> > > }
> > > }
> > >
> > > Hopefully I'll be able to test that out tomorrow. Presumably, if I
> > > bind only sfGuardUser, the other objects in sfGuardPlugin will
> > remain
> > > bound to my database containing all the other data? (this is what I
> > > want to happen).
> > >
> > > Cheers
> > >
> > > Lee
> > >
> > > On 6 Oct 2008, at 16:07, Thomas Rabaix wrote:
> > >
> > >>
> > >> Hello,
> > >>
> > >> If you want to had custom fields into the model, you can
> > overwrite the
> > >> setTableDefinition and setUp method on the generated class.
> > >>
> > >> Thomas
> > >>
> > >> On Mon, Oct 6, 2008 at 4:38 PM, Lee Bolding <[EMAIL PROTECTED]>
> > wrote:
> > >>>
> > >>> Hi gang,
> > >>>
> > >>> I've just taken the leap and upgraded to both Symfony 1.1 and
> > >>> Doctrine
> > >>> for a new project I'm working on.
> > >>>
> > >>> So far, so good - learning curve for Doctrine doesn't seem that
> > >>> steep,
> > >>> and haven't yet got to the point of having fun with the new
> > forms and
> > >>> validators stuff in Symfony 1.1
> > >>>
> > >>> Anyway, I'm using the sfGuardDoctrinePlugin - but, here's the
> > catch -
> > >>> my users data is stored in a separate database to the rest of the
> > >>> data
> > >>> for my application, and it's a legacy database that I can't change
> > >>> the
> > >>> schema on.
> > >>>
> > >>> So, what I really need to do is utilise the component binding
> > >>> functionality of Doctrine, but also use the
> > sfPropelAlternativeSchema
> > >>> plugin to change the schema of the sfGuard plugin - but, it's a
> > >>> Propel
> > >>> plugin, not a Doctrine one. I think to get around that I'll have
> > to
> > >>> bite the bullet and manually change the schema for the plugin...
> > >>> but I
> > >>> can't see that I (or anyone else) will ever upgrade this plugin
> > once
> > >>> the application is deployed and working.
> > >>>
> > >>> So, my question is : how do I configure Doctrine component binding
> > >>> via
> > >>> YAML? or do I need to do this in a config file such as
> > >>> ProjectConfiguration.class.php?
> > >>>
> > >>> Once that's done, how do I make my 'users' component available
> > to use
> > >>> in my YAML for my other models?
> > >>>
> > >>> Thanks in advance....
> > >>>
> > >>>
> > >>>
> > >>>>
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> Thomas Rabaix
> > >> Internet Consultant
> > >>
> > >> >
> > >
> > >
> > > >
> > >
> >
> >
> >
> > --
> > Thomas Rabaix
> > Internet Consultant
> >
> >
> >
> >
> >
> > --
> > Jonathan H. Wage
> > Open Source Software Developer & Evangelist
> > http://www.jwage.com
> >
> > >
>
>
> >
>
--
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---