Re: [symfony-users] Re: many to many relationships at admin not working

2009-11-29 Thread Farrukh Abbas
this is the role module generator.yml
generator:
  class:  sfPropelAdminGenerator
  param:
model_class:  Role
theme:default

edit:
  fields:
role_permission: { type: admin_double_list, params:
through_class=RolePermissionRef }
  display: [name, role_permission]


and following is the schema
propel:
  _attributes:
noXsd: false
package: lib.model
  permission:
id:
module_name:  { type: VARCHAR, size: 50, required: true }
action_name:  { type: VARCHAR, size: 50, required: true }
  role:
id:
name: { type: VARCHAR, size: 100, required: true }
  role_permission_ref:
role_id:  { type: INTEGER, required: true, foreignTable: role,
foreignReference: id}
permission_id:{ type: INTEGER, required: true, foreignTable:
permission, foreignReference: id}
  user:
id:
name: { type: VARCHAR, size: 150, required: true }
email:{ type: VARCHAR, size: 150, required: true }
password: { type: VARCHAR, size: 150, required: true }
role_id:
created_at:

hope it helps

On Sun, Nov 29, 2009 at 6:41 PM, Greg Romanssen  wrote:

>  Hello,
>
> could you provide full generator.yml and schema.yml?
>
> Thanks,
>
> Greg
>
> dagger napsal(a):
>
> Ok it started working some how
>
> I made 2 changes
>
> 1) i renamed the table role_permission to role_permission_ref
> and
> 2) I changed the generator.yml file to
>  edit:
>   fields:
> role_permission: { type: admin_double_list, params:
> through_class=RolePermissionRef }
>   display: [name, role_permission]
>
> and its working now :)
>
> On Sep 16, 9:06 pm, Abraham Montilla  
>  wrote:
>
>
>  weird :s ... i'm using sf1.2 too
>
> 2009/9/16 Farrukh Abbas  
> 
>
>
>
>  tried that too ... does not work ... r u using sf 1.2 ?
> can u plz give it a try for experiment sake ... coz i picked the
> implementation of many to many relationship from a thread which was based on
> 1.0http://groups.google.com/group/symfony-users/msg/627be2a11e61990e
>
>  <http://groups.google.com/group/symfony-users/msg/627be2a11e61990e> 
> <http://groups.google.com/group/symfony-users/msg/627be2a11e61990e>
>
>  On Wed, Sep 16, 2009 at 8:14 PM, Abraham Montilla  
> wrote:
>
>
>   oh, try deleting the module and generate it again, i think that's the
> problem then...
>
>
>   2009/9/16 Farrukh Abbas  
> 
>
>   yes i did, build-model, form, sql, and insert-sql ... then cache:clear ...
>
>
>  but no difference ...
>
>
>On Wed, Sep 16, 2009 at 3:45 AM, Abraham Montilla  
> wrote:
>
>
> i think you actually did it, but... did you make the build-all-load
> command? and clear the cache only to see if helps.
>
>
> 2009/9/15 Farrukh Abbas  
> 
>
>  changed the schema to the following (propel), but still no luck ...
>
>
>permission:
> id:
> method_name:  { type: VARCHAR, size: 50, required: true }
> action_name:  { type: VARCHAR, size: 50, required: true }
>   role:
> id:
> name: { type: VARCHAR, size: 100, required: true }
>   role_permission:
> role_id:  { type: INTEGER, required: true, foreignTable:
> role, foreignReference: id}
> permission_id:{ type: INTEGER, required: true, foreignTable:
> permission, foreignReference: id}
>
>
>  On Tue, Sep 15, 2009 at 10:28 PM, Abraham Montilla 
>  wrote:
>
>
>   Hello dagger, in the schema you have to add foreign keys to the third
> table, in Doctrine would be something like
>
>
>   Permission:
>   columns:
> id:
>   type: integer(4)
>   primary: true
>   notnull: true
> method_name:
>   type: string(50)
>   notnull: true
> action_name:
>   type: string(50)
>   notnull: true
>   options:
> type: InnoDB
>
>
>   Role:
>   columns:
> id:
>   type: integer(4)
>   primary: true
>   notnull: true
> name:
>   type: string(100)
>   notnull: true
>   options:
> type: InnoDB
>
>
>   RolePermission:
>   tableName: Role_Permission
>   columns:
> Role_id:
>   type: integer(4)
>   primary: true
>   notnull: true
> Permission_id:
>   type: integer(4)
>   primary: true
>   notnull: true
>   relations:
> Role:
>   local: Role_id
>   foreign: id
>   foreignAlias: RolePermissions
> Permission:
>   local: Permission_id
>   foreign: id
>   foreignAlias: RolePermissions
>   options:
> type: InnoDB
>
>
>   In P

[symfony-users] Re: How to execute a stored procedure on a remote db server throught symfony?

2009-10-01 Thread Farrukh Abbas
yeah thanks for the heads up ... i don't have a choice, my application has
to interact with a third party service and the only way they provide is
through stored procedures ... so really don't have a choice ... any pointers
to where i can get some good read about propel custom queries? and also
connecting to another db ... coz i have to get the data from the other db
and put it in my db
thanks

On Thu, Oct 1, 2009 at 8:26 AM, Gareth McCumskey wrote:

> Stored procedures, while seemingly convenient, are actually not a good idea
> if you want to ensure your application remains properly database
> abstracted/agnostic. Stored procedures are in most cases not transferable
> between database type. For example, MySQL handles stored procedures very
> differently to MSSQL and there are differences as well to PostgreSQL.
>
> In my development I avoid stored procedures and only use them as a last
> resort and even then as little as possible and reluctantly. Usually you can
> replicate what a stored procedure does in code and so they are not actually
> necessary.
>
> If you do use Propel custom queries you will probably need to look at using
> the doSelectRS (Propel 1.2) or doSelectStmt(Propel 1.3 and up) to accomplish
> it, but bear in mind the implications if you need to switch databases.
>
> On Mon, Sep 28, 2009 at 2:42 AM, dagger wrote:
>
>>
>> Hi,
>>
>> in my current project I have to connect to a remote system and execute
>> some stored procedures then get the returned data and save it on to
>> the local database... Is there a way I can achieve this through
>> symfony or would I have to bank on plain php?
>>
>> Your time n help is highly appreciated... Thx
>>
>>
>
>
> --
> Gareth McCumskey
> http://garethmccumskey.blogspot.com
> twitter: @garethmcc
>
> >
>

--~--~-~--~~~---~--~~
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 create a download link to a file in uploads directory?

2009-09-28 Thread Farrukh Abbas
for instance i don't like using   ... something like link_to()
which would be coherent with the rest of the application/framework
and also that i could use sfConfig::get('sf_upload_dir_name') instead of
"/uploads/" string (btw - why is this config variable removed from defaults
in sf 1.2? sfConfig::get('sf_upload_dir_name') returns nothing)

or just generally good programming tips within the context of building links
...

On Mon, Sep 28, 2009 at 8:45 PM, Eno  wrote:

>
> On Mon, 28 Sep 2009, Farrukh Abbas wrote:
>
> > any suggestions to improve ?
>
> Define 'improve' ?
>
>
> --
>
>
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 create a download link to a file in uploads directory?

2009-09-28 Thread Farrukh Abbas
thanks people but this solves the purpose
download attachement

public_path returns a url like
http://localhost:8080/myproject/web/uploads/b3a2fe88caa89fa97a7443cdcf55e608.pdf

exactly what was needed...

any suggestions to improve ?

On Mon, Sep 28, 2009 at 1:19 PM, Johnny Lattouf wrote:

>
> You can use the function _compute_public_path($source, $dir, $ext,
> $absolute = false)
>
> $path = _compute_public_path('myfilename', 'myfolder','','absolute');
> echo link_to('download file', $path);
>
>
> On Sep 27, 2:54 pm, dagger  wrote:
> > Hi,
> >
> > A simple question... How can i create a download link to a file
> > uploaded to uploads directory under web of symfony?
> >
> > something like -  > file.pdf')?>
> >
> > thanks for the reply
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 execute a stored procedure on a remote db server throught symfony?

2009-09-28 Thread Farrukh Abbas
I'm using propel as orm

--
Kind regards
Farrukh Abbas

On 28 Sep 2009, at 09:20, Gareth McCumskey  wrote:

> Are you using Propel or Doctrine as your ORM?
>
> On Mon, Sep 28, 2009 at 2:42 AM, dagger  
>  wrote:
>
> Hi,
>
> in my current project I have to connect to a remote system and execute
> some stored procedures then get the returned data and save it on to
> the local database... Is there a way I can achieve this through
> symfony or would I have to bank on plain php?
>
> Your time n help is highly appreciated... Thx
>
>
>
>
> -- 
> Gareth McCumskey
> http://garethmccumskey.blogspot.com
> twitter: @garethmcc
>
> >

--~--~-~--~~~---~--~~
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 create a download link to a file in uploads directory?

2009-09-27 Thread Farrukh Abbas

Yes I believe it is the solution i was looking for... I will try it  
out as soon as I get back home... Thanks a lot. :)

--
Kind regards
Farrukh Abbas

On 27 Sep 2009, at 19:27, Gábor Fási  wrote:

>
> Check out the public_path() helper, I believe that's what you need.
>
> On Sun, Sep 27, 2009 at 19:22, Farrukh Abbas
>  wrote:
>>
>> That produces an error saying the rout is not defined... N plus i  
>> want
>> the link to be like http://localhost:8080/sfproject/web/uploads/myfile.pdf
>>  so when I deploy it on the server The URL will automatically  
>> become www.mydomain.com/uploads/myfile.pdf
>>  ... Right now I have to sort of hard code the folder structure
>> "myproject/web" just like image_tag() helper
>>
>> --
>> Kind regards
>> Farrukh Abbas
>>
>> On 27 Sep 2009, at 17:47, Eno  wrote:
>>
>>>
>>> On Sun, 27 Sep 2009, dagger wrote:
>>>
>>>> A simple question... How can i create a download link to a file
>>>> uploaded to uploads directory under web of symfony?
>>>>
>>>> something like - >>> file.pdf')?>
>>>
>>> Not sxure what the problem is since you anwered your own question.
>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>>>
>>
>>>
>>
>
> >

--~--~-~--~~~---~--~~
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 create a download link to a file in uploads directory?

2009-09-27 Thread Farrukh Abbas

That produces an error saying the rout is not defined... N plus i want  
the link to be like http://localhost:8080/sfproject/web/uploads/myfile.pdf 
  so when I deploy it on the server The URL will automatically become 
www.mydomain.com/uploads/myfile.pdf 
  ... Right now I have to sort of hard code the folder structure  
"myproject/web" just like image_tag() helper

--
Kind regards
Farrukh Abbas

On 27 Sep 2009, at 17:47, Eno  wrote:

>
> On Sun, 27 Sep 2009, dagger wrote:
>
>> A simple question... How can i create a download link to a file
>> uploaded to uploads directory under web of symfony?
>>
>> something like - > file.pdf')?>
>
> Not sxure what the problem is since you anwered your own question.
>
>
>
> -- 
>
>
>
> >

--~--~-~--~~~---~--~~
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 create a download link to a file in uploads directory?

2009-09-27 Thread Farrukh Abbas
using symfony 1.2

On Sun, Sep 27, 2009 at 2:54 PM, dagger  wrote:

>
> Hi,
>
> A simple question... How can i create a download link to a file
> uploaded to uploads directory under web of symfony?
>
> something like -  file.pdf')?>
>
> thanks for the reply
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 has definitely become too complicated framework

2009-09-23 Thread Farrukh Abbas

Yeah never really got the time to look into creating plugins Just used  
a few.. Will look into it... Thanks

Any how symfony is doing a great... N it a piece of work well done!  
Thanks to the team building it.

--
Kind regards
Farrukh Abbas

On 24 Sep 2009, at 03:48, zeek  wrote:

>
> Farrukh,
>
> The kind of re-use that you are talking about, from one project to the
> next, should be done with a plugin. It is the plugins that allow you
> to  "putting the schema   model n peer classes in one folder so all
> one would need is to copy   the folder n customize it ."
>
>
> On Sep 23, 9:51 am, Farrukh Abbas  wrote:
>> It has become a long thread ... As some one said before that
>> noframework is perfect... But I guess what matters is how well does a
>> framework hide all the complexitites of creating scalable web apps n
>> let's the developer focus on the solution n business logic
>> suberbly ... Yes it does take time to learn how to do it the "right"
>> way according to the rules the framework has put forth but if one
>> sticks to one version I guess there won't be that much of  
>> learning ...
>> Any how I would like to share my 50 cents of experience with  
>> symfony n
>> what I would like it to have...
>>
>> I have developed 3 to 4 apps on symfony n one thing I find my self
>> doing is use some module developed for on app into another which
>> ofcourse is possible but what do u guys think about putting the  
>> schema
>> model n peer classes in one folder so all one would need is to copy
>> the folder n customize it ... It's just n idea... So would like to
>> know the drawebacks n strenghts of doing so... For that to be  
>> possible
>> the model has to be stand alone... Feel free to critizie  
>> constructively
>>
>> --
>> Kind regards
>> Farrukh Abbas
>>
>> On 23 Sep 2009, at 15:37, Alexandru-Emil Lupu 
>> wrote:
>>
>>
>>
>>> Ghost3D,
>>> Sincerely, i thought that symfony is hard as well in the begining,
>>> but, there are some things that i haven't saw in other php
>>> frameworks, like the admin generator or the crud. Maybe, just
>>> because in the last period i am using just Django and Symfony in my
>>> projects.
>>> If you think that the symfony does not follow the best practices,
>>> then you are free to share with us what are the problems that you
>>> found on the system (allready done that). Instead of criticize so
>>> much the framework itself, you might come with some improvements of
>>> the generated code that "follows the best practices".
>>
>>> Yeah ... i know that sometimes the symfony generated does not do
>>> what i want to do, so i am starting to extend it. For example, on
>>> some objects i am hydrating manually the foreign objects, something
>>> like ROR way...
>>> $user = MyUser::find($criteria, array
>>> ('ban_status','profile','last_login')) and so on ...
>>
>>> AFAIK, not even a framework is able to read the developer's mind.
>>> Some of them have made compromises renouncing to complexity for the
>>> simplicity sake, other are maybe far too complex than they should.
>>
>>> i propose you something... make a blog application  (no plugins
>>> allowed) using symfony, yii, code igniter, cake PHP and tell us what
>>> were your work time for each one of the implementation. The
>>> applications should have: i18n support, form validation, comment
>>> management, and also an admin interface for the posts, a tagging
>>> system, and tests.
>>> After that add 2 majour database modifications and see what is the
>>> framework that helps you the most in this case.
>>
>>> Of course. The logic is not to learn all the framewors, but to see
>>> the development time for each one of it. Afterall we all work with
>>> tight deadlines for our customers.
>>> As someone said earlier: if you need to modify 90% of the generated
>>> code, either you don't do it right, either symfony is not for you.
>>
>>> Alecs
>>
>>> On Wed, Sep 23, 2009 at 3:55 PM, Phil Moorhouse  
>>> >>> wrote:
>>
>>> Ghost3D,
>>
>>> Firstly, the reason for the move to OO forms has already been  
>>> covered
>>> - it's to promote re-use and greater flexibility. This unavoidably
>>> comes with the cost of increased complexity, and I think from the
>>> answers above most people here are willing to 

[symfony-users] Re: How to get ID of last object insert

2009-09-23 Thread Farrukh Abbas
i have always used the construct below
if($this->form->isValid()){

$object = $this->form->save();

$id = $object->getId();
}

seeing bindandsave for the first time...

the save function of the form automatically sets the id of the object or in
other words returns the recently saved object.

On Thu, Sep 24, 2009 at 12:48 AM, ferdjuan  wrote:

>
> I have a method which inserts an entry into the database, and I am
> trying to retrieve it's ID immediately so I can return the data back
> to the screen with javascript:
>
> $this->ticketaddform = new TicketForm();
> if ($r->isMethod('post') && $this->ticketaddform->bindAndSave($r-
> >getParameter('ticket')))
> {
>//method is shortened for clarity
>$c = new Criteria();
>$c->addDescendingOrderByColumn(TicketPeer::CREATED_AT);
>$this->newticket = TicketPeer::doSelectOne($c);
> }
>
> After the object is saved and stored via bindAndSave() I run a query
> to grab the most recently created Ticket. Sometimes it gets an older
> ticket, but sometimes it gets the last one. Is there a getLastInsertId
> method, or some other similar technique I can use?
>
> Thanks
>
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 has definitely become too complicated framework

2009-09-23 Thread Farrukh Abbas

Yeah :) like plugins but one wouldn't have to spend the time making it
into a  plugin ... why not make that as a natural part of process while
developing an app .. So modules r from the start build like plugins ...
During the project the time spent on documentation is minimal so not
every thing makes to the end doc ... N therefore when in a new project
i have to use one of my modules written earlier, i have to spend the
time to relearn atleast 30% of it ... mostly configurations etc ...

so given that modules are like plugins (maybe not entirely) reusing a
module would be alot easier as well ...

--
Kind regards
Farrukh Abbas

On 23 Sep 2009, at 22:30, Sid Bachtiar  wrote:

>
>> the schema model n peer classes in
>> one folder so all one would need is to copy the folder n customize it
>
> You mean like, plugin? :)
>
> On Thu, Sep 24, 2009 at 1:51 AM, Farrukh Abbas
>  wrote:
>> It has become a long thread ... As some one said before that
>> noframework is
>> perfect... But I guess what matters is how well does a framework
>> hide all
>> the complexitites of creating scalable web apps n let's the
>> developer focus
>> on the solution n business logic suberbly ... Yes it does take time
>> to learn
>> how to do it the "right" way according to the rules the framework
>> has put
>> forth but if one sticks to one version I guess there won't be that
>> much of
>> learning ... Any how I would like to share my 50 cents of
>> experience with
>> symfony n what I would like it to have...
>> I have developed 3 to 4 apps on symfony n one thing I find my self
>> doing is
>> use some module developed for on app into another which ofcourse is
>> possible
>> but what do u guys think about putting the schema model n peer
>> classes in
>> one folder so all one would need is to copy the folder n customize
>> it ...
>> It's just n idea... So would like to know the drawebacks n
>> strenghts of
>> doing so... For that to be possible the model has to be stand
>> alone... Feel
>> free to critizie constructively
>>
>> --
>> Kind regards
>> Farrukh Abbas
>> On 23 Sep 2009, at 15:37, Alexandru-Emil Lupu
>>  wrote:
>>
>> Ghost3D,
>> Sincerely, i thought that symfony is hard as well in the begining,
>> but,
>> there are some things that i haven't saw in other php frameworks,
>> like the
>> admin generator or the crud. Maybe, just because in the last period
>> i am
>> using just Django and Symfony in my projects.
>> If you think that the symfony does not follow the best practices,
>> then you
>> are free to share with us what are the problems that you found on
>> the system
>> (allready done that). Instead of criticize so much the framework
>> itself, you
>> might come with some improvements of the generated code that
>> "follows the
>> best practices".
>>
>> Yeah ... i know that sometimes the symfony generated does not do
>> what i want
>> to do, so i am starting to extend it. For example, on some objects
>> i am
>> hydrating manually the foreign objects, something like ROR way...
>> $user = MyUser::find($criteria, array
>> ('ban_status','profile','last_login'))
>> and so on ...
>>
>> AFAIK, not even a framework is able to read the developer's mind.
>> Some of
>> them have made compromises renouncing to complexity for the
>> simplicity sake,
>> other are maybe far too complex than they should.
>>
>> i propose you something... make a blog application  (no plugins
>> allowed)
>> using symfony, yii, code igniter, cake PHP and tell us what were
>> your work
>> time for each one of the implementation. The applications should
>> have: i18n
>> support, form validation, comment management, and also an admin
>> interface
>> for the posts, a tagging system, and tests.
>> After that add 2 majour database modifications and see what is the
>> framework
>> that helps you the most in this case.
>>
>> Of course. The logic is not to learn all the framewors, but to see
>> the
>> development time for each one of it. Afterall we all work with tight
>> deadlines for our customers.
>> As someone said earlier: if you need to modify 90% of the generated
>> code,
>> either you don't do it right, either symfony is not for you.
>>
>> Alecs
>>
>>
>> On Wed, Sep 23, 2009 at 3:55 PM, Phil Moorhouse
>>  wrote:
>>>
>>>
>>> Ghost3D,
>>>
>>> Firstly, the 

[symfony-users] Re: Symfony has definitely become too complicated framework

2009-09-23 Thread Farrukh Abbas
It has become a long thread ... As some one said before that   
noframework is perfect... But I guess what matters is how well does a  
framework hide all the complexitites of creating scalable web apps n  
let's the developer focus on the solution n business logic  
suberbly ... Yes it does take time to learn how to do it the "right"  
way according to the rules the framework has put forth but if one  
sticks to one version I guess there won't be that much of learning ...  
Any how I would like to share my 50 cents of experience with symfony n  
what I would like it to have...

I have developed 3 to 4 apps on symfony n one thing I find my self  
doing is use some module developed for on app into another which  
ofcourse is possible but what do u guys think about putting the schema  
model n peer classes in one folder so all one would need is to copy  
the folder n customize it ... It's just n idea... So would like to  
know the drawebacks n strenghts of doing so... For that to be possible  
the model has to be stand alone... Feel free to critizie constructively

--
Kind regards
Farrukh Abbas

On 23 Sep 2009, at 15:37, Alexandru-Emil Lupu   
wrote:

> Ghost3D,
> Sincerely, i thought that symfony is hard as well in the begining,  
> but, there are some things that i haven't saw in other php  
> frameworks, like the admin generator or the crud. Maybe, just  
> because in the last period i am using just Django and Symfony in my  
> projects.
> If you think that the symfony does not follow the best practices,  
> then you are free to share with us what are the problems that you  
> found on the system (allready done that). Instead of criticize so  
> much the framework itself, you might come with some improvements of  
> the generated code that "follows the best practices".
>
> Yeah ... i know that sometimes the symfony generated does not do  
> what i want to do, so i am starting to extend it. For example, on  
> some objects i am hydrating manually the foreign objects, something  
> like ROR way...
> $user = MyUser::find($criteria, array 
> ('ban_status','profile','last_login')) and so on ...
>
> AFAIK, not even a framework is able to read the developer's mind.  
> Some of them have made compromises renouncing to complexity for the  
> simplicity sake, other are maybe far too complex than they should.
>
> i propose you something... make a blog application  (no plugins  
> allowed) using symfony, yii, code igniter, cake PHP and tell us what  
> were your work time for each one of the implementation. The  
> applications should have: i18n support, form validation, comment  
> management, and also an admin interface for the posts, a tagging  
> system, and tests.
> After that add 2 majour database modifications and see what is the  
> framework that helps you the most in this case.
>
> Of course. The logic is not to learn all the framewors, but to see  
> the development time for each one of it. Afterall we all work with  
> tight deadlines for our customers.
> As someone said earlier: if you need to modify 90% of the generated  
> code, either you don't do it right, either symfony is not for you.
>
> Alecs
>
>
> On Wed, Sep 23, 2009 at 3:55 PM, Phil Moorhouse 
>  > wrote:
>
>
> Ghost3D,
>
> Firstly, the reason for the move to OO forms has already been covered
> - it's to promote re-use and greater flexibility. This unavoidably
> comes with the cost of increased complexity, and I think from the
> answers above most people here are willing to make that trade-off.
>
> Secondly, Symfony is not meant to be an application generator in the
> way that Drupal or Joomla will build most of your app for you. It's a
> foundation and structure for you to build your app on top of. The
> admin generator can quickly give you a simple back-end and in some
> cases people have bent and shaped it to make entire sites, but there
> is no explicit claim that you can wave a magic wand and Symfony will
> write your entire codebase. If you want that then Symfony is not for
> you.
>
> Thirdly, the directory structure is not complex - it follows a
> convention that is well named and repeated throughout the framework,
> which makes naming decisions and finding old code easy. The empty
> classes are there so that you can extend the base classes without
> changing them, which means you can update your Symfony version or
> rebuild your model without fear of overwriting your own custom code.
> The CRUD is a quickly producible (and completely optional) starting
> point for you to modify, and that's all it's meant to be. The
> configuration has well chosen defaults from the start - the only thing
> you need to provide to get an app 

[symfony-users] Re: many to many relationships at admin not working

2009-09-16 Thread Farrukh Abbas
tried that too ... does not work ... r u using sf 1.2 ?
can u plz give it a try for experiment sake ... coz i picked the
implementation of many to many relationship from a thread which was based on
1.0 http://groups.google.com/group/symfony-users/msg/627be2a11e61990e

<http://groups.google.com/group/symfony-users/msg/627be2a11e61990e>

On Wed, Sep 16, 2009 at 8:14 PM, Abraham Montilla wrote:

> oh, try deleting the module and generate it again, i think that's the
> problem then...
>
> 2009/9/16 Farrukh Abbas 
>
> yes i did, build-model, form, sql, and insert-sql ... then cache:clear ...
>> but no difference ...
>>
>> On Wed, Sep 16, 2009 at 3:45 AM, Abraham Montilla 
>> wrote:
>>
>>> i think you actually did it, but... did you make the build-all-load
>>> command? and clear the cache only to see if helps.
>>>
>>> 2009/9/15 Farrukh Abbas 
>>>
>>>> changed the schema to the following (propel), but still no luck ...
>>>>
>>>>   permission:
>>>> id:
>>>> method_name:  { type: VARCHAR, size: 50, required: true }
>>>> action_name:  { type: VARCHAR, size: 50, required: true }
>>>>   role:
>>>> id:
>>>> name: { type: VARCHAR, size: 100, required: true }
>>>>   role_permission:
>>>> role_id:  { type: INTEGER, required: true, foreignTable:
>>>> role, foreignReference: id}
>>>> permission_id:{ type: INTEGER, required: true, foreignTable:
>>>> permission, foreignReference: id}
>>>>
>>>>
>>>>
>>>> On Tue, Sep 15, 2009 at 10:28 PM, Abraham Montilla <
>>>> amontil...@gmail.com> wrote:
>>>>
>>>>> Hello dagger, in the schema you have to add foreign keys to the third
>>>>> table, in Doctrine would be something like
>>>>>
>>>>> Permission:
>>>>>   columns:
>>>>> id:
>>>>>   type: integer(4)
>>>>>   primary: true
>>>>>   notnull: true
>>>>> method_name:
>>>>>   type: string(50)
>>>>>   notnull: true
>>>>> action_name:
>>>>>   type: string(50)
>>>>>   notnull: true
>>>>>   options:
>>>>> type: InnoDB
>>>>>
>>>>> Role:
>>>>>   columns:
>>>>> id:
>>>>>   type: integer(4)
>>>>>   primary: true
>>>>>   notnull: true
>>>>> name:
>>>>>   type: string(100)
>>>>>   notnull: true
>>>>>   options:
>>>>> type: InnoDB
>>>>>
>>>>> RolePermission:
>>>>>   tableName: Role_Permission
>>>>>   columns:
>>>>> Role_id:
>>>>>   type: integer(4)
>>>>>   primary: true
>>>>>   notnull: true
>>>>> Permission_id:
>>>>>   type: integer(4)
>>>>>   primary: true
>>>>>   notnull: true
>>>>>   relations:
>>>>> Role:
>>>>>   local: Role_id
>>>>>   foreign: id
>>>>>   foreignAlias: RolePermissions
>>>>> Permission:
>>>>>   local: Permission_id
>>>>>   foreign: id
>>>>>   foreignAlias: RolePermissions
>>>>>   options:
>>>>> type: InnoDB
>>>>>
>>>>>
>>>>> In Propel i bet is quite the same... Good luck.
>>>>>
>>>>> 2009/9/15 dagger 
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to implement the many to many relation between Role and
>>>>>> Permission ... but the admin_check_list is not appearing ... i am
>>>>>> using symfony 1.2 ... the structure follows
>>>>>>
>>>>>> schema.yml
>>>>>> permission:
>>>>>>id:
>>>>>>method_name:  { type: VARCHAR, size: 50, required: true }
>>>>>>action_name:  { type: VARCHAR, size: 50, required: true }
>>>>>>  role:
>>>>>>id:
>>>>>>name: { type: VARCHAR, size: 100, required: true }
>>>>>>  role_permission:
&g

[symfony-users] Re: many to many relationships at admin not working

2009-09-16 Thread Farrukh Abbas
yes i did, build-model, form, sql, and insert-sql ... then cache:clear ...
but no difference ...

On Wed, Sep 16, 2009 at 3:45 AM, Abraham Montilla wrote:

> i think you actually did it, but... did you make the build-all-load
> command? and clear the cache only to see if helps.
>
> 2009/9/15 Farrukh Abbas 
>
>> changed the schema to the following (propel), but still no luck ...
>>
>>   permission:
>> id:
>> method_name:  { type: VARCHAR, size: 50, required: true }
>> action_name:  { type: VARCHAR, size: 50, required: true }
>>   role:
>> id:
>> name: { type: VARCHAR, size: 100, required: true }
>>   role_permission:
>> role_id:  { type: INTEGER, required: true, foreignTable: role,
>> foreignReference: id}
>> permission_id:{ type: INTEGER, required: true, foreignTable:
>> permission, foreignReference: id}
>>
>>
>>
>> On Tue, Sep 15, 2009 at 10:28 PM, Abraham Montilla 
>> wrote:
>>
>>> Hello dagger, in the schema you have to add foreign keys to the third
>>> table, in Doctrine would be something like
>>>
>>> Permission:
>>>   columns:
>>> id:
>>>   type: integer(4)
>>>   primary: true
>>>   notnull: true
>>> method_name:
>>>   type: string(50)
>>>   notnull: true
>>> action_name:
>>>   type: string(50)
>>>   notnull: true
>>>   options:
>>> type: InnoDB
>>>
>>> Role:
>>>   columns:
>>> id:
>>>   type: integer(4)
>>>   primary: true
>>>   notnull: true
>>> name:
>>>   type: string(100)
>>>   notnull: true
>>>   options:
>>> type: InnoDB
>>>
>>> RolePermission:
>>>   tableName: Role_Permission
>>>   columns:
>>> Role_id:
>>>   type: integer(4)
>>>   primary: true
>>>   notnull: true
>>> Permission_id:
>>>   type: integer(4)
>>>   primary: true
>>>   notnull: true
>>>   relations:
>>> Role:
>>>   local: Role_id
>>>   foreign: id
>>>   foreignAlias: RolePermissions
>>> Permission:
>>>   local: Permission_id
>>>   foreign: id
>>>   foreignAlias: RolePermissions
>>>   options:
>>> type: InnoDB
>>>
>>>
>>> In Propel i bet is quite the same... Good luck.
>>>
>>> 2009/9/15 dagger 
>>>
>>>
>>>> Hi,
>>>>
>>>> I'm trying to implement the many to many relation between Role and
>>>> Permission ... but the admin_check_list is not appearing ... i am
>>>> using symfony 1.2 ... the structure follows
>>>>
>>>> schema.yml
>>>> permission:
>>>>id:
>>>>method_name:  { type: VARCHAR, size: 50, required: true }
>>>>action_name:  { type: VARCHAR, size: 50, required: true }
>>>>  role:
>>>>id:
>>>>name: { type: VARCHAR, size: 100, required: true }
>>>>  role_permission:
>>>>role_id:
>>>>permission_id:
>>>>
>>>> generated 2 modules at backend through - init-admin task
>>>>
>>>> permission and role
>>>>
>>>> The generator.yml of role module looks like this
>>>>
>>>> generator:
>>>>  class:  sfPropelAdminGenerator
>>>>  param:
>>>>model_class:  Role
>>>>theme:default
>>>>
>>>>list:
>>>>  object_actions:
>>>>_edit: ~
>>>>edit:
>>>>  fields:
>>>>role_permission: { type: admin_check_list, params:
>>>> through_class=RolePermission }
>>>>
>>>> and i don't see the check list on the edit page of role... can any one
>>>> help me find the mistake i'm making?
>>>>
>>>> highly appreciate your help.
>>>>
>>>>
>>>
>>>
>>> --
>>> Have a nice day.
>>> Abraham Montilla.
>>>
>>>
>>>
>>>
>>
>>
>> --
>> kind regards
>> Farrukh K. Muhammad
>> skype id - mobileweaver
>>
>>
>>
>>
>
>
> --
> Have a nice day.
> Abraham Montilla.
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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: many to many relationships at admin not working

2009-09-15 Thread Farrukh Abbas
changed the schema to the following (propel), but still no luck ...

  permission:
id:
method_name:  { type: VARCHAR, size: 50, required: true }
action_name:  { type: VARCHAR, size: 50, required: true }
  role:
id:
name: { type: VARCHAR, size: 100, required: true }
  role_permission:
role_id:  { type: INTEGER, required: true, foreignTable: role,
foreignReference: id}
permission_id:{ type: INTEGER, required: true, foreignTable:
permission, foreignReference: id}



On Tue, Sep 15, 2009 at 10:28 PM, Abraham Montilla wrote:

> Hello dagger, in the schema you have to add foreign keys to the third
> table, in Doctrine would be something like
>
> Permission:
>   columns:
> id:
>   type: integer(4)
>   primary: true
>   notnull: true
> method_name:
>   type: string(50)
>   notnull: true
> action_name:
>   type: string(50)
>   notnull: true
>   options:
> type: InnoDB
>
> Role:
>   columns:
> id:
>   type: integer(4)
>   primary: true
>   notnull: true
> name:
>   type: string(100)
>   notnull: true
>   options:
> type: InnoDB
>
> RolePermission:
>   tableName: Role_Permission
>   columns:
> Role_id:
>   type: integer(4)
>   primary: true
>   notnull: true
> Permission_id:
>   type: integer(4)
>   primary: true
>   notnull: true
>   relations:
> Role:
>   local: Role_id
>   foreign: id
>   foreignAlias: RolePermissions
> Permission:
>   local: Permission_id
>   foreign: id
>   foreignAlias: RolePermissions
>   options:
> type: InnoDB
>
>
> In Propel i bet is quite the same... Good luck.
>
> 2009/9/15 dagger 
>
>
>> Hi,
>>
>> I'm trying to implement the many to many relation between Role and
>> Permission ... but the admin_check_list is not appearing ... i am
>> using symfony 1.2 ... the structure follows
>>
>> schema.yml
>> permission:
>>id:
>>method_name:  { type: VARCHAR, size: 50, required: true }
>>action_name:  { type: VARCHAR, size: 50, required: true }
>>  role:
>>id:
>>name: { type: VARCHAR, size: 100, required: true }
>>  role_permission:
>>role_id:
>>permission_id:
>>
>> generated 2 modules at backend through - init-admin task
>>
>> permission and role
>>
>> The generator.yml of role module looks like this
>>
>> generator:
>>  class:  sfPropelAdminGenerator
>>  param:
>>model_class:  Role
>>theme:default
>>
>>list:
>>  object_actions:
>>_edit: ~
>>edit:
>>  fields:
>>role_permission: { type: admin_check_list, params:
>> through_class=RolePermission }
>>
>> and i don't see the check list on the edit page of role... can any one
>> help me find the mistake i'm making?
>>
>> highly appreciate your help.
>>
>>
>
>
> --
> Have a nice day.
> Abraham Montilla.
>
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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: Problems with session

2009-09-10 Thread Farrukh Abbas
you also have to specify a namespace like this
$this->getUser()->setAttribute('quantity', '10', 'shopping_cart');

$this->getUser()->getAttribute('quantity', 'a default value if quantity does
not exist', 'shopping_cart');

$sf_user->getAttribute('quantity', '', 'shopping_cart');

and if u want to remove the session use

$this->getUser()->getAttributeHolder()->removeNameSpace('shopping_cart');

On Wed, Sep 9, 2009 at 6:37 PM, guru  wrote:

>
> I'm new to Symfony and have problems with Accessing the User Session.
>
> In my /apps/frontend/modules/myapp/actions/actions.class.php Actions
> Class, I have something like this:
>
>
>  public function executeAdd($request)
>  {
>  ...
>   $this->getUser()->setAttribute('shopping_cart', 'test');
>
>  }
>
> Letter, in my template file (apps/frontend/modules/myapp/templates/
> indexSuccess.php)  when I try to get a value of "shopping_cart" with
>
> $sf_user->getAttribute('shopping_cart');
>
> so, 'shopping_cart' is empty.
>
> When I try to print out with $_SESSION, "shopping_cart" has a value.
>
> What am I doing wrong?
>
> Many thanks in advance for your help.
>
> Gezim
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 send e-mail independent of an action?

2009-09-08 Thread Farrukh Abbas
ok thanks ... i will try this solution ... can an event be used for this?

On Tue, Sep 8, 2009 at 7:49 PM, Gábor Fási  wrote:

>
> I'd do it like this way: when you need to send a mail, add a new row
> to a dedicated emails table with all the neccesary info.
> Create a task, that checks this table, and if it has rows (= there are
> mails to be sent), it fetches the first few and sends them.
> Finally, schedule this task via cron to run like every hour, or half
> an hour. With this method you can also avoid spamming the smtp server
> with many mails at once, like when creating a newsletter.
>
> Gábor
>
>
> On Tue, Sep 8, 2009 at 19:37, Farrukh Abbas
> wrote:
> > ok - let me have another shot at explaining it
> > Problem statement: I have build a simple bloging application where
> multiple
> > people can post articles, and readers can post comments. At the backend
> the
> > administrator can approve and reject a comment. Now when the admin
> Approves
> > a comment the system sends 2 e-mails - 1st to the article writer and 2nd
> to
> > the comment writer - notifying both about the comment.
> > The problem is that at times the response time is alot (in minutes); and
> at
> > times due to the un-availability of the smtp server either a blank page
> or
> > an exception ...
> > What i want to achieve is that - when the admin clicks on approve this
> > comment - the db shall be updated with proper values and then there shall
> be
> > a trigger of some sort which the "executeApprove" action invokes and
> > continues execution - now that trigger should take care of sending the
> > e-mail independent of the actions execution ... the action shall not wait
> > for the sendMail function to complete its task before sending the
> response
> > to the browser.
> > There are many scenarios where sending an e-mail to the user is required
> -
> > but i am not satisfied with this way of implementation - as it may just
> > throw a blank page in case of an exception or take too much time if the
> smtp
> > server is busy ...
> > i hope this is a better description ...
> > thanks for your time
> > On Tue, Sep 8, 2009 at 5:56 PM, Eno  wrote:
> >>
> >> On Tue, 8 Sep 2009, Farrukh Abbas wrote:
> >>
> >> > Ok thanks,
> >> > is there a way i can perform the e-mail sending after the response has
> >> > been
> >> > sent to the browser?
> >>
> >> I think what Alexander meant was that you would have to write some sort
> of
> >> background task that runs on the server that sends out the email
> (perhaps
> >> by looking for new tasks in a database table). Since this task would run
> >> independently, your question doesn't really make sense.
> >>
> >>
> >>
> >> --
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> > --
> > kind regards
> > Farrukh K. Muhammad
> > skype id - mobileweaver
> >
> > >
> >
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 send e-mail independent of an action?

2009-09-08 Thread Farrukh Abbas
ok - let me have another shot at explaining it
Problem statement: I have build a simple bloging application where multiple
people can post articles, and readers can post comments. At the backend the
administrator can approve and reject a comment. Now when the admin Approves
a comment the system sends 2 e-mails - 1st to the article writer and 2nd to
the comment writer - notifying both about the comment.

The problem is that at times the response time is alot (in minutes); and at
times due to the un-availability of the smtp server either a blank page or
an exception ...

What i want to achieve is that - when the admin clicks on approve this
comment - the db shall be updated with proper values and then there shall be
a trigger of some sort which the "executeApprove" action invokes and
continues execution - now that trigger should take care of sending the
e-mail independent of the actions execution ... the action shall not wait
for the sendMail function to complete its task before sending the response
to the browser.

There are many scenarios where sending an e-mail to the user is required -
but i am not satisfied with this way of implementation - as it may just
throw a blank page in case of an exception or take too much time if the smtp
server is busy ...

i hope this is a better description ...

thanks for your time

On Tue, Sep 8, 2009 at 5:56 PM, Eno  wrote:

>
> On Tue, 8 Sep 2009, Farrukh Abbas wrote:
>
> > Ok thanks,
> > is there a way i can perform the e-mail sending after the response has
> been
> > sent to the browser?
>
> I think what Alexander meant was that you would have to write some sort of
> background task that runs on the server that sends out the email (perhaps
> by looking for new tasks in a database table). Since this task would run
> independently, your question doesn't really make sense.
>
>
>
> --
>
>
>
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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 send e-mail independent of an action?

2009-09-08 Thread Farrukh Abbas
Ok thanks,
is there a way i can perform the e-mail sending after the response has been
sent to the browser?

On Tue, Sep 8, 2009 at 12:56 PM, aalexand
wrote:

>
> As PHP doesn't support multi-threading, you cannot execute parallel
> activities in a single request. I think the most common solution in
> this case is to put the task you want to be executed independently in
> some kind of message queue (like dropr http://dropr.org), which works
> as a separate process on the OS.
>
> On Sep 8, 11:40 am, dagger  wrote:
> > How can i send an e-mail from within an action, but the action shall
> > not wait for the method to return in order to send the response to the
> > browser/user...
> >
> > for example the standard subscription confirmation e-mail ... at the
> > time of signup the action invokes a method to send e-mail but does not
> > wait for it to return?
> >
> > your help n time is much appreciated. thanx
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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: implementing one to many relation between User and Images at backend

2009-07-30 Thread Farrukh Abbas
yeah - thanks :)

On Wed, Jul 29, 2009 at 3:29 PM, despai -  wrote:

> bool *unlink* ( string $nombrearchivo [, resource $contexto ] )
>
>
>
>
> 2009/7/29 dagger 
>
>
>> I guess it will be better if I define a template for image editing ...
>> as i also create 2 scaled versions at the time the user is uploading
>> the images - thumb, and large. So i would highly appreciate if one can
>> tell me how to delete a file/image from the /uploads/ dir of symfony
>> the rest will be simple and straight forward. thanks
>>
>> On Jul 29, 1:21 pm, dagger  wrote:
>> > How can i change the admin user form to be able to add the 4 or less
>> > images edit form? and how can i manipulate the forms used by admin
>> > generator ? please help
>> >
>> > On Jul 28, 9:36 pm, dagger  wrote:
>> >
>> >
>> >
>> > > Hi,
>> >
>> > > I am trying to implement the edit page of User object which can have
>> > > many images;
>> >
>> > > How can i make a very user friendly edit image section in User edit
>> > > form on backend?
>> >
>> > > have no idea... please help, this is a big show stopper in my project.
>> >
>> > > Requirement - User at sign-up uploads 4 images - now when admin is
>> > > editing the user - then the admin should be able to delete an existing
>> > > image, and upload a new image in its stead...
>> >
>> > > waiting for a prompt response.
>>
>>
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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: problem with foreign key field

2009-07-21 Thread Farrukh Abbas
Hi
I'm new with 1.2 myself ... and have not really made a new project in 1.2
yet ... so far only been upgrading my existing projects from 1.0

Never the less you could try and put the following parameters in the
attribute definition

{ type: INTEGER, required: true, default: '', foreignTable: user,
foreignReference: user_id, onDelete: RESTRICT, onUpdate: RESTRICT }

or could simply specify the foreign keys as user_id: ~ (but i assume you
have a good reason not going this way)

On Tue, Jul 21, 2009 at 3:35 PM, leader  wrote:

>
> Hi,
> I'm a newhire in symfony,
> I created an admin module for my Team Model (team : group)
> and I created an admin module for Useraccount model.
>
> when I clic on new in Useraccount admin module I have e form to enter
> information, but for TeamID : i have a TextBox field... so i have to
> enter manually the id ... normally it should print a comboBox field to
> choose the TEam id ...
> in the scheama I have This :
> .
> .
> .
>
> team:
>_attributes: { phpName: Team }
>IDGROUP: { type: DECIMAL, size: '8', scale: '0', primaryKey: true,
> required: true }
>DESCRIPTION: { type: VARCHAR, size: '1024', required: false }
>
>
>  useraccount:
>_attributes: { phpName: Useraccount }
>IDUSER: { type: DECIMAL, size: '8', scale: '0', primaryKey: true,
> required: true }
>IDGROUP: { type: DECIMAL, size: '8', scale: '0', required: true }
>NAME: { type: VARCHAR, size: '1024', required: false }
>LASTNAME: { type: VARCHAR, size: '1024', required: false }
>EMAIL: { type: VARCHAR, size: '1024', required: false }
>PASSWORD: { type: VARCHAR, size: '1024', required: false }
>LEVEL: { type: DECIMAL, size: '8', scale: '0', required: false }
>_indexes: { FK_BELONGUG: [IDGROUP] }
> ..
>
>
>
> >
>


-- 
kind regards
Farrukh K. Muhammad
skype id - mobileweaver

--~--~-~--~~~---~--~~
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: File Upload not working in symfony 1.2.7 when 2 forms are embadded in one view

2009-06-12 Thread Farrukh Abbas
Thanks... looking into a work around - any other solutions to this problem?

On Fri, Jun 12, 2009 at 2:41 PM, Sid Ferreira  wrote:

> As I said, we need a ticket...http://trac.symfony-project.org/ticket/6618
> Did it.
>
>
> On Fri, Jun 12, 2009 at 06:33, Benjamin Grandfond <
> benjamin.grandf...@gmail.com> wrote:
>
>>
>> We had this bug too, and I wonder if it's not a bug in symfony.
>>
>> The doSave method of sfDoctrineForm calls
>> 367 $this->saveEmbeddedForms($con);
>>  and in this method it calls the save method of the embedded form
>> object (line 392), may be it should save the form instead ?
>> I do not try the change of that if someone can do ?
>>
>> __
>> Benjamin Grandfond - www.benjamingrandfond.fr
>> benjamin.grandf...@gmail.com
>>
>> Le 12 juin 09 à 11:26, Sid Ferreira a écrit :
>>
>> > already got this too, we need to create a ticket for it.
>> > It is a bit random, sometimes changing the order of the embeded
>> > forms fix it. REALLY weird.
>> >
>> > there's this workdaround too
>> http://stereointeractive.com/blog/2008/12/23/symfony-12-upload-a-file-inside-an-embedded-form/
>> >
>> > On Fri, Jun 12, 2009 at 03:49, dagger 
>> > wrote:
>> >
>> > Hi,
>> >
>> > Concept: I have made 2 tables - images and resort - each resort has a
>> > logo and can have many pictures - but for this application  idecided
>> > that each resort would have 4 images.
>> >
>> > Problem: in the earlier version of symfony all was well. But then i
>> > upgraded to symfony 1.2.7 - and after that it stopped working - the
>> > code is given below - i tried 2 solutions - one was to make 2 form
>> > objects - ResortForm and UploadForm - UploadForm is the form
>> > containing the 4 image fields and in the update action of the resort
>> > controller i populate the image table. it didn't work - u can see as i
>> > have commented it out - then i simply used input_file_tag which u can
>> > see below as well... but no matter wat the $file just remains to be
>> > NULL - Note that the logo of resort is uploaded properly coz its part
>> > of ResorfForm but not the other files :(
>> >
>> > $this->form->bind($request->getParameter('resort'), $this->getRequest
>> > ()->getFiles('resort'));
>> >
>> >if($this->getRequest()->getParameter('refresh') != 'Y')
>> >{
>> >
>> >if ($this->form->isValid())
>> >{
>> >$resort = $this->form->save();
>> >
>> >$file = $this->form->getValue('logo');
>> >
>> >if($file){
>> >$filename = 'upload_'.sha1($file-
>> > >getOriginalName());
>> >$extension = $file->getExtension($file-
>> > >getOriginalExtension
>> > ());
>> >$file-
>> > >save(sfConfig::get('sf_upload_dir').'/'.$filename.
>> > $extension);
>> >
>> >$resort->setLogo($filename.$extension);
>> > $this->createLogo($filename.$extension,
>> > sfConfig::get
>> > ('sf_upload_dir').'/');
>> > $this->createThumbnail($filename.
>> > $extension, sfConfig::get
>> > ('sf_upload_dir').'/');
>> >}
>> >  $resort->save();
>> >
>> >  //$this->imgFile = new UploadForm();
>> >
>> >  //$this->imgFile->bind($this->getRequest()->getParameter
>> > ('upload'), $this->getRequest()->getFiles('upload'));
>> >
>> >  for($i = 1; $i <= 4; $i++)
>> >  {
>> >$file = $this->getRequest()-
>> > >getFiles('image_'.$i);//$this-
>> > >form->getValue('image_'.$i);
>> >
>> >if($file){
>> >echo 'uploading image ';
>> >$filename = 'upload_'.sha1($file-
>> > >getOriginalName());
>> >$extension = $file-
>> > >getExtension($file->getOriginalExtension());
>> >$file-
>> > >save(sfConfig::get('sf_upload_dir').'/'.$filename.
>> > $extension);
>> >
>> >$image = new Image();
>> >
>> >$image->setResortId($resort->getId());
>> >$image->setPath($filename.$extension);
>> >
>> >$image->save();
>> >$this->createLargeImage($image-
>> > >getPath(), sfConfig::get
>> > ('sf_upload_dir').'/');
>> >}
>> >  }
>> >
>> >  $this->setTemplate('testimage');
>> >  return;
>> >}
>> >} else {
>> >return $this->renderPartial('countrycity', array('form' =>
>> > $this-
>> > >form));
>> >}
>> >
>> >//$this->imgFile = new UploadForm();
>> >$this->setTemplate('edit');
>> >
>> > i understand that this is not the proper way of implementing it and as
>> > i am new to symfony i would appreciate if you peopl