Re: [symfony-users] Using UUIDs for primary keys vs AutoIncrementing/Sequence based primary keys

2011-01-03 Thread Svetoslav Shterev
On Sun, 2011-01-02 at 21:12 -0800, Dennis Gearon wrote:
> Is it very easy to specify a char column for a primary key in a symfony 
> table/object?
> 
> Actually, it's probably easy to do, BUT will Symfony choke on acually USING 
> it?
> 
By symfony, I assume you mean doctrine(symfony is not an orm :p). I
don't think doctrine will have a problem with a primary key which is a
char. Your main problems would be when making new objects(as opposed to
autoincrement, you would always need to set the primary key explicitly).
There's no problem I can see otherwise.


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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


Re: [symfony-users] Best practice to allow for Action reuse?

2011-01-03 Thread Svetoslav Shterev
On Sun, 2011-01-02 at 23:47 -0500, Eric B wrote:

> 
> Thanks for the tip.  That's kind of what I was looking for.  Ideally,
> the great thing about Struts2 is that you can also put the action to
> take based on the result in a config file, which completely separates
> the workflow from the action.  In symfony, the way I see it, the
> action needs to know something about the workflow (ie: if came from
> route A, redirect, if route B, display template, if route C, chain
> another action, etc...).  Which ties the action to the workflow.  What
> I would have loved to see is a config file similar to the routing yml
> which would inspect the result from the action, and determine what the
> next step would be.  If we managed to contain everything in one file,
> it would be awesome.

This is what filters do. Filters are executed before and after an
action(That is, filters execute, the middle filter - execution, runs the
action, renders the view, and so on). You can put a filter just after
execution(or modify execution, depending on what you need), which does
the redirect based on the action's results.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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


Re: [symfony-users] Best practice to allow for Action reuse?

2011-01-02 Thread Svetoslav Shterev
On Sat, 2011-01-01 at 23:36 -0800, benze wrote:
> Hi,
> 
> I'm trying to figure out the best way to reuse an action, and am
> having difficulty figuring that out.  Specifically because my action
> seems to be tied to the response.
> 
> For instance, I have a delete action that I want to call from within
> several different web pages, however, depending on which page is
> calling the delete action, I want to redirect the user to a different
> page once complete.  I'm not quite sure if/how to do that.
> 

You have three possibilities of obtaining the data needed to decide
where to redirect. One is the URL(different routes into the action), the
second is the get/post data(redirect_to token), and the third is the
session/db. Here's an example of n1 working:

// In the action

$route_name = $this->getContext()->getRouting()->getCurrentRouteName();
switch($route_name) {
  case 'route_1':
$this->redirect('to_1');
...
}


I don't know what you meant by the java stuff. Workflow is controlled by
the filters and action already. You could have a redirection filter
working after the execution filter that sets what to redirect to.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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


Re: [symfony-users] Doctrine left join without relation

2010-10-01 Thread Svetoslav Shterev
On Fri, 2010-10-01 at 07:12 -0700, Vikos wrote:
> Hello
> 
> The question: Can I do join without relation [with doctrine]?

This question is probably better suited for the doctrine user group. You
cannot make a join without a relation in doctrine.
> My project schema is huge. Every record has 'created_by' filed... but
> no foreign key. ( 60+ FK to one table can cause lot problems).
> 
> A want to get a table joined with the creators. But doctrine don't
> want to do it because it doesn't know any relation

You can disable exporting certain parts of the model when building sql
for it. I don't remember the exact syntax for that though, but you might
be able to make the build-sql task not create foreign keys for your
table.
> Is it possible to do a simple JOIN QUERY with DQL?
> Or on the other side ...How can'I do it without manual hydration?

You can use the RawSql class instead, I suppose.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

2010-10-01 Thread Svetoslav Shterev
On Sep 28, 2:26 pm, corneliusparkin 
wrote:
> When selecting one option in the destination select box and submitting
> the form to the action, it seems fine, but as soon as I select more
> that one, I receive the error: "SQLSTATE[HY093]: Invalid parameter
> number: number of bound variables does not match number of tokens".
>
> It seems to be happening on the bind...
> //Bind form fields to form
>                         $this->form->bind ( $request->getParameter ( 
> $this->form->getName() ) );
>

It's very unlikely that you would get an SQL error from a form bind.
Try running your application through the dev environment, and looking
at the symfony provided stack trace.

The problem should be in one of your queries, specifically the
parameters you pass to it.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: How to display/get the info-related to the main form on the embedded form?

2010-09-13 Thread Svetoslav Shterev


On Sep 10, 10:51 pm, Alejandro Gómez
 wrote:
> I don't know why but embedRelation('AlumnoInterno') did not work.
> Maybe the Propel version?
>
> Symfony throws me "Call to undefined method
> AlumnoForm::embedRelation."
  Are you using Propel?
> In the other hand, I used getAlumnoInternos() wich "Gets an array of
> AlumnoInterno objects which contain a foreign key that references this
> object.". Since every Alumno object has only one AlumnoInterno object
> I take the first element of getAlumnoInternos().

  In Doctrine, you can set a relation to be one-to-one, thus
getAlumnoInterno() would give you one object, not an array. I don't
know if there's an equivalent in Propel. If there is one, that would
clean up the code a bit.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: sfWidgetFormChoice and setDefault

2010-09-13 Thread Svetoslav Shterev
Glancing through the code, the default option(what setDefault() does
on a widget) doesn't seem to be used at all in the choice widgets.

At any rate, you should be using the form's "default" fields, instead
of the widget's.

$this->setDefault('priority', max(...));

The widget's default value(if used at all) should only be used if the
call to render() does not provide a value itself.

On Sep 10, 4:54 pm, torok84  wrote:
> I have this code in a doctrine form
>
>     $this->widgetSchema['priority'] = new sfWidgetFormChoice(
>         array(
>             'choices' => $pri_choices
>             ));
>     var_dump($pri_choices);
>     echo max(array_keys($pri_choices));
>     $this->widgetSchema['priority']-
>
> >setDefault( max(array_keys($pri_choices)) );
>
> the output is
> array
>   100 => string 'Problematica' (length=12)
>   200 => string 'Informazione' (length=12)
> 200
>
> I would expect to get the Informazione entry selected, while the HTML
> output is
>
> 
> Problematica
> Informazione
> 
>
> It seems a bug, or am I missing something?
>
> Thanks
> Paolo

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: How to validate values from $GLOBALS["HTTP_RAW_POST_DATA"]

2010-08-05 Thread Svetoslav Shterev
A better way would be to read from php://input(not using $GLOBALS).

I don't see a reason why you can't do it - but they really should
learn how to post multiform, instead of just dumping raw

On Aug 4, 2:47 pm, Grzegorz Śliwiński  wrote:
> Thanks Gareth,
> I'll have to play it.
> I wanted to validate sent image and save it because we have already
> defined how to save files in form.
>
> On 3 Sie, 15:43, Gareth McCumskey  wrote:
>
> > Simple answer .. don't. You should be able to accept requests through
> > symfony's post handlers that can also transmit files just as if someone had
> > uploaded a file through a form.
>
> > 2010/8/3 Grzegorz Śliwiński 
>
> > --
> > Gareth McCumskeyhttp://garethmccumskey.blogspot.com
> > twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Symfony 1.4: Get current route name

2010-07-28 Thread Svetoslav Shterev
getCurrentRouteName() would be the more appropriate method :)

On Jul 27, 1:31 pm, Gábor Fási  wrote:
> sfPatternRouting has a function called getCurrentInternalUri [1], you
> should use that.
> Also, there is no reason to use sfContext::getInstance() in this case,
> you should use $this->getContext()->getRouting().
>
> [1]http://trac.symfony-project.org/browser/branches/1.4/lib/routing/sfPa...
>
> On Tue, Jul 27, 2010 at 08:53, sebastian  wrote:
> > You can access routes via sfContext::getInstance()->getRouting()-
> >>getRoutes() and then go from there
>
> > On 27 Jul., 07:15, Johannes Trommer 
> > wrote:
> >> Hello,
>
> >> How can I get the current route name in the module's action?
>
> >> This is my route:
>
> >> powerplantsTypes:
> >>    url: /type/:slug.html
> >>    param: { module: powerplants, action: list }
>
> >> In the action i want the retrieve the route name 'powerplantsTypes'.
>
> >> Thanks in advance!
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to 
> > security at symfony-project.com
>
> > 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

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Symfony 2 - anything like grails?

2010-07-05 Thread Svetoslav Shterev
Symfony doesn't operate with a DBMS directly. Perhaps you mean
Doctrine? You can do that("specify certain settings for the database
columns individually") easily there, too.

On Jul 2, 7:00 am, "Bill P."  wrote:
> Hello,
>
> I have been using grails for a recent project as well as learning the 
> original symfony structure.
>
> Is Symfony 2 going to be a bit more like grails in the structure? I enjoy the 
> flexibility that symfony offers in the way I can specify certain settings for 
> the database columns individually, but grails seems to offer a much easier 
> setup in the way classes are constructed.
>
> Is there any sort of User manual or intro tutorial for Symfony 2 yet?
>
> Thanks.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Use database in app.yml

2010-07-05 Thread Svetoslav Shterev
Why not modify app.yml from your code, instead of using a database?

On Jul 4, 10:08 pm, HAUSa 
wrote:
> I want to use this because I have some system setting which should
> really belong in that app.yml file. But the admins which I am
> developing it for want to change those settings in an admin panel.
> Think for example the lifetime of a post, how many credits for a quick
> respons / answer, etc. All settings I want to access by using
> sfConfig::get()
>
> The use op PHP in app.yml is possible I've seen, the only thing
> missing is the database connection. "No connection information in your
> runtime configuration file for datasource [propel]" How can I get that
> connection there?
>
> On 2 jul, 12:29, Daniel Lohse  wrote:
>
> > I'd probably go with a plugin that handles dynamic and configurable 
> > settings that live in a database, like csSettingsPlugin. :)
>
> > Cheers, Daniel
>
> > On 02.07.2010, at 11:41, Tom Ptacnik wrote:
>
> > > I'm not sure it's possible to do it this way.
>
> > > Why do you want to insert some configuration into the app.yml from
> > > database? For what do you need this configuration setting?
>
> > > On 1 čnc, 14:51, HAUSa 
> > > wrote:
> > >> I want to use some configuration settings from the database in my
> > >> app.yml configuration file.
> > >> This is my code now:
>
> > >> all:
> > >> 
> > >>   getSlug() . ': ' . $oSetting->getValue() ?>
> > >> 
>
> > >> But the error I receive says "No connection information in your
> > >> runtime configuration file for datasource [propel]"
>
> > >> What should I do to make this happen?
> > >> Thanks!
>
> > > --
> > > If you want to report a vulnerability issue on symfony, please send it to 
> > > security at symfony-project.com
>
> > > 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

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Doctrine Query Left Join

2010-06-25 Thread Svetoslav Shterev
This is simply not how doctrine relations work. Read the doctrine
documentation on how to define models and relations, then try again.

On Jun 25, 7:22 pm, Tom Ptacnik  wrote:
> What about
>
> $this->nodes = Doctrine::getTable('ElementNode')
> ->createQuery('n1')
> ->select('n1.*, n2.*')
> ->leftJoin('ElementNode n2 ON n1.id = n2.nodeSubnodeOf')
> ->execute();
>
> On 25 čvn, 14:35, Jérémie  wrote:
>
> > Hi,
>
> > I have this mysql query :
>
> > SELECT n1.*, n2.* FROM ElementNode n1 LEFT JOIN ElementNode n2 ON n1.id
> > = n2.nodeSubnodeOf
>
> > I translated it this way:
> > $this->nodes = Doctrine::getTable('ElementNode')
> > ->createQuery()
> > ->select('*, n2.*')
> > ->leftJoin('ElementNode n2 ON id = n2.nodeSubnodeOf')
> > ->execute();
>
> > But it seems like symfony/doctrine transates it :"[...] ON n2.id =
> > n1.nodeSubnodeOf".
>
> > I'm pretty lost, could someone give me some help please?
>
> > Thanks a lot!
> > Jérémie

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Route does not add a parameter when its defined as a default one.

2010-06-24 Thread Svetoslav Shterev
Hello.

One -> all route tokens should be unique, you are right on that.

Second, the route order matters. The first route that matches will be
used. I am guessing /blog/:page is your first route, which is why it
matches every case.

As for default parameters not appearing - I'm not sure. Can you show
the exact routing.yml and function call that does this?

On Jun 22, 9:59 pm, "Ivo Az."  wrote:
> Here's examples:
>
>  Link 
> 
>
>  Route 1
> blog:
>   url:             /blog/*
>   param:       { module: blog, action: list }
>
> Output:http://localhost/blog/page/2
>
>  Route 2
> blog:
>   url:             /blog/:page
>   param:       { module: blog, action: list, page: 1 }
>
> Output:http://localhost/blog/2
>
>  Route 3
> blog:
>   url:             /blog/*
>   param:       { module: blog, action: list, page: 1 }
>
> Output:http://localhost/blog
>
> Why in 3rd case the url does not contain the page parameter as in
> first example?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Day 1 - jobeet problem

2010-06-24 Thread Svetoslav Shterev
You have most likely not edited the path to the project configuration
in your front controllers(index/frontend_dev.php)

On Jun 22, 7:30 pm, Christian  wrote:
> Hi!
>
> my name is christian and i'm new with symfony framework.
>
> I found this step by step 
> tutorial:http://www.symfony-project.org/jobeet/1_2/Propel/it/01
>
> i have troubles during the apache configuration...
>
> this is my httpd.conf
>
> _
> # Be sure to only have this line once in your
> #configuration
> NameVirtualHost 127.0.0.1:8080
>
> # This is the configuration for your project
> Listen 127.0.0.1:8080
>
> 
>   DocumentRoot "/home/chris/public_html/jobeet/web"
>   DirectoryIndex index.php
>   
>     AllowOverride All
>     Allow from All
>   
>
>   Alias /sf /home/chris/public_html/jobeet/web/lib/vendor/symfony/data/
> web/sf
>    data/web/sf">
>     AllowOverride All
>     Allow from All
>   
> 
> ___
>
> where public_html is my apcahe DocumentRoot in whitch i have a lot of
> directory with different site, but when i put this link in my 
> browser:http://localhost:8080/index.php(as the tutorial say) i can't see
> anything...only a blank page...
>
> can you help me please?
>
> thanks
> Chris

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: How to pass PHP values to addJavascript() (or something else) ?

2010-06-24 Thread Svetoslav Shterev
That would be one way.

On Jun 24, 9:05 am, Tom Ptacnik  wrote:
> So if I need to get some variables in javascript from the app, you
> advice is to generate it into the DOM?
>
> Example: I need to detect which culture is set. Then i should generate
> en into the DOM and then
> in the javascript read the value of the div by id?
>
> On 23 čvn, 14:57, Massimiliano Arione  wrote:
>
> > On 22 Giu, 10:03, François  wrote:
>
> > > I'd like to pass values to my JS script when I call it. So I look the
> > > API for the addJavascript() method, herre is it :
>
> > You shouldn't pass variables from php to javascript.
> > Javascript should be always unobtrusive, so the only point of contact
> > between your html (and php) and your javascript should be the DOM.
> > Just insert your php variables somewhere in your page (e.g. in a
> > hidden field of a form), then retrieve them with javascript (with
> > jQuery, it's really simple)
>
> > cheers
> > Massimiliano

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: unwanted id column from doctrine:build-sql / build-sql ignores schema.yml

2010-06-19 Thread Svetoslav Shterev
build-sql does not touch the schema at all. It generates sql from the
*models*. You need to generate new models from the schema(build-model)
first, and then regenerate sql.

On Jun 19, 2:33 pm, Ryan Walker  wrote:
> I hope this isn't a double post. I tried to post this yesterday and it did 
> not seem to go through to the list.
>
> I am new to symfony and doctrine. My co-workers designed a database 
> structure, and subsequently modified it directly. I am attempting to bring 
> our symfony/doctrine model back into sync with it.
>
> One of the tables in the schema is giving me trouble. Doctrine was adding an 
> `id` column to it when I performed a doctrine:build-schema. I realized that 
> the primary key of the table was not marked as such. So I fixed that, and now 
> doctrine:build-schema kicks out a reasonable schema.yml file.
>
> However, when I run doctrine:build-sql, it adds in an `id` column again and 
> changes the primary key from `statusid` to `id,statusid`.
>
> Here's what I have in schema.yml for this particular table:
>
> UsersStatus:
> connection: doctrine
> tableName: users_status
> columns:
>   statusid:
>     type: integer(11)
>     fixed: false
>     unsigned: false
>     primary: true
>     autoincrement: true
>   status:
>     type: string(20)
>     fixed: false
>     unsigned: false
>     primary: false
>     default: ''
>     notnull: true
>     autoincrement: false
> relations:
>   Users:
>     local: statusid
>     foreign: statusid
>     type: many
>
> What I expect doctrine to produce for SQL is:
> CREATE TABLE users_status (statusid BIGINT AUTO_INCREMENT, status VARCHAR(20) 
> DEFAULT '' NOT NULL, PRIMARY KEY(statusid)) ENGINE = INNODB;
>
> but instead, I get this:
> CREATE TABLE users_status (id BIGINT AUTO_INCREMENT, statusid BIGINT 
> AUTO_INCREMENT, status VARCHAR(20) DEFAULT '' NOT NULL, PRIMARY KEY(id, 
> statusid)) ENGINE = INNODB;
>
> Now here's where things get completely bizarre. Hopefully this will be the 
> key to someone.
>
> I can remove my schema.yml and schema.sql files and clear cache, then rerun 
> doctrine:build-sql and it will still generate the same SQL file! If I'm 
> reading the documentation correctly, it should fail when schema.yml is 
> missing. So, if it's not using config/doctrine/schema.yml, then where is it 
> getting the schema definition?
>
> Any help would be appreciated.
>
> Ryan

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: can someone take a look--sfWidgetFormDoctrineChoice problem

2010-06-17 Thread Svetoslav Shterev
You'll need to pass 'key_method' if you want to change which key it
should be saving(Although, doctrine is set up to take the primary key,
which is what you should be using it for, really)

The display depends on either the 'method' option(which method to use
for display), by default __toString().

so, you would either set __toString() to show the "Category"
column(getCategory()) -> which has more implications than this
widget(other parts use __toString() as well)
or, pass 'method' => 'getCategory'

example:

'boxhere'=> new sfWidgetFormDoctrineChoice(array('model' =>
'category','query' => @Category::retrieveCategory(),'add_empty' =>
false,'method' => 'getCategory', 'key_method' => 'getCategoryId'))

On Jun 16, 6:41 pm, Andro Fumero  wrote:
> hello there,
>
> I'm a newbie here and need help, I'm stack with this problem.
>
> table: Category
> columns: id,categoryid,category,description,active
>
> when I created a form:
>
>     $this->setWidgets(array(
>       'boxhere'    => new sfWidgetFormDoctrineChoice(array('model' => 
> 'category','query' => @Category::retrieveCategory(),'add_empty' => false,))
> );
>
> I need to display "category" column and selected value of "categoryid"..
> but why is it displaying as description? and selected value is id?
> when my query is "select categoryid,category only"?
>
> Thanks.
> Andrew

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: methods wiped out by svn export - using externals

2010-06-17 Thread Svetoslav Shterev
Yup, symfony plugins are designed to be easily extensible - look up
the documentation with them(ie in jobeet) for examples how to extend
the plugin's architecture.

On Jun 17, 2:03 pm, Tofuwarrior  wrote:
> OK.
>
> I figured this was what was going on.
>
> I'll look into the copying across suggestion.
>
> thanks
>
> On Jun 17, 11:15 am, Daniel Lohse 
> wrote:
>
> > Modifications inside folders that are externals definitions are not 
> > committed alongside the project it is defined in! This will only work when 
> > you have commit rights to the project of the externals definition which is 
> > not the case with sfGuardPlugin. :)
>
> > Cheers, Daniel
>
> > Sent from my iPad
>
> > On Jun 17, 2010, at 12:11 PM, Ben Bieker  wrote:
>
> > > On Thu, 17 Jun 2010 03:03:28 -0700 (PDT), Tofuwarrior
> > >  wrote:
> > >> Hi Everyone,
>
> > >> I installed sfGuardPlugin using svn externals and have since added a
> > >> few methods to sfGuardUser.php.
> > >> Every time I export the svn repo to deploy, those additional methods
> > >> disappear.
>
> > > Hi,
>
> > > I think the problem is that you do an svn export. Export always checks out
> > > all files and writes them to your specified location. If u want to keep
> > > your local changes you should do a svn co (checkout). So it won't 
> > > overwrite
> > > your local changes but installes some .svn folders to keep track of your
> > > changes.
>
> > > Greetings
> > > Ben
>
> > > --
> > > If you want to report a vulnerability issue on symfony, please send it to 
> > > security at symfony-project.com
>
> > > 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

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Loading fixtures data error

2010-06-15 Thread Svetoslav Shterev
Have you tried not specifying item_id at all?

On Jun 14, 4:10 pm, dex  wrote:
> Hello, I bumped into an error today when I was trying to load some
> fixtures data.
> I kind of know what the problem is, but I don't know the solution, and
> google doesn't says anything useful.
>
> Here are the data that you will need:
>
> schema file:
> { ... }
> PageContent:
>   actAs:                { Timestampable: ~ }
>   columns:
>     parial: { type: boolean, notnull: true, default: false}
>     page_id: { type: integer, notnull: true }
>     item_id: { type: integer }
>     partial_id: { type: integer }
>   relations:
>     Page: { onDelete: CASCADE, local: page_id, foreign: id,
> foreignAlias: Page }
>     Item: { onDelete: CASCADE, local: item_id, foreign: id,
> foreignAlias: Item }
>     Partial: { onDelete: CASCADE, local: partial_id, foreign: id,
> foreignAlias: Partial }
> { ... }
>
> And the  fixture is:
>
> { ... }
> PageContent:
>   homepage_header:
>     partial: true
>     Page: homepage
>     item_id: null
>     Partial: header
> { ... }
>
> The error is:
> Couldn't call Doctrine_Core::set(), second argument should be an
> instance of Doctrine_Record or Doctrine_Null when setting one-to-one
> references.
>
> I've checked the rest of the fixture, and the problems appear only
> when I insert a PageContent item;
> Of course the problem is that Item or Partial has to be null (that's
> my condition) but There seems no way to set either of them to null.
> I've tried `Item` instead of `item_id` or `~` instead of `null` and
> their combinations, and none have worked.
>
> How can I set that item_id to null ?
> I can post the rest of the schema if that's relevant in anyway (even
> if I don't believe so).

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: Failed to save form with multiple checkboxes

2010-06-15 Thread Svetoslav Shterev
Show your form and the action that is saving the result, and when
you're getting the error(ie, when you call bind, or when you call
save)

A stack trace of the error would be best, really, but without any of
this information it's just guesswork what the cause could be.

On Jun 15, 12:10 pm, eantz  wrote:
> I have a form with multiple checkboxes. I use sfWidgetFormChoice to
> generate it.
> But, when I try to bind it before saving, the following error appear :
>
> "SQLSTATE[HY093]: Invalid parameter number: number of bound variables
> does not match number of tokens"
>
> I really don't know why it can happen.
>
> Someone please help me..

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: app.yml array is not array on first level

2010-06-14 Thread Svetoslav Shterev
http://www.symfony-project.org/book/1_2/05-Configuring-Symfony#chapter_05_sub_custom_application_settings_and_app_yml
It's documented there -> "When you should require an PHP array
directly beneath the all key you need to use a category header,
otherwise symfony will make the values separately available as shown
above."

On Jun 14, 6:26 pm, Tom Ptacnik  wrote:
> No, underscores are ok, even if I chage it to
>
> all:
>   test: [cs, en]
>
> it's the same
>
> sfConfig::add(array(
>   'app_test_0' => 'cs',
>   'app_test_1' => 'en',
>
> As pghoratiu  sad. It looks like an undocumented feature. Never mind I
> can live with that. One must just remember that :)
>
> On 14 čvn, 14:45, Eno  wrote:
>
> > On Mon, 14 Jun 2010, Tom Ptacnik wrote:
> > > Do someone know why first solution produce bad array and second will
> > > produce good array?
> > > I'm talking abou settings in app.yml
>
> > > 1)
> > > all:
> > >   frontend_cultures: [cs, en]
>
> > > will produce (cache/app/dev/app.yml.php):
>
> > > 'app_frontend_cultures_0' => 'cs',
> > > 'app_frontend_cultures_1' => 'en',
>
> > > 2)
> > > all:
> > >   frontend:
> > >     cultures: [cs, en]
>
> > >  'app_frontend_cultures' => array (
> > >   0 => 'cs',
> > >   1 => 'en',
> > > ),
>
> > Im guessing using an underscore in the array name is a problem since the
> > config handler uses underscores too.
>
> > You can use alternate syntax.
>
> >http://www.symfony-project.org/gentle-introduction/1_4/en/05-Configur...
>
> > --

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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: sfWidgetFormInputHidden is not visible

2010-06-11 Thread Svetoslav Shterev
Even better coding would be to not include the user_id as a hidden
input at all, since it can be manipulated by the user(of course,
unless you intend it to be changeable) - you can simply fetch the user
id in the action accepting the form.

On Jun 11, 4:10 pm, "Christopher Schnell"  wrote:
> Hi,
>
> apart from a solution to your question: This is bad coding. Try passing the
> user_id as an option to the form from the action like:
>
> $myForm=new xyzForm(null,array('user_id'=>$this->getUser()->getId()));
>
> And in the form:
> $this->setDefault('user_id',$this->getOption('user_id'));
>
> Please 
> read:http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-bas...
> ser-credentials/

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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