[symfony-users] Re: sfGridPlugin, Propel/Doctrine-DataSources, ObjectPaths and JavaScript (ExtJS) extensions

2010-04-12 Thread E_lexy
Leon,

I just checked out all required plugins to generate a grid.
Using your old sfGridExtjs3plugin, i get inheritance errors.
it seems the sfGrid class variables cannot be reached by any subclass
(private).
When I change them to 'protected' the subclasses are allowed access
and all works fine.

p.s. i am very curious to see your extjs grid plugin, I have am using
old plugin so I can specify EXtjs column plugins is the meta data, and
have Extjs generate the entire grid based on the json
http://www.extjs.com/deploy/dev/docs/source/Store.html#cls-Ext.data.Store

Alex

On Apr 12, 11:03 am, DigitalBase i...@digitalbase.eu wrote:
 Leon,

 i am trying out your sfGrid plugin and ran into few small issues
 where do you want us to report problems/bugs ?

 On Apr 11, 10:53 pm, Leon van der Ree l...@fun4me.demon.nl wrote:



  Today I will provide a tutorial, setting up a (propel-based)
  playground with some best practices I came up with so far. (If you
  prefer Doctrine, you can still follow the tutorial, but of course need
  to setup a Doctrine schema and use the Doctrine plugins)

  If you want to see where all the fuzz is about, peak ahead and look at
  the size of the controller and the template!
  All configuration can be done in an extended

  Lets begin with a new (Symfony 1.4) Project:

  Tip: create a new repository on your svn-server and check this out!
  (this is useful since we are using a lot of plugins from svn, that can
  be updated all at once by using svn:externals )

    svn co your.svn.server/playground-project playground
  or, when not using svn
    mkdir playground

    cd playground
    php /symfony14/data/bin/symfony generate:project --orm=propel
  playground

  we now have a new propel-based syfmony 1.4 project. Lets start by
  adding all required Plugins:

    svn propedit svn:externals .

  and add the following lines to it:

  plugins/sfPropel15Pluginhttp://svn.symfony-project.com/plugins/sfPropel15Plugin/trunk
  plugins/sfPropelObjectPathBehaviorPluginhttp://svn.symfony-project.com/plugins/sfPropelObjectPathBehaviorPlug...
  plugins/sfDataSourcePlugin  
  http://svn.symfony-project.com/plugins/sfDataSourcePlugin/trunk
  plugins/sfGridPluginhttp://svn.symfony-project.com/plugins/sfGridPlugin/trunk

  Now we enable our plugins, first by editing our Project configuration,

  edit config/ProjectConfiguration.class.php
  and enable your plugins in the setup-function:

      $this-enablePlugins(
          'sfPropel15Plugin',
          'sfPropelObjectPathBehaviorPlugin',

  //      'sfExtjs3Plugin', // soon people

        'sfDataSourcePlugin',
        'sfGridPlugin' //,
  //      'sfGridExtjsPlugin' // soon Just teasing ;)
      );

  Setup propel, by editing propel.ini
  please note propel1.5 is requiring different behavior-paths and we are
  enabling the object-path plugin:
  So the behaviors section should look like this:

  ; behaviors
  propel.behavior.default                        =
  symfony,symfony_i18n,object_path

  propel.behavior.symfony.class                  =
  plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfony
  propel.behavior.symfony_i18n.class             =
  plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18n
  propel.behavior.symfony_i18n_translation.class =
  plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18nTranslation
  propel.behavior.symfony_behaviors.class        =
  plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
  propel.behavior.symfony_timestampable.class    =
  plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorTimestampable

  propel.behavior.object_path.class              =
  plugins.sfPropelObjectPathBehaviorPlugin.lib.ObjectPathBehavior

  Currently I have a simple schema as an example:

  propel:
    city:
      id:
      name:       varchar(255)
      country_id:
      created_at:

    country:
      id:
      name:      varchar(255)
      created_at:

  lets build the model

    ./symfony propel:build-all

  Add an application and empty module:

    ./symfony generate:app frontend
    ./symfony generate: frontend cityGrid

  Now add a grid folder to your lib-folder and add a CityGrid.php file

    mkdir lib/grid
    edit lib/grid/CityGrid.php

  and add the following code to it:

  ?php
  class CityGrid extends sfWebGrid  // soon you can extend the
  sfGridExtjs3 - class
  {
    /**
     *
     * @param sfWebRequest $request
     */
    public function __construct(sfWebRequest $request)
    {
      $cityDataSource = new sfDataSourcePropel('City');
      parent::__construct($cityDataSource);

      $this-setDefaultSort('Country.Name', sfGrid::ASC);

      $this-setColumns(array(
        'Id',
        'Country.Name',
        'Name'
      ));

      $this-setColumnTitles(array(
        'Country.Name' = 'Country',
        'Name'         = 'City'
      ));
      $this-setSortable(sfGrid::ALL);

      $this-getPager()-setMaxPerPage(2);
      $this-bind($request);
    }

  }

  Now you can add the 

[symfony-users] Re: Database Views with Symfony Doctrine

2009-10-09 Thread E_lexy

@david I am also interested in your solution.

My 2 cents:

At the moment we are working with views by letting Doctrine create
tables from the VIEW model classes, and the overwriting them with an
SQL to create the actual views.

I have managed to keep the relations (FK) out of the the DB by
specifying:
public function setUp()
  {
parent::setUp();

$this-setAttribute(Doctrine::ATTR_EXPORT, DOCTRINE::EXPORT_NONE);

$this-hasOne('UserView', array(
'local' = 'user_id',
'foreign' = 'user_id',
));
}

Otherwise the DB would create FKs to empty tables, that will cause
errors in loading fixtures (for testing etc).

I have not managed to keep entire VIEW model classes out of the DB by
specifying ithe EXPORT_NONE property in this way.

On Oct 8, 11:49 pm, david da...@inspiredthinking.co.uk wrote:
 I'll see about extracting the code in the next few days and drop a mail  
 when it's done.

 On Thu, 08 Oct 2009 22:09:45 +0200, ridcully ohnhei...@googlemail.com  
 wrote:





  Is the view behavior writen by our own? Or can I found this behavior
  somewhere?

  Thanx you alot,
  Jörg

  On Oct 8, 5:37 pm, david da...@inspiredthinking.co.uk wrote:
  Reverse engineering from an existing DB is just a quick way of  
  bootstrapping the start of a project.

  Doctrine doesn't handle views very well - although it is aware of them.

  Working around this problem when creating some new Doctrine drivers for  
   CouchDB  RDF I've used view behaviours and then annotate the schema  
  to  get a clean implementation.
  The behaviour handles the view creation and the model gets generated  
  accordingly referencing/overloading the referenced base table and  
  importing the appropriate keys.

  The yml looks like:

  locationsInEurope:
     tableName: locationsInEurope
     actAs:
       hasViews:
         references: Locations
     columns:
       country_id:
         type: integer(4)
       region_id:
         type: integer(4)
       city_id:
         type: integer(4)
       district_id:
         type: integer(4)

  Regarding data dumps - the doctrine:data-dump task is a better way of  
  handling extracting and reloading the db.

  On Thu, 08 Oct 2009 11:58:51 +0200, ridcully ohnhei...@googlemail.com  
   wrote:

   Hi John,

   the Problem is when you doing the views this way is, you don't have a
   clean
   deployment anymore  then we can't use symfony build-all-reload-test
   for the dev. Team.
   I must use SQL-Dumps and I think this is not the right way, because
   you
   can't change the Model quick and easy.

   There must be a better way to do this, because we need a the mostly
   clean Deployment without SQL-Dumps.

   Many thanks for your answer,
   Jörg

   On Oct 8, 11:47 am, John Masson jmas...@gmail.com wrote:
   Hi,

   We were discussing this at work yesterday. One of the guys came up
   with the same solution and it sounds quite reasonable.

   Out of interest we reverse engineered a schema.yml from a DB that had
   a view in it just to see what would happen. Symfony includes the view
   in the schema.yml file just like it was a regular table, but there  
  was
   nothing to identify it as a view rather than a table that I could  
  see,
   so presumably if we forward engineered the database from this
   schema.yml it would have created a table not a view (should have done
   that just to confirm I guess)

   My recommendation would be to create your DB as you want it, then
   reverse engineer your schema.yml with a ./symfony doctrine:build-
   schema then build-model, forms, filters etc... Just saves you  
  dropping
   the tables and recreating the views which you'd have to do if you  
  work
   in the opposite direction (although it's not such a big deal I  
  guess).

   John

   On Oct 7, 7:48 pm, ridcully ohnhei...@googlemail.com wrote:

Hi,

how can I use Database Views in Symfony with Doctrine? I need them
because of performance reasons.

My Idee was to create dummys in the model and after building the  
  Model
to drop the dummy tabels and create SQL Views.

Is there a better way to do this?

  --
  Using Opera's revolutionary e-mail client:http://www.opera.com/mail/

 --
 Using Opera's revolutionary e-mail client:http://www.opera.com/mail/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@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
-~--~~~~--~~--~--~---



[symfony-users] Re: Database Views with Symfony Doctrine

2009-10-09 Thread E_lexy

@david

The reason we use these views is because we need Subqueries and
Aggregate functions in our views for use in a sfGrid
DatasourceDoctrine.
Looking a bit at your YML snippet, poses a question:
Does you solution provide a way to use subqueries and aggregate
functions?

-Alex

On Oct 9, 11:14 am, E_lexy alexk...@gmail.com wrote:
 @david I am also interested in your solution.

 My 2 cents:

 At the moment we are working with views by letting Doctrine create
 tables from the VIEW model classes, and the overwriting them with an
 SQL to create the actual views.

 I have managed to keep the relations (FK) out of the the DB by
 specifying:
 public function setUp()
   {
     parent::setUp();

     $this-setAttribute(Doctrine::ATTR_EXPORT, DOCTRINE::EXPORT_NONE);

     $this-hasOne('UserView', array(
         'local' = 'user_id',
         'foreign' = 'user_id',
     ));

 }

 Otherwise the DB would create FKs to empty tables, that will cause
 errors in loading fixtures (for testing etc).

 I have not managed to keep entire VIEW model classes out of the DB by
 specifying ithe EXPORT_NONE property in this way.

 On Oct 8, 11:49 pm, david da...@inspiredthinking.co.uk wrote:

  I'll see about extracting the code in the next few days and drop a mail  
  when it's done.

  On Thu, 08 Oct 2009 22:09:45 +0200, ridcully ohnhei...@googlemail.com  
  wrote:

   Is the view behavior writen by our own? Or can I found this behavior
   somewhere?

   Thanx you alot,
   Jörg

   On Oct 8, 5:37 pm, david da...@inspiredthinking.co.uk wrote:
   Reverse engineering from an existing DB is just a quick way of  
   bootstrapping the start of a project.

   Doctrine doesn't handle views very well - although it is aware of them.

   Working around this problem when creating some new Doctrine drivers for  
    CouchDB  RDF I've used view behaviours and then annotate the schema  
   to  get a clean implementation.
   The behaviour handles the view creation and the model gets generated  
   accordingly referencing/overloading the referenced base table and  
   importing the appropriate keys.

   The yml looks like:

   locationsInEurope:
      tableName: locationsInEurope
      actAs:
        hasViews:
          references: Locations
      columns:
        country_id:
          type: integer(4)
        region_id:
          type: integer(4)
        city_id:
          type: integer(4)
        district_id:
          type: integer(4)

   Regarding data dumps - the doctrine:data-dump task is a better way of  
   handling extracting and reloading the db.

   On Thu, 08 Oct 2009 11:58:51 +0200, ridcully ohnhei...@googlemail.com  
    wrote:

Hi John,

the Problem is when you doing the views this way is, you don't have a
clean
deployment anymore  then we can't use symfony build-all-reload-test
for the dev. Team.
I must use SQL-Dumps and I think this is not the right way, because
you
can't change the Model quick and easy.

There must be a better way to do this, because we need a the mostly
clean Deployment without SQL-Dumps.

Many thanks for your answer,
Jörg

On Oct 8, 11:47 am, John Masson jmas...@gmail.com wrote:
Hi,

We were discussing this at work yesterday. One of the guys came up
with the same solution and it sounds quite reasonable.

Out of interest we reverse engineered a schema.yml from a DB that had
a view in it just to see what would happen. Symfony includes the view
in the schema.yml file just like it was a regular table, but there  
   was
nothing to identify it as a view rather than a table that I could  
   see,
so presumably if we forward engineered the database from this
schema.yml it would have created a table not a view (should have done
that just to confirm I guess)

My recommendation would be to create your DB as you want it, then
reverse engineer your schema.yml with a ./symfony doctrine:build-
schema then build-model, forms, filters etc... Just saves you  
   dropping
the tables and recreating the views which you'd have to do if you  
   work
in the opposite direction (although it's not such a big deal I  
   guess).

John

On Oct 7, 7:48 pm, ridcully ohnhei...@googlemail.com wrote:

 Hi,

 how can I use Database Views in Symfony with Doctrine? I need them
 because of performance reasons.

 My Idee was to create dummys in the model and after building the  
   Model
 to drop the dummy tabels and create SQL Views.

 Is there a better way to do this?

   --
   Using Opera's revolutionary e-mail client:http://www.opera.com/mail/

  --
  Using Opera's revolutionary e-mail client:http://www.opera.com/mail/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users

[symfony-users] Re: From Propel to Doctrine... for every projects ?

2009-10-03 Thread E_lexy

Hi Adrien,

We are in the process of changing a large project to Doctrine, because
we found the DQL language better suited for our complex queries.
Having done Propel for 1,5 year, Doctrine is easy to learn and much
closer to (old skool) SQL.

Also Doctrine is a bit more flexibel. There is usually more than one
way to get/do something.

I am wrintin a howto on changing from Propel to Doctrine:
http://trac.symfony-project.org/wiki/ConvertingPropelProjectToDoctrine

Like Gabor said, Propel has a new Lead (former core Symfony-er
Francois Zaninotto)
See here: 
http://groups.google.com/group/symfony-devs/browse_thread/thread/836663e940672632/6dc164afe1f42bbb?lnk=raot
So it will surely stay alive.

The choice is yours!

On Oct 2, 9:15 am, Adrien Mogenet adrien.moge...@gmail.com wrote:
 Hi everyone,

 I developping a simple association manager, which can manage
 members, fees, expenses, activities, accounts...
 I'm using symfony 1.2 (trunk) and Propel 1.3 (trunk also).

 I know that symfony will evolve with Doctrine and not with Propel
 anymore.

 So I'm wondering if it would be interesting to change my current ORM,
 even if it's a small project.
 Will it take a long time to perform this change ?

 Will it be interesting in the near future to change from Propel to
 Doctrine ?

 If you have any experience to share, feel free :-)

 --
 Adrien Mogenet
 Looking for a 6 month internship, opensource/innovative 
 projectshttp://adrien.frenchcomp.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfGrid and Custom query

2009-10-01 Thread E_lexy

@ floria: you're right, but there problem is no less ;-)

I have tried doctrine, but the problem remains the same.

When you have a non-hydratable field in your query, you cannot use
sfDatasourcePropel/Doctrine, because the results gets hydrated toward
a model.

So I tried the sfDatasourceArray but there I get a problem when there
is no data (array is empty).

Seemed like a basic use for the grid but apparently not.

Will keep digging.

-Alex

On 8 sep, 10:33, Florian sideral.undergro...@gmail.com wrote:
 Hi,
 just my 2 cents, but the message says :

  [code]
  Class Idea has no method called getideaRelationId.
  [/code]
  Symfony complains a bout not being able to find a setter. -
  understandable.

  I believe i need make a setter, but where? in Idea?

 So you surely are talking about a Getter , no ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@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
-~--~~~~--~~--~--~---



[symfony-users] Re: sfGrid and Custom query

2009-10-01 Thread E_lexy

Hi all,

@Gareth, The class doesn't have this method because the column is the
result of an aggregate function in the Doctrine_query

I have found a solution for the doctrine way, I guess it will be more
or less the same for Propel.
Don't know if it is the nicest way, feel free to comment

The reason sfGrid cannot find the column is because it is looking in
the model, not in the query feeding the datasource.
I have not tested with other kind of datasources, but this seems to
work for Doctrine_query:

  /**
   * @see sfDataSourceInterface::requireColumn()
   */
  public function requireColumn($column)
  {
if (!$this-getTable()-hasColumn($column))
{
  //var_dump($this-query-getAggregateAlias($column));
  if(!$this-query-getAggregateAlias($column)) {
throw new LogicException(sprintf('The column %s has not been
found in the datasource columns or the model %s', $column, $this-
getTable()));
  }
}
  }

It checks whether the column you wanted is spcified as an aggregate
alias in the query.

On 1 okt, 14:30, Gareth McCumskey gmccums...@gmail.com wrote:
 Class Idea has no method called getideaRelationId

 Should your getter not be getIdeaRelationId ... note the case of that i
 after the get. Perhaps in your code you are calling the method with bad case



 On Mon, Sep 7, 2009 at 11:34 AM, E_lexy alexk...@gmail.com wrote:

  I am trying to use sfGrid based on a custom query-datasource.
  This custom query contains a result of a calculated field.
  Symfony complains a bout not being able to find a setter. -
  understandable.

  I believe i need make a setter, but where? in Idea?

  Datasource:
  [code]
  object(sfDataSourcePropel)[81]
   protected 'data' = null
   protected 'connection' = null
   protected 'baseClass' = string 'Idea' (length=4)
   protected 'objectPaths' =
     array
       0 = string 'Idea' (length=4)
   protected 'selectCriteria' =
     object(Criteria)[82]
       private 'ignoreCase' = boolean false
       private 'singleRecord' = boolean false
       private 'selectModifiers' =
         array
           empty
       private 'selectColumns' =
         array
           empty
       private 'orderByColumns' =
         array
           empty
       private 'groupByColumns' =
         array
           empty
       private 'having' = null
       private 'asColumns' =
         array
           'ideaRelationId' = string '(select IdeaRelationID
       from IdeaRelations
       where State = E
         and ((SourceID = IdeasListView.IdeaID
               and TargetID = )
         or (SourceID =
               and TargetID = IdeasListView.IdeaID)))' (length=226)
       private 'joins' =
         array
           empty
       private 'dbName' = string 'propel' (length=6)
       private 'primaryTableName' = null
       private 'originalDbName' = null
       private 'limit' = int 10
       private 'offset' = int 0
       private 'blobFlag' = null
       private 'aliases' =
         array
           empty
       private 'useTransaction' = boolean false
       private 'map' =
         array
           'idea.ID' =
             object(Criterion)[77]
               private 'value' = string 'select id from idea_list_view
  where id != ' (length=42)
               private 'comparison' = string 'CUSTOM' (length=6)
               private 'table' = string 'idea' (length=4)
               private 'realtable' = null
               private 'column' = string 'ID' (length=2)
               private 'ignoreStringCase' = boolean false
               private 'db' =
                 object(DBMySQL)[70]
               private 'clauses' =
                 array
                   empty
               private 'conjunctions' =
                 array
                   empty
               private 'parent' = null
           'Idea.CUSTOMER_ID' =
             object(Criterion)[79]
               private 'value' = int 1
               private 'comparison' = string '=' (length=1)
               private 'table' = string 'Idea' (length=4)
               private 'realtable' = null
               private 'column' = string 'CUSTOMER_ID' (length=11)
               private 'ignoreStringCase' = boolean false
               private 'db' =
                 object(DBMySQL)[70]
               private 'clauses' =
                 array
                   empty
               private 'conjunctions' =
                 array
                   empty
               private 'parent' = null
           'Idea.is_cluster' =
             object(Criterion)[83]
               private 'value' = string 'Y' (length=1)
               private 'comparison' = string '=' (length=1)
               private 'table' = string 'Idea' (length=4)
               private 'realtable' = null
               private 'column' = string 'is_cluster' (length=10)
               private 'ignoreStringCase' = boolean false
               private 'db' =
                 object(DBMySQL)[70]
               private 'clauses' =
                 array

[symfony-users] sfGrid and Custom query

2009-09-07 Thread E_lexy

I am trying to use sfGrid based on a custom query-datasource.
This custom query contains a result of a calculated field.
Symfony complains a bout not being able to find a setter. -
understandable.

I believe i need make a setter, but where? in Idea?

Datasource:
[code]
object(sfDataSourcePropel)[81]
  protected 'data' = null
  protected 'connection' = null
  protected 'baseClass' = string 'Idea' (length=4)
  protected 'objectPaths' =
array
  0 = string 'Idea' (length=4)
  protected 'selectCriteria' =
object(Criteria)[82]
  private 'ignoreCase' = boolean false
  private 'singleRecord' = boolean false
  private 'selectModifiers' =
array
  empty
  private 'selectColumns' =
array
  empty
  private 'orderByColumns' =
array
  empty
  private 'groupByColumns' =
array
  empty
  private 'having' = null
  private 'asColumns' =
array
  'ideaRelationId' = string '(select IdeaRelationID
  from IdeaRelations
  where State = E
and ((SourceID = IdeasListView.IdeaID
  and TargetID = )
or (SourceID =
  and TargetID = IdeasListView.IdeaID)))' (length=226)
  private 'joins' =
array
  empty
  private 'dbName' = string 'propel' (length=6)
  private 'primaryTableName' = null
  private 'originalDbName' = null
  private 'limit' = int 10
  private 'offset' = int 0
  private 'blobFlag' = null
  private 'aliases' =
array
  empty
  private 'useTransaction' = boolean false
  private 'map' =
array
  'idea.ID' =
object(Criterion)[77]
  private 'value' = string 'select id from idea_list_view
where id != ' (length=42)
  private 'comparison' = string 'CUSTOM' (length=6)
  private 'table' = string 'idea' (length=4)
  private 'realtable' = null
  private 'column' = string 'ID' (length=2)
  private 'ignoreStringCase' = boolean false
  private 'db' =
object(DBMySQL)[70]
  private 'clauses' =
array
  empty
  private 'conjunctions' =
array
  empty
  private 'parent' = null
  'Idea.CUSTOMER_ID' =
object(Criterion)[79]
  private 'value' = int 1
  private 'comparison' = string '=' (length=1)
  private 'table' = string 'Idea' (length=4)
  private 'realtable' = null
  private 'column' = string 'CUSTOMER_ID' (length=11)
  private 'ignoreStringCase' = boolean false
  private 'db' =
object(DBMySQL)[70]
  private 'clauses' =
array
  empty
  private 'conjunctions' =
array
  empty
  private 'parent' = null
  'Idea.is_cluster' =
object(Criterion)[83]
  private 'value' = string 'Y' (length=1)
  private 'comparison' = string '=' (length=1)
  private 'table' = string 'Idea' (length=4)
  private 'realtable' = null
  private 'column' = string 'is_cluster' (length=10)
  private 'ignoreStringCase' = boolean false
  private 'db' =
object(DBMySQL)[70]
  private 'clauses' =
array
  empty
  private 'conjunctions' =
array
  empty
  private 'parent' = null
  protected 'countCriteria' = null
  private 'cursor' = int 0
  private 'offset' = int 0
  private 'limit' = int 0
[/code]

and the message:
[code]
Class Idea has no method called getideaRelationId.
[/code]

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



[symfony-users] Re: Foreign-key to self in schema?

2009-06-16 Thread E_lexy

Indeed Symfony permits i, but I have had trouble getting fixtures to
load on tables with foreign keys to itself.
It comes down to a chicken and egg situation.

For instance:
user:
  id: ~
  created_by_user_id: { type: integer, required: true, foreignTable:
user, foreignReference: id }

will work but when you want to dump the test data and then load it
again, it will fail because the referenced user does not exist.

On Jun 15, 7:38 pm, Dheeraj Kumar Aggarwal dheerajcom...@gmail.com
wrote:
 hi

 yes you can self referencing tables in schema.



 On Mon, Jun 15, 2009 at 10:36 PM, Eno symb...@gmail.com wrote:

  Is it not possible to have a field reference another field as a
  foreign key? i.e.

   category:
     id:                ~
     parent_id:         { type: integer, foreignTable: category,
  foreignReference: id, required: true }
     title:             { type: varchar(255), required: true, default:
  null }
     websafe_title:     { type: varchar(255), required: true, default:
  null }

  --

 --
 Regards,
 Dheeraj

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