[symfony-users] relation betwwen a sfGuardUser and an other object in schema.yml

2010-05-04 Thread trankh
Every symfony developper has encountered this implemantation.

How to define a relation between a sfGuardUser and an other object?


I need a schema.yml example.

Imagine an object EventMember which defines a relation between
anobjet Event and an object sfGuardUser (which is a member in the
application)

# config/doctrine/schema.yml
Event:
  actAs: { Timestampable: ~ }
  columns:
id:  { type: integer, primary: true }
name: { type: string(255), notnull: true, unique: true }

EventMember:
  columns:
event_id:  { type: integer, primary: true }
member_id: { type: integer, primary: true }
motivation:  { type: string(300) }
  relations:
sfGuardUser:  {  onDelete: CASCADE,local: member_id, foreign: id,
foreignAlias: sfGuardUser  }
Event:{  onDelete: CASCADE,local: event_id, foreign: id,
foreignAlias: Event  }



This error is generated:

  SQLSTATE[HY000]: General error: 1005 Can't create table './zulu/
#sql-41ca_1c9.frm' (errno: 121). Failing Query: ALTER TABLE
sf_guard_group_permission ADD CONSTRAINT
sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN
KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE
CASCADE. Failing Query: ALTER TABLE sf_guard_group_permission ADD
CONSTRAINT
sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN
KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE
CASCADE


Thank you for your help

-- 
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] Jquery and AJAX symfony 1.4

2010-04-19 Thread trankh
Hello,

I want to call a simple action without passing any argument inside a
jquery function.
No argument because a random function is called inside the action.

The routing (in input and output) is this:
plantyourtree:
  url:   /tree/plantyourtree
  param: { module: tree, action: new }

the js file looks like this:

$(document).ready(function()
{

$('#change').click(function(){

?
});

});


The action associated with is:

 public function executeNew(sfWebRequest $request)
  {

   $this-zulu_tree_sample = Doctrine::getTable('ZuluTree')-
find(rand(1,Doctrine::getTable('ZuluTree')-count()));


$this-form = new ZuluTreeForm();

  if ($request-isXmlHttpRequest())
  {
  ?
  }


  }

In the template newSuccess.php, there is a form and a div where we
display information relative to zulu_tree_sample and which needs to be
refreshed each time we push the change button.

The template associated with is:

div id=left_column
?php echo $zulu_tree_sample-getName() ?
/div

input type=submit id=change value=Change



div id=right_column
?php include_partial('form', array('form' = $form)) ?
/div




I dont' know what to put instead of ??

Thank you

-- 
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: Jquery and AJAX symfony 1.4

2010-04-19 Thread trankh
I'm sorry but i prefer you write the code because i don't get it.
Why do you use json?
Thanks

On 19 avr, 20:40, Welington Veiga welington.ve...@gmail.com wrote:
 Well, it's very easy, use ajax like a single php file.

 View:
 Use a the helper ?php echo url_for('YOUR_MODULE/index'); ? to decide for
 what URL to send, inside your script tag, assign to a javascript variable

 Controller (action)
 $this-getResponse()-setHttpHeader('Content-type','text/json');
 return $this-renderText('SOMETHING VERY USEFULLY);

 All the other interactions will be equal,

 2010/4/19 trankh juliend1...@gmail.com





  Hello,

  I want to call a simple action without passing any argument inside a
  jquery function.
  No argument because a random function is called inside the action.

  The routing (in input and output) is this:
  plantyourtree:
   url:   /tree/plantyourtree
   param: { module: tree, action: new }

  the js file looks like this:

  $(document).ready(function()
  {

  $('#change').click(function(){

  ?
                         });

  });

  The action associated with is:

   public function executeNew(sfWebRequest $request)
   {

    $this-zulu_tree_sample = Doctrine::getTable('ZuluTree')-
  find(rand(1,Doctrine::getTable('ZuluTree')-count()));

     $this-form = new ZuluTreeForm();

           if ($request-isXmlHttpRequest())
           {
               ?
           }

   }

  In the template newSuccess.php, there is a form and a div where we
  display information relative to zulu_tree_sample and which needs to be
  refreshed each time we push the change button.

  The template associated with is:

  div id=left_column
  ?php echo $zulu_tree_sample-getName() ?
  /div

  input type=submit id=change value=Change

  div id=right_column
  ?php include_partial('form', array('form' = $form)) ?
  /div

  I dont' know what to put instead of ??

  Thank you

  --
  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.comsymfony-users%2bunsubscr...@goog 
  legroups.com
  For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en

 --
 Welington da Veiga Silva
 ---
 Há pessoas que transformam o sol numa simples mancha amarela, mas há
 aquelas que fazem de uma simples mancha amarela o próprio sol.
 ( Pablo Picasso )

 --
 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 
 athttp://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] symfony 1.4 Doctrine manytomany documentation

2010-04-10 Thread trankh
Do you have an up-to-date documlentation for symfony 1.4 and
Doctrine.
I want to do some unit tests with manytomany model but impossible to
find the right syntax.
I saw an interesting documentation here
http://www.symfony-project.org/doctrine/1_2/en/06-Working-With-Data
but it is not up to date and the examples don't work.
I can explain more about my problem:
I have an object user which belongs to many (object) groups and i
want
to do an unit test with that.
So, in my test i do that:
$user = new User();
$user-fromArray(array_merge(array(
 
'name'  = 'Julien',
 
'town' = 'Paris',
 
'postalcode'   = '1000',
  ),
$defaults));
$group= Doctrine::getTable('Group')-findOneById('2');
$user-setGroups($group);
$user-save();
It does not work because i have to pass a doctrine-collection into
setGroups method but how can i define that?


Please, help me.
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

To unsubscribe, reply using remove me as the subject.


[symfony-users] Re: Frontend // pager or filter display issue

2010-03-29 Thread trankh
How do you use generator for frontend filter.

Because i tried to do that in an other way but i have a bug.

http://groups.google.com/group/symfony-users/browse_thread/thread/6f6b5a482d4f44ad

Thank you

On 29 mar, 19:06, ziclo lauren...@gmail.com wrote:
 Any idea ?
 Thank you for your help !

 On 27 mar, 22:06, ziclo lauren...@gmail.com wrote:



  Hello,

  I use the admin generator actions and others methods for my frontend
  (i just copied actions and classes). My problem is that when i use the
  filter in order to get objects for a particular category, objects are
  displayed only if the result is  20.
  I modified the generator.yml file in order to have a list of 10
  objects max per page. Now i can see results  10 objects.

  Conclusion : The pager or filter (i don't know exactly) display the
  results according to the max_per_page parameter. But if result is 
  parameter no object is displayed.

  An idea ? Need more explanations ?

  Thank you

  Ziclo

-- 
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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


[symfony-users] Re: How to implement a basic filter on frontend with Doctrine sf1.4??

2010-03-27 Thread trankh
I can explain my problem from start:

There is a filter where i can choose a category  and a list of trees
is displayed depending of the category chosen.

Each tree belongs to  one or several categories.

This is my action which displays in a first time all trees.
In a seconde time, after filter validation, it is supposed to select
the right trees.


public function executeIndex(sfWebRequest $request)
{

$this-zulu_trees = Doctrine::getTable('ZuluTree')-
retrieveFutureTree();

$this-filter = new ZuluTreeFormFilter();

if($request-isMethod('post')) {

$this-filter-bind($request-getParameter($this-filtergetName()));

if ($this-filter-isValid()) {

$this-setFilters($this-filter-getValues());

// ($this-filter-getValues())  retourne l'id de la category

}


}
}

This is my partial _filter.php which is included in indexSuccess.php

Code :

?php use_stylesheets_for_form($filter) ?
?php use_javascripts_for_form($filter) ?

form action=?php echo url_for('tree/index'); ? method=post
 id=?php echo $filter-getName() ? 

table
tfoot
tr
td
input type=submit value=Filtrer /
/td
/tr
/tfoot
tbody
?php echo $filter ?
/tbody
/table
/form



indexSuccess.php :

I include the filter and tree list.

Code :


?php include_partial('filter', array('filter' = $filter))
?


table
  thead
tr
  thId/th
  thName/th
  thCategories/th
  thTown/th
  thPostalcode/th
  thDate/th
/tr
  /thead
  tbody
?php foreach ($zulu_trees as $zulu_tree): ?
tr
  tda href=?php echo url_for('tree/show?id='.$zulu_tree-
getId()) ??php echo $zulu_tree-getId() ?/a/td
  td?php echo $zulu_tree-getName() ?/td
 td
?php foreach ($zulu_tree-getZuluCategories() as $category)
 echo $category.  ;
 ?
  /td
  td?php echo $zulu_tree-getTown() ?/td
  td?php echo $zulu_tree-getPostalcode() ?/td
  td?php echo $zulu_tree-getDate() ?/td
/tr
?php endforeach; ?
  /tbody
/table




I don't know how i can get back trees list well filtered.
How can i match $zulu_trees  with trees list filtered?

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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


[symfony-users] Re: How to implement a basic filter on frontend with Doctrine sf1.4??

2010-03-26 Thread trankh
Yes...

On 26 mar, 00:03, Tom Haskins-Vaughan t...@templestreetmedia.com
wrote:
 +1

 I've always been interseted in doing this

 On 3/25/10, trankh juliend1...@gmail.com wrote:





  Hello,
  I am a beginner to symfony.

  I haven't found a correct explanation for How to implement a basic
  filter on frontend with Doctrine??

  I tried to tweek admin backend filters and copy to frontend but it is
  really dirty.

  Moreover, i don't want to display edit or delete button, I just want a
  list..

  Thank you!

  --
  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

  To unsubscribe from this group, send email to
  symfony-users+unsubscribegooglegroups.com or reply to this email with the
  words REMOVE ME as the subject.

 --
 Sent from my mobile device

-- 
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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


[symfony-users] Re: How to implement a basic filter on frontend with Doctrine sf1.4??

2010-03-26 Thread trankh
Thank you but i have some errors:

This is my code

 public function executeIndex(sfWebRequest $request)
  {
 // i load the list of my object which is here a list of trees

  $this-zulu_trees = Doctrine::getTable('ZuluTree')-
retrieveAllTree();

  $this-filter = new ZuluTreeFormFilter();

  if($request-isMethod('post')) {

  $this-filter-bind($request-getParameter($this-filter-
getName()));

  }
  $query =  $this-filter-buildQuery($this-filter-getValues());

  $this-myModels = $query-execute();

  }

This is my form:

form action=?php echo url_for('tree/index'); ? method=post
 id=?php echo $filter-getName() ? 
etcc
?php echo $filter ?
etc.
/form


When i validate my filter, i am redirected to the new form for my
object (i don't know why)
and i have this error:
csrf token: Required.
Name
Required.

I wonder how i can retrieve my list of trees with the filter
parameter ?


Thanks
On 26 mar, 09:40, romain godefroy romain.godef...@wanadoo.fr wrote:
 You need to add the form filter in your template :

   form action=?php echo url_for('myModule/index') ? method=post
 id=?php echo $formFilter-getName() ?
     ?php echo $formFilter ?
     input type=submit value=search/
   /form

 then modify your action:

 public function executeIndex(sfWebRequest $request)
   {
     $this-formFilter = new myModelFilter();
     if($request-isMethod('post')) {
       
 $this-formFilter-bind($request-getParameter($this-formFilter-getName()));

     }
     $query = $this-formFilter-buildQuery($this-formFilter-getValues());

     $this-myModels = $query-execute();
   }

 On 25 mar, 21:26, trankh juliend1...@gmail.com wrote:



  Hello,
  I am a beginner to symfony.

  I haven't found a correct explanation for How to implement a basic
  filter on frontend with Doctrine??

  I tried to tweek admin backend filters and copy to frontend but it is
  really dirty.

  Moreover, i don't want to display edit or delete button, I just want a
  list..

  Thank you!


  Hello,
  I am a beginner to symfony.

  I haven't found a correct explanation for How to implement a basic
  filter on frontend with Doctrine??

  I tried to tweek admin backend filters and copy to frontend but it is
  really dirty.

  Moreover, i don't want to display edit or delete button, I just want a
  list..

  Thank you!

-- 
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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


[symfony-users] How to implement a basic filter on frontend with Doctrine sf1.4??

2010-03-25 Thread trankh
Hello,
I am a beginner to symfony.

I haven't found a correct explanation for How to implement a basic
filter on frontend with Doctrine??

I tried to tweek admin backend filters and copy to frontend but it is
really dirty.

Moreover, i don't want to display edit or delete button, I just want a
list..


Thank you!

-- 
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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.