Re: [symfony-users] Re: how to prevent save in preInsert?

2010-05-29 Thread Georg Gell
add this to each form's configure() method, that you want to have flood
protected (I expect that you want to protect this way (form) of entering
data from flooding, and not the model itself):

$this->validatorSchema->setPostValidator(new CombValidator(null,
array(), array('invalid' => 'Flooding is not acceptable')));

and put the CombValidator in the lib dir:

class CombValidator extends sfValidatorSchema {
  protected function doClean($values) {
if ($isFlood){
  throw new sfValidatorError($this, 'invalid');
}
  }
}


Am 29.05.2010 06:17, schrieb comb:
> Hey & Thanks! Yeah it's more clean like you describe to do it in
> processForm or the isValid for the form classes, but then I have to
> add this validation to each model-actions-class/model-form, that I
> want to be flood-protected. Isn't there a way to prevent code-
> duplication by using the preInsert hooks or something else? (DRY-
> principle)
> (That's maybe what the thread is about... best practice regarding DRY
> or not DRY).
> 
> On 28 Mai, 14:24, Tom Ptacnik  wrote:
>> If you want to redirect back to the filled form when user don't wait
>> enough, then I think the best solution would be to do this validation
>> in the moment as classic validation of the form fields.
>>
>> I suggest to create some class for this validation ...
>> FloodProtector.class.php
>> then create some method testFlood() maybe static maybe not :)
>>
>> And I see two options:
>>
>> Option 1)
>>  Do this validation in the form object. For example in the method
>> isValid()
>> .. overwrite it ..
>>
>> public function isValid()
>> {
>>   if (FloodProtector::testFlood())
>>   {
>>.. set error message somehow
>>   return false;
>>   }
>>
>>   return parent::isValid();
>>
>> }
>>
>> Option 2)
>>  Check for this in the action next to the $form->isValid();
>>
>> protected function processForm(sfWebRequest $request, sfForm $form)
>> {
>>   $form->bind($request->getParameter($form->getName()), $request-
>>
>>> getFiles($form->getName()));
>>
>>   if ($form->isValid())
>>   {
>> if (FloodProtector::testFlood())
>> {
>>   $this->getUser()->setFlash('error', 'The item has not been saved
>> due to flood protection.');
>> }
>> else
>> {
>>  ... classic process if form is valid
>> ...
>>
>> On 27 kvě, 22:04, comb  wrote:
>>
>>> that works! =) It prevent's the insert itself and I know, how to
>>> redirect back to the form, but I cannot figure out, how to display the
>>> given form values from the invoker again. My form is always empty :-/
>>
>>> class FloodCheckListener extends Doctrine_Record_Listener
>>> {
>>> //...
>>> public function preInsert(Doctrine_Event $event)
>>> {
>>> if (sfContext::hasInstance())
>>> {
>>> if (true) // check user attributes and DB for 
>>> flooding
>>> {
>>> $event->skipOperation(); // do not insert
>>> 
>>> sfContext::getInstance()->getUser()->setFlash('error', 'You have
>>> to wait some time before you can post again!');
>>> $ref = 
>>> sfContext::getInstance()->getRequest()->getReferer();
>>> if (empty($ref))
>>> {
>>> $ref = '@homepage';
>>> }
>>> 
>>> sfContext::getInstance()->getController()->redirect($ref);
>>> // TODO how to submit the invoker-values to 
>>> the form??
>>> die(); // cancel current route-execution
>>> }
>>> }
>>> }
>>
>>> }
>>
>>> This is very dirty and I don't know how to write this behavior in a
>>> better / cleaner way.
>>
>>> Any help would be appreciated.
>>
>>> Comb
>>
>>> On 27 Mai, 16:46, Daniel Lohse  wrote:
>>
 http://www.doctrine-project.org/projects/orm/1.2/docs/manual/event-li...
>>
 scroll down a little bit to the line: $event->skipOperation();
>>
 This should do what you want?
>>
 Daniel
>>
 On 27.05.2010, at 16:41, comb wrote:
>>
> Hey thanks, but it does not work :-(
> class FloodCheckListener extends Doctrine_Record_Listener
> {
>//...
>public function preInsert(Doctrine_Event $event)
>{
>return false;
>}
> }
> The record is saved anyway.
>>
> On 27 Mai, 16:26, Robert Schoenthal  wrote:
>> he,
>>
>> try to "return false" in your preInsert Method, it think it should
>> work
>>
>> On May 27, 12:39 am, comb  wrote:
>>
>>> Hi,
>>
>>> i'm writing a CheckFloodable-Behavior.
>>> Before a new record is saved, I would like to prevent the insertion of
>>> the new record if the user did not wait long enough.
>>> It's very dirty since I use the sfContext::getInstance() quite much,
>>> but my 

Re: [symfony-users] Templates in a single directory

2010-05-17 Thread Georg Gell
It might be worth looking into using your own view class:
something along

class myView extends sfPHPView {
  public function setDirectory($directory){
$this->directory = $directory . '/theme'; //whatever, must be full path
  }
}

and in filters.yml
rendering:
  class: myView

But then caching will probably not differentiate between the themes, but
that would be the next step ;-)

Am 16.05.2010 19:53, schrieb Davide Borsatto:
> Hi everybody,
> 
> for the project I've been working on I need to be able to define
> multiple themes.
> With "theme" I mean the full thing, including php code for the
> templates, images, stylesheets and javascripts too.
> 
> But symfony templates structure is not quite friendly for this kind of
> operation, since we have files on
> 
> - apps/frontend/templates/
> - apps/frontend/modules/*/templates/
> - web/images
> - web/css
> - web/js
> 
> Which is not a good solution to mantain.
> My idea was to package themes in the "data" directory, creating
> something like
> 
> - data
> -- themes
> --- default
>  css
>  js
>  images
>  templates
>  modules
> - module1
> - module2
> 
> Basically I need to be able to put every file needed in a single
> directory (like most CMS do).
> 
> Since the data dir is not world wide accessible, I thought about
> creating a task that creates symlinks in the web directory, so this
> problem is easily solved.
> 
> Now about the PHP files: what's the best solution to handle this?
> I think I have two choices:
> 1 make symfony look into the right directories, creating custom view
> and partial classes
> 2 making the apps/frontend/templates and apps/frontend/modules/*/
> templates symlink to the directory theme
> 
> I like more the first solution, but after a while looking in the
> symfony core I still can't figure out how to "redirect" all paths to
> the theme dir. Setting the global layout is as easy as doing
> 
> sfConfig::set('sf_app_template_dir', $themeDir . '/templates')
> 
> But module templates are a bit harder to configure. Actually, I still
> don't know how to do that :)
> 
> So this is my question: which one is the best approach? I'd rather not
> have symlinks all over my project, but that seems to be the easiest
> solution (one console task to handle everything, no symfony classes to
> override, no risks to forget about this or that...).
> 

-- 
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] a question about routing framework :P

2010-04-01 Thread Georg Gell
try to put something like this in routing.yml

auckland:
  options: { segment_separators: [/, ., -] }


Am 01.04.2010 08:39, schrieb Lee Joseph:
> as I know routing framework in symfony which separates url information
> with slash '/'  or dot '.' like
> 
> some_route:
>   url:  /:module/:actions/:id
> 
> 
> I just want know is there anything I can do to make some Url like
> .com/auckland/module-action-id
> 

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


Re: [symfony-users] Symfony License issue

2010-03-15 Thread Georg Gell
Hi,

checkout symfony and execute
>find . -name 'LICENSE*'
in it's folder.

Am 13.03.2010 10:29, schrieb Avinash:
> Hi There,
> 
> I am not sure if this is right place, but I need to clear my doubt
> that if i can create a symfony based product for selling instances to
> clients without paying to any one or there is any paid version of
> symfony framework.
> I do have gone through licenses posted on http://www.symfony-project.org/
> at multiple locations including CCPL (the most confusing one) but
> still not clear with legality.
> Or let me know where I should see.
> Please 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


Re: [symfony-users] Slow template rendering

2010-01-28 Thread Georg Gell
Axel,

is it possible that the creation of the user objects takes such a long
time? I don't know what your user objects do, or how many are in this
list, but just for displaying the names of the users, I wouldn't
create objects, but hydrate with Doctrine_Core::HYDRATE_SCALAR.
Try if this works more quickly:

set up this method in your Event object:

class Event extends BaseEvent{
...
public function getUserListAsArray()
{
  return Doctrine::getTable('Users')->createQuery()->where('event_id =
?', $this->id)->execute(array(), Doctrine_Core::HYDRATE_SCALAR);
}

and in the template:

getUserListAsArray() as $user){
echo <<
  {$user['firstname']} {$user['lastname']}

EOT;
} ?>

Does this solve your speed problem?

Georg

Am 27.01.2010 19:58, schrieb axel at:
> hello list,
> 
> symfony seems to be extrem slow - compared to "native" php
> a request with the following code takes ~26 seconds (count($event-
>> getUserList()) == 5000)
> 
> getUserList() as $user):  ?>
>
>   getFirstname(). " ". $user->getLastname
> (); ?>
> 
>  
> 
> type  calls   time (ms)   time (%)
> Configuration 13  1932.20 7
> Factories 1   361.77  1
> Database (Doctrine)   8   0.060
> Action "event/listAction" 1   19.53   0
> View "Success" for "event/listAction" 1   25653.2093
> Partial "event/_assets"   1   1.410
> Partial "event/_flashes"  1   5.310
> Component "address/menuItems" 1   68.60   0
> Partial "address/_menuItems"  1   3.230
> Component "address/loginState"1   0.060
> Partial "address/_loginState" 1   2.060
> 
> the doctrine database query is ok
> I don't think that the templating is the problem, (I tried to do the
> output with echo $user->... from within the action what took as long
> as if I used the template engine. for me it seems to be a doctrine
> problem (foreach...?)
> 
> is there a way to improove this poor results?
> 

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

2010-01-21 Thread Georg Gell
This happens sometimes when you have a fatal php error in the template
(or a method called from the template)

Am 21.01.2010 17:24, schrieb Pax95:
> I've installed a project in my local server - WampServer and it works
> successfully. I added test content and uploaded it into server
> (www.linuxpl.com) and it doesn't show anything.
> 
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] URGENT: default_messages translation

2010-01-20 Thread Georg Gell
Am 19.01.2010 14:40, schrieb diogobaeder:
> Hi, guys,
> 
> I've posted this one:
> http://groups.google.com/group/symfony-users/browse_thread/thread/5432958e71a54747/76035d6987e00ad8?lnk=gst&q=diogobaeder#76035d6987e00ad8
> 
> But I haven't found a solution, yet. The problem is, I have to deliver
> the website for my client, and he's complaining that part of the
> interface is still in English.
> 
> What do you recommend me to do? Create Symfony patches in order to
> give support for these changes? Or is there a way to translate it,
> already?
> 
> Thanks!
> 

I think you should ask this question on the symfony-devs list. IMO your
translation efforts should not be wasted on local patches, but made
available to the community.
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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: sfDoctrineGuard is killing me

2010-01-11 Thread Georg Gell
This is a mysql specific error, because mysql only allows 64 bytes
length (http://dev.mysql.com/doc/refman/5.0/en/identifiers.html). It
seems that the SQL standard defines 128 bytes (
http://bugs.mysql.com/bug.php?id=13942)
I think you should file a bug report for doctrine.

Am 12.01.2010 00:31, schrieb Mike Church:
> 
> 
> On Jan 11, 12:30 pm, Georg Gell  wrote:
>> probably the key name is too long. Try if this works:
>> ALTER TABLE sf_guard_group_permission ADD CONSTRAINT
>> g FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id)
>>
>> Am 11.01.2010 07:54, schrieb Mike Church:
>>
> 
> Wow!
> 
> Thank you mysql for not telling me that there is a limit to the name
> of a FK CONSTRAINT!!
> 
> Thank you Georg.
> 
> I will look into getting the sfDoctrineGuard plug in maintainers to
> change it.
> 
> Any suggestions on how I can change it?  Editing data/sql/schema.sql
> and doing ./symfony doctrine:insert-sql doesn't do it.  Is the schema
> coming from somewhere else and merged into ata/sql/schema.sql during
> the insert?  When I change the CONSTRAINTS to much shorter versions,
> the do the SQL manually, it works.
> 
> 
> 
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] sfDoctrineGuard is killing me

2010-01-11 Thread Georg Gell
probably the key name is too long. Try if this works:
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT
g FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id)

Am 11.01.2010 07:54, schrieb Mike Church:
> Hi Folks:
> 
> I have been trying to deploy, I have everything working right locally.
> 
> Now without implying I've tried everything I can tell you all that I
> am at the end of my rope.  When I use the svn version of
> sfDoctrineGuard from:
> 
> http://svn.symfony-project.com/plugins/sfDoctrineGuardPlugin/trunk
> (currently revision 26468)
> 
> and symfony 1.4
> 
> Then do a
> 
> ./symfony doctrine:build --all --env=prod
> 
> I get:
> 
> SQLSTATE[HY000]: General error: 1005 Can't create table './quicksand-
> staging/#sql-899_274.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)". 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)
> 
> Any ideas?  I'm using integer(4) for any fields holding sfGuardUser
> ids (which fixed it when I was using 1.2 - and was a major pain and
> took a long time to find).  I tried straight integer as well.
> 
> This is a constraint inside the sfDoctrineGuard plugin, isn't it?
> 
> And yes, I'm clearing the cache. Etc.  Is there a special unblemished
> version of sfDoctrineGuard I need to use?
> 
> It burns me that it runs locally.  Actually, kills me.
> 
> Thanks for any input.
> 
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] Offbeat: open source vs closed source technologies

2010-01-08 Thread Georg Gell


Am 08.01.2010 15:20, schrieb Lee Bolding:
> 
> On 8 Jan 2010, at 13:43, Eno wrote:
> 
>> On Fri, 8 Jan 2010, Lee Bolding wrote:
>>
>>> The whole IIS/windows server licensing issue is also beginning to  
>>> disappear - if you want a well supported, enterprise grade, stable and  
>>> scalable PHP environment, you'll likely want Zend Server - which costs  
>>> around the same as a Windows Server license. Apache, lighttp, nginx  
>>> etc are all free, but who actually supports them? If your server goes  
>>> bump in the night, who you gonna call?
>>
>> We have our own support team to call :-)
> 
> Yes, but a salaried employee is more expensive than raising a ticket on a 
> case-by-case basis with the likes of Zend (or buying a support contract to 
> begin with)
> 
The funny thing is that the Zend server consists mainly of OS software,
apache, mysql and php. This shows how to earn money with OS, package OS,
optimize it and sell it as a CS package with support.
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] Offbeat: open source vs closed source technologies

2010-01-08 Thread Georg Gell
Hi,

Am 08.01.2010 09:46, schrieb Parijat Kalia:
> Hey guys,
> 
> Just lighting up everyone's day, would like to get as many as possible
> arguments on this. Me and a friend of mine, had a debate last evening,
> about open source(PHP) vs closed source technologies(DOT NET).He raised
> the following points:
> 
> 1. He feels that open source is not reliable whereas closed source is.
> The logic being that, once the application is developed and sold, if it
> runs into some kind of a bug or an error, there is support team for
> closed source technologies who are going to come and help you fix it,
> whereas this is not a guarantee in open source technologies.

Depends.
Why do you think there are more apache servers than iis servers on the
web? Because they are more reliable and cheaper, and they have a large
user base that will help you out for free.
Firefox vs IE? Judge for yourself.
PHP vs .Net? I think it will take a long time to get a bug fixed in both
of them, you will rather do a work around. Where in both products the
community will help. But with .Net you can also ask MS.

> 
> 2. Development for a successful open source technology is community
> dependent, implying the choice is still on a faithful group of users,
> whereas in closed source technologies it is more reliable because it is
> being backed by a company (microsoft for .NET and SAP for SAP).

Hmm, IMO the costs are lower in some cases. Because all major OS
products are quite stable and have a very good QMS.
Take for example symfony: In his post
http://www.mail-archive.com/symfony-d...@googlegroups.com/msg05854.html
Fabien complains that nobody pays for symfony support.
[quote]
Keep in mind that symfony is an Open-Source project, so everybody can
contribute and scratch its itch. The core developers and all plugin
developers are all working for free. Of course, Sensio sponsors the
framework, of course it dedicates a lot of time and money to it, and of
it can even provide extended support for all versions for companies
willing to pay. And do you know how many companies, except Sensio
customers, signed up for extended support in the last 2 years? None!
Yep, that's right, not a single one.[/quote]

This shows that all developers using symfony think it is cheaper to ask
the community then to pay for support.
If you want to make a choice in a real case, try to calculate the TCO.

>  3. The third point that was raised is, closed source technologies
> enforce quality control as opposed to open source technologies, where
> the onus on quality control in case of the latter, is more on the
> developer himself.

See above.

> The reasoning I could offer was that big companies such as Yahoo (
> symfony), facebook (php), and Twitter (rails) rely on open source
> technologies, surely they are aware of the above points but still choose
> to go with open source rather than closed source technologies. Money is
> not the most important criteria for these companies, and there
> definitely is a better reason why they choose open rather than closed
> source technologies.  

I think most people decide for OS because
* they like the idea of OS
* it is cheaper
* if they really need additional functionality, they can add it (by
themselves or other developers) without having to wait for Godot
* the product has a big community to ask

Decisions to use CSs are based on
* they need/want professional support
* it is cheaper
* the product is developed for a company that uses CSs only

And then there is the middle, usage of open source with professional
support, like mysql offers.



> However, it is still not convincing me for I found myself agreeing to
> the points my friend raised in favor of closed source technologies. Can
> anyone shed a light on this?
> 
> Thanks!!!
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] admin generator, change redirect target after create/update

2009-12-21 Thread Georg Gell
No, we can't. The exception is thrown after response::send() is executed :-(


Am 20.12.2009 19:34, schrieb Alexandre Salomé:
> The exception is thrown by the redirect method, to stop any execution.
> 
> So when the exception is thrown, you form was already saved.
> 
> The real question is "can we over-redirect" ?
> 
> 
> 2009/12/20 Georg Gell mailto:geor...@have2.com>>
> 
> Hi,
> 
> no, this will not work, because I want to change the redirect after the
> form has been successfully processed, which means no exception to catch.
> 
> Georg
> 
> Am 19.12.2009 22:54, schrieb Alexandre Salomé:
> > Hi,
> >
> >   You can wrap the function in a try...catch block and do your stuff :
> >
> > public function processForm()
> > {
> >   try
> >   {
> > parent::processForm();
> >   }
> >   catch (sfStopException $e)
> >   {
> > $this->redirect(...);
>     >   }
> > }
> >
> >
> > Not sure if this will work... Try and tell us.
> >
> > Alexandre
> >
> > 2009/12/19 Georg Gell  <mailto:geor...@have2.com> <mailto:geor...@have2.com
> <mailto:geor...@have2.com>>>
> >
> > Hello,
> >
> > I would like to change the target of the redirect in an auto
> generated
> > admin form, after the object is saved.
> > This target is hard coded in processForm() in the base action.
> Is there
> > an easier way then copying the whole processForm() method into the
> > action, and then change only the target (40 lines DoRY).
> >
> > Thanks Georg
> 
> --
> 
> 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
> <mailto:symfony-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> <mailto:symfony-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> 
> 
> 
> 
> 
> -- 
> Alexandre Salomé
> http://alexandre-salome.fr
> 
> --
> 
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-us...@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.

--

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

2009-12-20 Thread Georg Gell
You might use a virtual server.
I have a virtual ubuntu server in a vbox with bridged network.
So it has it's own network address and can be reached from the whole
network, and the source code is on a shared windows directory mounted by
smbfs. I used vboxsf for mounting the share, but had some troubles with it.
This way you can perform symfony commands both on windows and on ubuntu,
doing exactely the same thing.
And you can edit the files locally from Netbeans, and even debug the
files step by step on the server from within Netbeans.
You have to patch two symfony files for this to work, i have attached
patches. The first removes a warning by php, that it cannot chmod on
remote filesystems. The other doesn't create symlinks, but copies the
directories, which is the normal behaviour for windows. Now symfony
tasks behave the same way in windows and ubuntu environment, afaik.

Georg

Am 20.12.2009 15:57, schrieb HiDDeN:
> Hey guys. How is your development infrastructure?
> 
> I like to develop against a Linux machine. I create my symfony project
> there and then with Eclipse PDT + Remote System Explorer I edit the
> files remotely.
> 
> Now I discovered Netbeans 6.8 with PHP + Symfony support natively,
> it's smaller and faster, but it hasn't support for remote editing. The
> only thing it has is downloading everything to local.
> 
> 
> Do you have any tips you would like to share?
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "symfony users" group.
> To post to this group, send email to symfony-us...@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.
> 
> 
> 

--

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


Index: sfConfigCache.class.php
===
--- sfConfigCache.class.php (revision 25402)
+++ sfConfigCache.class.php (working copy)
@@ -362,7 +362,7 @@
   }
 }
 
-chmod($cache, 0666);
+@chmod($cache, 0666);
 umask($current_umask);
   }
 
Index: sfFilesystem.class.php
===
--- sfFilesystem.class.php  (revision 25402)
+++ sfFilesystem.class.php  (working copy)
@@ -198,12 +198,12 @@
*/
   public function symlink($originDir, $targetDir, $copyOnWindows = false)
   {
-if (!function_exists('symlink') && $copyOnWindows)
-{
+//if (!function_exists('symlink') && $copyOnWindows)
+//{
   $finder = sfFinder::type('any');
   $this->mirror($originDir, $targetDir, $finder);
   return;
-}
+//}
 
 $ok = false;
 if (is_link($targetDir))


Re: [symfony-users] admin generator, change redirect target after create/update

2009-12-20 Thread Georg Gell
Hi,

no, this will not work, because I want to change the redirect after the
form has been successfully processed, which means no exception to catch.

Georg

Am 19.12.2009 22:54, schrieb Alexandre Salomé:
> Hi,
> 
>   You can wrap the function in a try...catch block and do your stuff :
> 
> public function processForm()
> {
>   try
>   {
> parent::processForm();
>   }
>   catch (sfStopException $e)
>   {
> $this->redirect(...);
>   }
> }
> 
> 
> Not sure if this will work... Try and tell us.
> 
> Alexandre
> 
> 2009/12/19 Georg Gell mailto:geor...@have2.com>>
> 
> Hello,
> 
> I would like to change the target of the redirect in an auto generated
> admin form, after the object is saved.
> This target is hard coded in processForm() in the base action. Is there
> an easier way then copying the whole processForm() method into the
> action, and then change only the target (40 lines DoRY).
> 
> Thanks Georg

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] admin generator, change redirect target after create/update

2009-12-19 Thread Georg Gell
Hello,

I would like to change the target of the redirect in an auto generated
admin form, after the object is saved.
This target is hard coded in processForm() in the base action. Is there
an easier way then copying the whole processForm() method into the
action, and then change only the target (40 lines DoRY).

Thanks Georg

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] OT: Create PHPCod comments automatically

2009-12-17 Thread Georg Gell
Cool!

Thanks Georg

Am 17.12.2009 09:45, schrieb Christopher Schnell:
> NetBeans does that. all you have to do is to add /** above the method 
> and press enter. It can also handle type-hinting.
> 
> Regards,
> Christopher.
> 
> Georg Gell schrieb:
>> Hello list,
>>
>> just a quick OT post:
>>
>> I am looking for a way to auto add auto prefilled PHPDoc comments on my
>> PHP files.
>> For example if I have a method like this:
>>
>> public function doSomething($var){
>>
>> then it should add above (if no PHPDoc comment is already existing)
>>
>> /**
>> * doSomething
>> *
>> * @author Me
>> * @param $var
>> * @return
>> *
>> */
>>
>> Even better if the content of the created PHPDocs could be configured. I
>> was using PHPEdit once, and this IDE had that kind of functionality, but
>> I am missing it in Netbeans.
>>
>> How do you add those PHPDocs?
>>
>> Thanks
>> Georg
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups 
>> "symfony users" group.
>> To post to this group, send email to symfony-us...@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.
>>
>>
>>
>>   
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "symfony users" group.
> To post to this group, send email to symfony-us...@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.
> 
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] OT: Create PHPCod comments automatically

2009-12-17 Thread Georg Gell
Hello list,

just a quick OT post:

I am looking for a way to auto add auto prefilled PHPDoc comments on my
PHP files.
For example if I have a method like this:

public function doSomething($var){

then it should add above (if no PHPDoc comment is already existing)

/**
* doSomething
*
* @author Me
* @param $var
* @return
*
*/

Even better if the content of the created PHPDocs could be configured. I
was using PHPEdit once, and this IDE had that kind of functionality, but
I am missing it in Netbeans.

How do you add those PHPDocs?

Thanks
Georg

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] problem with functional test for upload

2009-12-11 Thread Georg Gell
Hi,

I don't really understand what you mean that I should so.
I understand that the 'file' parameter is not empty, because I am trying
to upload a file. But it shouldn't be a path either IMO, I just used
this test to show the value of the 'file' parameter, which is not a
file, but a path.
The real problem is the second test, where the sfFileValidator complains
about the missing file.

Georg

Am 11.12.2009 13:36, schrieb Alexandru-Emil Lupu:
> Check your
> IsParameter('file','')
> The test expects no file but you send one... so the file parameter is
> not empty.
> 
> sent via htc magic
> 
>> On Dec 11, 2009 2:01 PM, "Georg Gell" > <mailto:geor...@have2.com>> wrote:
>>
>> Hello,
>>
>> I have an action that accepts file uploads from a desktop program.
>> I use a form for validation (see below) and if the form is valid, I
>> process the uploaded files(see action below). This works as expected.
>>
>> But the functional tests (see below) do not upload any file (result see
>> below, result 37 shows, that no file is uploaded, but only the path, and
>> 39 shows that the sfFileValidator complains that the file is required).
>>
>> I checked the docs, but I only found this
>> (http://www.symfony-project.org/jobeet/1_4/Doctrine/en/11): "The browser
>> also simulates file uploads if you pass the absolute path to the file to
>> upload." which either I don't understand or doesn't work.
>>
>> Has anyone done file uploads in a functional test, and how?
>>
>> Thanks
>> Georg
>>
>> my functional test:
>> __
>> $in2 = array('path' => '/path',
>>  'md5' => 'e1aab77d216d8ad97ff143823a75038e',
>>  'ci' => '0123456789abcdef0123456789abcdef',
>>  'file' =>
>> '/var/www/shared/appxxx/test/fixtures/testdata/images/IMG_0283.JPG');
>>
>> $browser = new sfTestFunctional(new sfBrowser());
>> $browser->
>> //...
>> info('post remote/upload - returns OK')->
>>  post('http://client.virtual/remote/upload', $in2)->
>>  with('request')->begin()->
>>isParameter('module', 'remote')->
>>isParameter('action', 'upload')->
>>isParameter('ci', '0123456789abcdef0123456789abcdef')->
>>isParameter('md5', 'e1aab77d216d8ad97ff143823a75038e')->
>>isParameter('path', '/path')->
>>isParameter('file', '')->
>>  end()->
>>  with('response')->begin()->
>>isStatusCode(200)->
>>matches('#OK#')->
>>  end();
>> __
>>
>> the validation form:
>> __
>> class UploadForm extends BaseForm {
>>
>> public function configure() {
>>  $this->setValidators(array(
>>'ci' => new sfValidatorString(array('max_length' => 32, 'min_length'
>> => 32)),
>>'path' => new sfValidatorDoctrineChoice(array('model' => 'Path',
>> 'column' => 'path')),
>>'md5' => new sfValidatorString(array('max_length' => 32,
>> 'min_length' => 32)),
>>'file' => new sfValidatorFile(array('max_size' => 20,
>> 'mime_types' => 'web_images')),
>>  'module' => new sfValidatorPass(),
>>  'action' => new sfValidatorPass(),
>> ));
>>   $this->disableLocalCSRFProtection();
>>  }
>> }
>> __
>>  and the action looks like this:
>> __
>> public function executeUpload(sfWebRequest $request) {
>>  if ($request->isMethod('post')) {
>>  $this->form = new UploadForm();
>>  $this->form->bind($request->getParameterHolder()->getAll(),
>> $request->getFiles());
>>  if ($this->form->isValid()) {
>>// to something
>>return $this->renderText('OK');
>>  } else {
>>$result = 'ERROR: ';
>>foreach($this->form->getErrorSchema()->getErrors() as $k => $error) {
>>  $result .= "\n$k: " . $error->getMessage();
>>}
>>return $this->renderText($result);
>>  }
>> }
>> return $this->renderText('ERROR Invalid method');

[symfony-users] problem with functional test for upload

2009-12-11 Thread Georg Gell
Hello,

I have an action that accepts file uploads from a desktop program.
I use a form for validation (see below) and if the form is valid, I
process the uploaded files(see action below). This works as expected.

But the functional tests (see below) do not upload any file (result see
below, result 37 shows, that no file is uploaded, but only the path, and
39 shows that the sfFileValidator complains that the file is required).

I checked the docs, but I only found this
(http://www.symfony-project.org/jobeet/1_4/Doctrine/en/11): "The browser
also simulates file uploads if you pass the absolute path to the file to
upload." which either I don't understand or doesn't work.

Has anyone done file uploads in a functional test, and how?

Thanks
Georg

my functional test:
__
$in2 = array('path' => '/path',
  'md5' => 'e1aab77d216d8ad97ff143823a75038e',
  'ci' => '0123456789abcdef0123456789abcdef',
  'file' =>
'/var/www/shared/appxxx/test/fixtures/testdata/images/IMG_0283.JPG');

$browser = new sfTestFunctional(new sfBrowser());
$browser->
//...
info('post remote/upload - returns OK')->
  post('http://client.virtual/remote/upload', $in2)->
  with('request')->begin()->
isParameter('module', 'remote')->
isParameter('action', 'upload')->
isParameter('ci', '0123456789abcdef0123456789abcdef')->
isParameter('md5', 'e1aab77d216d8ad97ff143823a75038e')->
isParameter('path', '/path')->
isParameter('file', '')->
  end()->
  with('response')->begin()->
isStatusCode(200)->
matches('#OK#')->
  end();
__

the validation form:
__
class UploadForm extends BaseForm {

public function configure() {
  $this->setValidators(array(
'ci' => new sfValidatorString(array('max_length' => 32, 'min_length'
=> 32)),
'path' => new sfValidatorDoctrineChoice(array('model' => 'Path',
'column' => 'path')),
'md5' => new sfValidatorString(array('max_length' => 32,
'min_length' => 32)),
'file' => new sfValidatorFile(array('max_size' => 20,
'mime_types' => 'web_images')),
  'module' => new sfValidatorPass(),
  'action' => new sfValidatorPass(),
 ));
   $this->disableLocalCSRFProtection();
  }
}
__
 and the action looks like this:
__
public function executeUpload(sfWebRequest $request) {
  if ($request->isMethod('post')) {
  $this->form = new UploadForm();
  $this->form->bind($request->getParameterHolder()->getAll(),
$request->getFiles());
  if ($this->form->isValid()) {
// to something
return $this->renderText('OK');
  } else {
$result = 'ERROR: ';
foreach($this->form->getErrorSchema()->getErrors() as $k => $error) {
  $result .= "\n$k: " . $error->getMessage();
}
return $this->renderText($result);
  }
}
return $this->renderText('ERROR Invalid method');
}
__
and the test result:
__
not ok 37 - request parameter file is ""
# Failed test
(./lib/vendor/symfony/lib/test/sfTesterRequest.class.php at line 48)
#got:
'/var/www/shared/appxxx/test/fixtures/testdata/images/IMG_0283.JPG'
#   expected: ''
ok 38 - status code is 200
not ok 39 - response content matches regex #OK#
# Failed test
(./lib/vendor/symfony/lib/test/sfTesterResponse.class.php at line 383)
# 'ERROR:
file: Required.'
#   doesn't match '#OK#'

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] token ##PACKAGE## in sf1.4 base model classes should be replaced by?

2009-12-07 Thread Georg Gell
Oh, I thought that I could just edit properties.ini and append a line
with email:john@example.com, I didn't know that the possible
settings are predefined.

Thanks for the explanation

Georg

Jonathan Wage schrieb:
> I don't think properties.ini has an e-mail property? I am not sure. That
> would be a question for Kris, I am not sure.
> 
> - Jon
> 
> On Mon, Dec 7, 2009 at 2:56 PM, Georg Gell  <mailto:geor...@have2.com>> wrote:
> 
> Yes, svn update, symfony doctrine:build --all-classes and it is working
> out of the box. Thanks a lot for your work.
> Just out of curiosity, what is the reason why ##EMAIL## is not parsed
> out of properties.ini, or rather not at all ATM?
> 
> Georg
> 
> Jonathan Wage schrieb:
> > This is fixed now in SVN and the values come from the
> properties.ini file.
>     >
> > - Jon
> >
> > On Thu, Dec 3, 2009 at 4:15 PM, Georg Gell  <mailto:geor...@have2.com>
> > <mailto:geor...@have2.com <mailto:geor...@have2.com>>> wrote:
> >
> > Hi,
> >
> > the following tokens can be found in the autogenerated base model
> > classes in sf 1.4.
> >  * @package##PACKAGE##
> >  * @subpackage ##SUBPACKAGE##
> >  * @author ##NAME## <##EMAIL##>
> > Is there a way to replace them by real values? Or are they
> placeholders
> > for future use?
> >
> > TIA Georg
> >
> > --
> >
> > 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 <mailto:symfony-users@googlegroups.com>
> > <mailto:symfony-users@googlegroups.com
> <mailto:symfony-users@googlegroups.com>>.
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com
> <mailto:symfony-users%2bunsubscr...@googlegroups.com>
> > <mailto:symfony-users%2bunsubscr...@googlegroups.com
> <mailto:symfony-users%252bunsubscr...@googlegroups.com>>.
> > For more options, visit this group at
> > http://groups.google.com/group/symfony-users?hl=en.
> >
> >
> >
> >
> >
> > --
> > Jonathan H. Wage (+1 415 992 5468)
> > Open Source Software Developer & Evangelist
> > sensiolabs.com <http://sensiolabs.com> <http://sensiolabs.com> |
> jwage.com <http://jwage.com> <http://jwage.com> |
> > doctrine-project.org <http://doctrine-project.org>
> <http://doctrine-project.org> | symfony-project.org
> <http://symfony-project.org>
> > <http://symfony-project.org>
> >
> > You should follow me on Twitter: http://www.twitter.com/jwage
> >
> > You can contact Jonathan about Doctrine, Symfony and Open-Source
> or for
> > training, consulting, application development, or business related
> > questions at jonathan.w...@sensio.com
> <mailto:jonathan.w...@sensio.com> <mailto:jonathan.w...@sensio.com
> <mailto:jonathan.w...@sensio.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 <mailto:symfony-users@googlegroups.com>.
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com
> <mailto:symfony-users%2bunsubscr...@googlegroups.com>.
> > For more options, visit this group at
> > http://groups.google.com/group/symfony-users?hl=en.
> 
> --
> 
> 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
> <mailto:symfony-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> <mailto:symfony-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> 
> 
> 
> 
> 
> -- 
> Jonathan H. Wage (+1 415 992 5468)
> Open Source Software Developer & Evangelist
> sensiolabs.com <http://sensiolabs.com> 

Re: [symfony-users] token ##PACKAGE## in sf1.4 base model classes should be replaced by?

2009-12-07 Thread Georg Gell
Yes, svn update, symfony doctrine:build --all-classes and it is working
out of the box. Thanks a lot for your work.
Just out of curiosity, what is the reason why ##EMAIL## is not parsed
out of properties.ini, or rather not at all ATM?

Georg

Jonathan Wage schrieb:
> This is fixed now in SVN and the values come from the properties.ini file.
> 
> - Jon
> 
> On Thu, Dec 3, 2009 at 4:15 PM, Georg Gell  <mailto:geor...@have2.com>> wrote:
> 
> Hi,
> 
> the following tokens can be found in the autogenerated base model
> classes in sf 1.4.
>  * @package##PACKAGE##
>  * @subpackage ##SUBPACKAGE##
>  * @author ##NAME## <##EMAIL##>
> Is there a way to replace them by real values? Or are they placeholders
> for future use?
> 
> TIA Georg
> 
> --
> 
> 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
> <mailto:symfony-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> <mailto:symfony-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> 
> 
> 
> 
> 
> -- 
> Jonathan H. Wage (+1 415 992 5468)
> Open Source Software Developer & Evangelist
> sensiolabs.com <http://sensiolabs.com> | jwage.com <http://jwage.com> |
> doctrine-project.org <http://doctrine-project.org> | symfony-project.org
> <http://symfony-project.org>
> 
> You should follow me on Twitter: http://www.twitter.com/jwage
> 
> You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> training, consulting, application development, or business related
> questions at jonathan.w...@sensio.com <mailto:jonathan.w...@sensio.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-us...@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.

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] check in model class if it is used from doctrine:data-load task

2009-12-07 Thread Georg Gell
Hi,

interesting approach, thanks, I would never have thought of this :-/
Is there a way to implement the creation of the fictive is_import column
automatically in the dump when doing the task doctrine:data-dump?

Georg

Alexandre Salomé schrieb:
> You shouldn't handle the question like this...
> 
> A proper way :
> 
> In your fixtures, add a fictive column : "is_import"
> 
> For example :
> 
> myModel:
>   mm_01:
> name: Bobby
> is_active: true
> is_import: true
> 
> 
> In your class, add :
> 
> protected $isImport = false;
> 
> public function setIsImport($value)
> {
>   $this->isImport = $value;
> }
> 
> 
> And in your postInsert, just test :
> 
> if ($this->isImport)
> {
>   // your stuff
> }
> 
> 
> Nicest way,
> 
> Alexandre
> 
> 2009/12/4 Georg Gell mailto:geor...@have2.com>>
> 
> Hello group,
> 
> how can I check in a model class if the class is used from the
> doctrine:data-load task instead from the normal application?
> 
> Example model "Model"
> 
> class Model extends BaseModel
> {
> public function postInsert($event)
> {
> if (not in "symfony doctrine:data-load"){
> //do some wild things that don't need to be done for each reload
> }
> }
> }
> 
> Thanks a lot
> Georg
> 
> --
> 
> 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
> <mailto:symfony-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> <mailto:symfony-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> 
> 
> 
> 
> 
> -- 
> Alexandre Salomé -- alexandre.sal...@gmail.com
> <mailto:alexandre.sal...@gmail.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-us...@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.

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] check in model class if it is used from doctrine:data-load task

2009-12-04 Thread Georg Gell
Hello group,

how can I check in a model class if the class is used from the
doctrine:data-load task instead from the normal application?

Example model "Model"

class Model extends BaseModel
{
public function postInsert($event)
{
if (not in "symfony doctrine:data-load"){
//do some wild things that don't need to be done for each reload
}
}
}

Thanks a lot
Georg

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] Where to put the logic?

2009-12-04 Thread Georg Gell
Hi Stéphane,

I don't understand what you mean.

To clarify:
I would like to put the business logic in the model. The business logic
states in my case that no "Client" object can be without a "User" object.

Following this reasoning, I added a postInsert() method in the "Client"
object, that creates a "User" object. IMO the only way to make sure that
no "Client" objects without a defined state can exist (ie without a
"User" object).
This works like expected in my applications, the "Client" object and all
related objects (ie it's "User" object, ...) are always in a defined
state after creation, no matter where they are created.

The problem starts when I try to reset my database for unit tests. If I
use the task doctrine:data-load, an unwanted (at least by me ;-)) side
effect happens.
doctrine:data-load first inserts the "Client" object, and this triggers
the postInsert() logic, creating a new "User" object implicitly. And
then doctrine:data-load continues with inserting the "User" object that
the "Client" object already had a the time when I created the fixture.

The result is that the doctrine:data-load task changes the content of
the database in one doctrine:data-dump and doctrine:data-load cycle
(adding an additional "User" object).
This means I am not able to unit test my model or to test any
application logic, because I cannot load clean data in the database for
each test.
There is already a ticket for this:
http://trac.symfony-project.org/ticket/5799
but it was set to invalid.

I see the following solutions to get doctrine:data-load to work with my
business logic. I am rather not a symfony expert, I hope I am missing
something obvious, and I just didn't find it in the docs. This also
explains the email's subject "Where to put the logic":
* Move the business logic to the controllers: In this case
doctrine:data-load would not trigger the creation of a "User" object for
each new "Client" object that is saved, because it is not in the model.
But I would have to make sure that the controller logic is the same
everywhere a "Client" object is created.
* Find a way to check in the postInsert method if I am running from a
doctrine:data-load task, and in this case skip the business logic. IMO
this would add controller logic in the model, but if I could identify
the doctrine:data-load task, this would be my preferred approach.
* To have an argument for the doctrine:data-load task, not to trigger
the doctrine events.
* Did I miss something obvious?

Thanks for reading up to here (in case anyone sees this :-D)

Georg




Stéphane schrieb:
> First, Hello (sorry) :-)
> 
> I was assuming this was happening to one of your class; is this
> happening to all/other classes ?
> 
> Before Printing, Think about Your Environmental Responsibility!
> Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!
> 
> 
> On Thu, Dec 3, 2009 at 10:53 PM, Georg Gell  <mailto:geor...@have2.com>> wrote:
> 
> Where would you register the listener?
> 
> If it is registered in the form action, this would only be an elaborate
> extension of the controller logic: instead of creating the ""Client"" 
> object
> and afterwards the "User" object directly in the controller, I would
> register a listener in the controller that gets called if a ""Client"" is
> created just in this controller action, which is the same.
> 
> If I register it in an application config class, this would lead to
> inconsistent behaviour, because if I create a ""Client"" object in app1, a
> "User" object would be created, and in app2 not.
> 
> This would mean it would have to be registered in the project config.
> And there it would be triggered by the doctrine:data-load task again
> (resulting in double "User"s, see my other post)
> 
> Georg
> 
> Stéphane schrieb:
> > The controller isn't responsible for application logic.
> > It must be in your model (if you can...).
> >
> > For this kind of case, I would prefer playing with events.
> > For example, when "User" is created just dispatch an event like
> > ""User"s."User".new" or whatever sounds like.
> > Then "connect" the app-logic method that add admin-role to "User" using
> > eventdispather.connect( '"User"s."User".new', your class method);
> > This way the method of creating the "User" is strictly "limited" to its
> > area : creating a "User";
>

Re: [symfony-users] Where to put the logic?

2009-12-03 Thread Georg Gell
Where would you register the listener?

If it is registered in the form action, this would only be an elaborate
extension of the controller logic: instead of creating the Client object
and afterwards the User object directly in the controller, I would
register a listener in the controller that gets called if a Client is
created just in this controller action, which is the same.

If I register it in an application config class, this would lead to
inconsistent behaviour, because if I create a Client object in app1, a
User object would be created, and in app2 not.

This would mean it would have to be registered in the project config.
And there it would be triggered by the doctrine:data-load task again
(resulting in double users, see my other post)

Georg

Stéphane schrieb:
> The controller isn't responsible for application logic.
> It must be in your model (if you can...).
> 
> For this kind of case, I would prefer playing with events.
> For example, when user is created just dispatch an event like
> "users.user.new" or whatever sounds like.
> Then "connect" the app-logic method that add admin-role to user using
> eventdispather.connect( 'users.user.new', your class method);
> This way the method of creating the user is strictly "limited" to its
> area : creating a user;
> Then somewhere else (in a dedicated class), write the method which will
> add admin-role to the newly created user (which will be the subject of
> the event).
> Check the doc for more info (event system).
> 
> Before Printing, Think about Your Environmental Responsibility!
> Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!
> 
> 
> On Mon, Nov 30, 2009 at 9:37 PM, Bernhard Schussek  > wrote:
> 
> Hi Georg,
> 
> Why don't you just override the save() method of the Client class? You
> could, for example, check whether any user is associated with the
> client and, if not, do it manually before calling parent::save().
> 
> I personally would prefer to put this logic into the form for creating
> the Client though, because "magic" save-methods can lead to tricky
> problems. Is this an option for you?
> 
> Bernhard
> 
> --
> 
> 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.
> 
> 
> 
> --
> 
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-us...@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.

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] Where to put the logic?

2009-12-03 Thread Georg Gell
Hi Bernhard,

actually I had the logic in a postInsert method of the Client class,
which IMO made the most sense. But this lead to the following surprise:
When I used

$ symfony doctrine:data-load

from a fixture with one client and one user I suddenly ended with two
users instead of one. First data-load inserted the client and triggered
the postInsert event, which created a user. Then data-load continued
with adding a user, and hey presto, suddenly there were two :-(
And I was forced to use mysqldump. I have always wondered why
doctrine:data-load doesn't behave the same way like mysqldump, just dump
and load sql data, which I expected by the name (data-dump and data-load)?

I am forced to go along the controller/form solution, because for the
test cases I need fresh data in the db, and mysqldump is not an option
is this case. But this feels wrong.

Georg

Bernhard Schussek schrieb:
> Hi Georg,
> 
> Why don't you just override the save() method of the Client class? You
> could, for example, check whether any user is associated with the
> client and, if not, do it manually before calling parent::save().
> 
> I personally would prefer to put this logic into the form for creating
> the Client though, because "magic" save-methods can lead to tricky
> problems. Is this an option for you?
> 
> Bernhard
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "symfony users" group.
> To post to this group, send email to symfony-us...@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.
> 
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] token ##PACKAGE## in sf1.4 base model classes should be replaced by?

2009-12-03 Thread Georg Gell
Hi,

the following tokens can be found in the autogenerated base model
classes in sf 1.4.
 * @package##PACKAGE##
 * @subpackage ##SUBPACKAGE##
 * @author ##NAME## <##EMAIL##>
Is there a way to replace them by real values? Or are they placeholders
for future use?

TIA Georg

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] Where to put the logic?

2009-11-30 Thread Georg Gell
Hello,

in my application, I would like to have this logic:

When I add a client, I would like to autmatically add an admin user for
the client. For me this belongs to the client object logic, and I have
put it in postInsert.

But if I use doctrine:data-dump and afterwards doctrine:data-load, I
receive double users (or unique constraint violations), because first a
user is inserted by the client object, and then by doctrine:data-load.

One could argue that the addition of the admin user is not part of the
model logic, but the controller should take care of it.

What is the best way to do this? Is there a way in doctrine to switch of
all pre/post save code for data-load?

Georg

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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] difficulties with doctrine:data-dump in sf1.4

2009-11-23 Thread Georg Gell
Hello,

I have suddenly problems when I try to dump my data.
My model has a listener attached, that changes some queries.
Until now this didn't matter when using doctrine:data-dump. I updated
yesterday to sf 1.4, and now I can't dump the data anymore, because the
listener is executed.
This does not make sense when dumping the data, because the listener is
used for the application to keep certain restraints (which obviously do
not need to be checked when dumping data, because dumping does not
change the data).
How can I get rid of this?

Is there a way to know if the listener is run in a task? Then it could
deactivate itself?

Thanks
Georg

--

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




[symfony-users] Doctrine behaviour adds field, how to get rid of it's validator in auto generated forms in sf 1.3?

2009-11-11 Thread Georg Gell

Dear list,

I have a Doctrine behaviour that sets the correct client id on some
tables on each save, update and select.
The idea is that I put

ActAs: ClientAware

in the schema.yml file for each table that should have a connection to
the client table, and the result would be:

* create a field client_id in the table -> works
* create a relation to the client table with a foreign alias -> works
* always set the right client id -> works
* prevent auto generated forms to display this field -> no idea how
* prevent auto generated forms to validate this not existing field -> no
idea how

What is the best approach for this in Symfony 1.3 aka Doctrine 1.2?

TIA Georg

--~--~-~--~~~---~--~~
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] Doctrine nestedSet delete with application level cascade

2009-11-09 Thread Georg Gell

Is there a way to have a table with the nestedSet behaviour cascade it's
delete on the application level (like cascade: [delete]? I have a file
for each record in the file system that I would like to delete also.

Georg

--~--~-~--~~~---~--~~
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: non ascii chars in Fixtures files

2009-11-06 Thread Georg Gell

Did you save the fixtures file in UTF8?

cosmy schrieb:
> Hi all,
>  do you know a method to load fixtures data without losing chars like
> àèìòù and others?
> It exchanges them with a question mark during the data-load.
> 
> thank you in advance
> > 
> 

--~--~-~--~~~---~--~~
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:data-load error: which table, which field, which value???

2009-11-02 Thread Georg Gell

Sorry, forgot to mention that I am using Doctrine. I am going to upgrade
to symfony 1.3 today, if you can send me your patch I would be grateful.

Thanks Georg

David Ashwood schrieb:
> Assuming you're using Doctrine - which version of symfony are you using?
> I have a small patch for 1.3 that gives more detail for errors that I
> can easily convert to sf 1.2.
> 
> I mentioned the issues with non-verbose error messages in a Doctrine
> ticket recently with data imports and I think it's something in the
> pipeline.
> 
> On Mon, 2009-11-02 at 11:20 +0100, Georg Gell wrote: 
>> Hi,
>>
>> I changed parts of my table definitions to a behaviour, and now
>> doctrine_data-load does not work any more with data, that were
>> previously working.
>> No big problem so far, probably made an error.
>> BUT:
>> The only message I have is this:
>>
>> "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
>> '1' for key 1"
>>
>> This does not help me, because I have no idea what the problem could be.
>> I tried to run symfony with -t option, but this does not help.
>>
>> How can I find out in which table, in which field and which value should
>> be inserted, when the error occured?
>>
>> Thanks in advance
>> Georg
>>
> 
> 
> 
> > 
> 

--~--~-~--~~~---~--~~
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] Doctrine:data-load error: which table, which field, which value???

2009-11-02 Thread Georg Gell

Hi,

I changed parts of my table definitions to a behaviour, and now
doctrine_data-load does not work any more with data, that were
previously working.
No big problem so far, probably made an error.
BUT:
The only message I have is this:

"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
'1' for key 1"

This does not help me, because I have no idea what the problem could be.
I tried to run symfony with -t option, but this does not help.

How can I find out in which table, in which field and which value should
be inserted, when the error occured?

Thanks in advance
Georg

--~--~-~--~~~---~--~~
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] use renderPartial in a filer

2009-10-23 Thread Georg Gell

Hi,

afaik renderPartial is a method of the action. How can I call it in a
filter? Probably through the action stack, but I am too tired to search
through the docs again. Is it it fifo or filo?

TIA
Georg

--~--~-~--~~~---~--~~
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] culture aware sfValidatorNumber, what are you using?

2009-10-07 Thread Georg Gell

In german, a decimal number looks like this: 5,2, not 5.2 like PHP is
expecting.
If a user enters a decimal number in a form, sfValidatorNumber rejects it.
I was expecting sfValidatorNumber to use the user culture to resolve
this, but it does not.
I found an old ticket on trac
(http://trac.symfony-project.org/ticket/4071), but obviously nothing
happened.

What are you doing in this case? Has anybody a culture aware
sfValidatorNumber class?

Georg

--~--~-~--~~~---~--~~
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: if (condition): endif: not working

2009-10-06 Thread Georg Gell

Guessing: you have short_open_tag=1 in php.ini on your pc, but
short_open_tag=0 on your laptop.

Avani schrieb:
> Below is my code
> 
> 
> 
> 345:   
> 346:347:  
> if($show_left_sliding_menu == 'yes' || $module ==
> 'photolibrary' || $module == 'videolibrary'){ ?>
> 348:
> 349: ($tab=="photolibrary"): ?> class="current"  href=" echo url_for('photolibrary/index'.$multimedia_param); ?>">> 
> 351:
> 352: ($tab=="videolibrary"): ?> class="current"  href=" echo url_for('videolibrary/index'.$multimedia_param); ?>"> 353:src="/images/video-app.png" title="Video Library" alt="Video
> Library" />
> 354:
> 355:
> 356:
> 357: 358:  
> if($show_left_sliding_menu == 'yes') { ?>
> 359:
> 360:
> 361:
> 362:
> 363:
> 364:   
> 
> Here, if I delete line 349  to 353, then it is working correctly.
> 
> Dont know why is the problem??
> 
> 
> 
> 
> 
> On Oct 7, 10:05 am, Jeremy Thomerson 
> wrote:
>> Please provide lines 345 - 365 of
>> C:\xampp\htdocs\td\apps\core\templates\layout.php would be helpful.
>>
>> Jeremy
>>
>> On Tue, Oct 6, 2009 at 9:03 PM, Avani  wrote:
>>
>>> Oh sorry, it was typing mistake.
>>> whole project is working in my 1 pc. When I copy the same into my
>>> other pc, it is giving errors
>>> "Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\td\apps
>>> \core\templates\layout.php on line 354"  everywhere where I have
>>> used
>>> 
>>> something
>>> 
>>> On Oct 7, 9:59 am, Sid Bachtiar  wrote:
 It should be:
 
   Hola hola hola
 
 On Wed, Oct 7, 2009 at 2:58 PM, Avani  wrote:
> Hi all,
> I am working on symfony since last 1 month. Yday I just installed
> symfony to my other laptop. I dont know why I am getting errors in my
> templates which works for my pc.
> I am gettting errors everywhere when I used
>  endif: ?>
> if I have used(traditional php syntax)  then it is
> working.
> Can anybody help me?
> Thanks in advance.
 --
 Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz
> > 
> 

--~--~-~--~~~---~--~~
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: Call For Information Re-organization [opinions needed]

2009-09-25 Thread Georg Gell

Hi,

as I am just now developing a symfony application, I will watch myself
how I try to get the information I need and maybe add some suggestions.

In general I would like to say that the symfony documentation is very
comprehensive and well done. Thanks to the symfony team for it. On some
parts the navigation could be improved, because I find myself very often
using google to find the information that is already provided on the site.

Maybe some suggestions that come to my mind right now:
(ref link for all examples:
http://www.symfony-project.org/book/1_2/14-Generators)

There is a search field on the right side of all documentation. AFAIK
this should search in the actual document I am reading.

For me an improvement would be to have the search field on top in the
right column, so I wouldn't have to search for it (see ref link and try
to find the search field).

And IMO the search should not be on the document I am reading only, but
on the whole documentation. The reason for this is, that some infos
probably are not in the document I am reading. For example in the
generator docs (ref link), I read something, and need some info about
the forms used (but they are not in the book, so they will not be
found). And even worse, when I use the navigation links on the right
side, I come to information about form helpers, and how to process a
form, but this is not the way the admin generator works, and now I am
even more confused. But if the search had provided a link to the new
form framework, I would have to read for a day again ;-)

BTW it seems that the search is not working as intended ATM. Go to the
ref link above and enter any term in the search, nothing is found.

I think that the search is well structured on php.net
(http://de.php.net/manual/en/). Here you find the search on top always
in the same place, and you can choose the scope of your search. On
symfony docs, options could be [this document, all documentation, API
documentation, all site, ...]

If I use google to find something in the docs, I am stuck in the chapter
then. Use my ref link again. Somewhere down the page you find "Chapter
18 explains the concept of Join more extensively." Good information. But
how the get there?
I can scroll down to the bottom, click on next chapter, wait for it to
load, scroll down again, and this four times.
Here my suggestions would be to add a link to the index in the middle,
and add the whole navigation on top also (last chapter, index, next
chapter).
Also maybe there would be an option to automatically create a link for
chapter ## in the docs?

I think most of the suggestions are implemented quite quickly and would
help me a lot. Anyone else also?

Georg

fakingfantastic schrieb:
> I recently had a discussion with Fabien about this topic, and he
> suggested it would be best if I stage the debate here.
> 
> Has anyone ever felt like the information they needed to get on
> Symfony was hard to find? Do you find that the information you need is
> very-well documented on the site, but it takes a while to search for?
> These are very big issues for me that over the last 6 months of me
> learning the framework, have made it quite difficult.
> 
> Do not get me wrong: I am not say "Symfony isn't well documented" (I
> made that mistake when talking with Fabien). What I am saying is
> Symfony-Project.org, for whatever reason, is always very difficult for
> me to search through to find what I am looking for. I feel that it has
> to do with the way the content is organized on the site. It doesn't
> feel very compartmentalized to me. When I need to find out some
> information on the framework, I seem to always have the same 3 issues:
> "What am I trying to find out", "Where do I search to find the
> information", and "Is this information outdated"?
> 
> For now, I was to leave what I am asking a little vague, in hopes to
> see what that naturally brings out in people about this. My ultimate
> goal would be trying to put together an initiative to re-organize and
> enhance the site to make it more "intuative" (if that's the right
> word) for new-comers and seasoned users alike.
> 
> Feel free to irc me at fakingfantastic aswell, i'm usually in #symfony.
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Insert custom styles in template

2009-09-21 Thread Georg Gell

Right, thank you

Davide Borsatto schrieb:
> Slots are the solution to your problem, read about them in the docs
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Insert custom styles in template

2009-09-18 Thread Georg Gell

Again thanks for the answer.
It seems to me that I have three possibilities:

1.) I can use

$this->getContext()->getRequest()->setAttribute('style', 
'.item{width='.$width.'px;}</style');
and use

<?php echo $sf_request->getAttribute('style') ?>
in layout.php

2.) I can use a slot

3.) I can define another layout file in view.yml for the module (at least I 
think).

Which of these options is best performance wise, how do they affect caching?

Georg



Casey schrieb:
> Maybe you could use a filter or the preExecute method of the actions
> class?  Without knowing at which point the data becomes available
> thats the best that I can suggest.  Perhaps you could create a slot in
> the layout within the head portion of the template.  If it really
> truly is only that one value, you could set a slot to be just the
> width integer in the style definition.  Then, use the has_slot method
> to implement a default value.  Once you do that you can call the
> setSlot method in your action to populate the width value.  Its
> probably not the most maintainable solution either, but I don't know
> that there is one.  The only other thing I can think of is to use ajax
> calls to update the object's contents and size.
>
> HTH,
> Casey
> On Sep 18, 2:27 pm, Georg Gell <geor...@have2.com> wrote:
>   
>> Hi,
>>
>> thanks for the answer.
>> at 1) AFAIK <style> should ony be in <head>,  and I cannot put anything
>> in <head> in my template, this would have to be in layout.php, and there
>> I think I cannot access $this->style from the action, or can I?
>> at 2 a) b) I only want to change one value dynamically for each request,
>> so this css would have to be it's own action. I would like to avoid the
>> overhead to create the action and add another request from the browser
>> that slows down the page load.
>> at 2 c) same reason like 1, I can't put anything in <head> from the
>> template.
>>
>> Georg
>>
>> Alexandru-Emil Lupu schrieb:
>>
>>
>>
>> 
>>> 1)  in your action $this->style = '<style>'; and then in your
>>> templates echo $foo;
>>> 2) alternative css for the pages you want modified.
>>> a)  from module/config/view.yml add
>>>   
>>> action:
>>>   stylesheets: ["/alternate_index"] # check the doc
>>> b) in your template add
>>> 
>>> c) add it by hand in your template
>>>   
>>> I would recomend just 2a or 2b, as being most appropriate for a long
>>> term maintainability.
>>>   
>>> Alecs
>>>   
>>> On Fri, Sep 18, 2009 at 11:16 PM, Georg Gell >> <mailto:geor...@have2.com>> wrote:
>>>   
>>> Hi,
>>>   
>>> how can I include some custom style information in a specific
>>> template?
>>> I would like to change the size of some divs fitting to the items
>>> in them.
>>> So i think i am looking for a way to insert something like
>>> .item{width:17px} into the template, where the 17px
>>> will
>>> be different for each request.
>>> I could create a helper for that, and use it in layout.php, but what
>>> information is available to this helper during the time it is used?
>>> Probably nothing from the action?
>>>   
>>> Any ideas?
>>>   
>>> Georg
>>>   
>>> --
>>> As programmers create bigger & better idiot proof programs, so the
>>> universe creates bigger & better idiots!
>>> I am on web:  http://www.alecslupu.ro/
>>> I am on twitter:http://twitter.com/alecslupu
>>> I am on linkedIn:http://www.linkedin.com/in/alecslupu
>>> Tel: (+4)0748.543.798
>>>   
> >
>   


--~--~-~--~~~---~--~~
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: Insert custom styles in template

2009-09-18 Thread Georg Gell

Hi,

thanks for the answer.
at 1) AFAIK  should ony be in <head>,  and I cannot put anything 
in <head> in my template, this would have to be in layout.php, and there 
I think I cannot access $this->style from the action, or can I?
at 2 a) b) I only want to change one value dynamically for each request, 
so this css would have to be it's own action. I would like to avoid the 
overhead to create the action and add another request from the browser 
that slows down the page load.
at 2 c) same reason like 1, I can't put anything in <head> from the 
template.

Georg

Alexandru-Emil Lupu schrieb:
> 1)  in your action $this->style = '<style>'; and then in your 
> templates echo $foo;
> 2) alternative css for the pages you want modified.
> a)  from module/config/view.yml add
>
> action:
>   stylesheets: ["/alternate_index"] # check the doc
> b) in your template add
> 
> c) add it by hand in your template
>
>
> I would recomend just 2a or 2b, as being most appropriate for a long 
> term maintainability.
>
> Alecs
>
> On Fri, Sep 18, 2009 at 11:16 PM, Georg Gell  <mailto:geor...@have2.com>> wrote:
>
>
> Hi,
>
> how can I include some custom style information in a specific
> template?
> I would like to change the size of some divs fitting to the items
> in them.
> So i think i am looking for a way to insert something like
> .item{width:17px} into the template, where the 17px
> will
> be different for each request.
> I could create a helper for that, and use it in layout.php, but what
> information is available to this helper during the time it is used?
> Probably nothing from the action?
>
> Any ideas?
>
> Georg
>
>
>
>
>
> -- 
> As programmers create bigger & better idiot proof programs, so the 
> universe creates bigger & better idiots!
> I am on web:  http://www.alecslupu.ro/
> I am on twitter: http://twitter.com/alecslupu
> I am on linkedIn: http://www.linkedin.com/in/alecslupu
> Tel: (+4)0748.543.798
>
>
> >


--~--~-~--~~~---~--~~
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] Insert custom styles in template

2009-09-18 Thread Georg Gell

Hi,

how can I include some custom style information in a specific template?
I would like to change the size of some divs fitting to the items in them.
So i think i am looking for a way to insert something like
.item{width:17px} into the template, where the 17px will
be different for each request.
I could create a helper for that, and use it in layout.php, but what
information is available to this helper during the time it is used?
Probably nothing from the action?

Any ideas?

Georg

--~--~-~--~~~---~--~~
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] How can I set a different base class for each Doctrine record?

2009-09-04 Thread Georg Gell

Dear list,

is it possible to set a certain base class for each doctrine record?
I tried baseClassName, but this was not working like expected.

I would like to have

Adress extends BaseAdress extends ClientAwareDoctrineRecord extends
Doctrine_Record

for all tables, that have a reference to the client in a multi client
system. Is there a way to define a different base class for the base
table class for each table?

Thanks in advance for your help

Georg

--~--~-~--~~~---~--~~
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] Can't get Doctrine Nested Set on an aliased multi root column to work

2009-08-31 Thread Georg Gell

Hello,

I am trying Doctrine for a new project, so my Doctrine level is newbie.

I would like to have nested albums with one root album per client, so I
set up the table like this:

Album:
  actAs:
NestedSet: {hasManyRoots: true, rootColumnName: client_id }
  columns:
path: { type: string, length: 255, notnull: true}
client_id: { type: integer, notnull: true, name: "client_id as
clientID" }
  relations:
Client: { local: client_id, foreign: id, foreignAlias: Albums,
onDelete: CASCADE }
  indexes:
pathAndClientAreUnique:
  fields: [path, client_id]
  type: unique

And then I try to set the root node like this:

$root = new Album();
$root->path = "/";
$root->clientID = sfConfig::get('app_clientid');
$tree = Doctrine::getTable('Album')->getTree();
$tree->createRoot($root);

And this does not work. It seems that there is a problem with the alias
for client_id. If I run it with yaml table file like above, I get an
exception:

Doctrine_Record_UnknownPropertyException
Unknown record property / related component "client_id" on "Album"

But if I change the yaml file to

NestedSet: {hasManyRoots: true, rootColumnName: clientID }

it finds the right column, but then the mysql query is wrong:

Doctrine_Connection_Mysql_Exception
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'clientid' in
'field list'
Doctrine_Connection->exec('INSERT INTO album (path, clientid,
image_size, thumbnail_size, priceset_id, lft, rgt, level) VALUES (?, ?,
?, ?, ?, ?, ?, ?)', array('/', 1, 600, 150, 1, '1', '2', 0))

Here Doctrine uses the alias name instead of the mysql column name.

What can I do (unless removing my alias is the only solution)?

Georg

--~--~-~--~~~---~--~~
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 coders needed / symfony e-commerse module...

2007-09-25 Thread Georg Gell

Yes, I am interested. Please release them!

Georg

Jon Busby schrieb:
> On the same subject, I've written a standard Paypal module (standard 
> webpayments), and a Google Checkout module.  If anyones interested in 
> using these I'll release them under the MIT  lisence in true symfony 
> fashion.
> 
> Jon
> 
> [EMAIL PROTECTED] wrote:
>> Hi Stefan,
>>
>> I could some hours helping you finish the project..
>>
>> On Sep 25, 10:21 pm, "Rafael George" <[EMAIL PROTECTED]> wrote:
>>   
>>> I think that as soon as you publish the application others will follow.
>>>
>>> On 9/25/07, Jon Busby <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>> 
 Stefan,
   
 I'd volunteer some hours for this - if anything else just to get some
 experience with another coders symfony code (its nice to see that I'm
 building sites correctly, hehe).
   
 One thing I think symfony is currently lacking (where cakePHP has the
 edge at least) is a full open-source e-commerce module.  Would anyone be
 up for developing one with me?  I've already laid the foundations of a
 pretty powerful e-commerse store.  I wouldn't mind open-sourcing it if I
 knew other developers would be interested in helping me finish it!
   
 Thanks
   
 Jon
   
 Stefan Koopmanschap wrote:
   
> On Sep 25, 2:41 pm, Nicolas Perriault <[EMAIL PROTECTED]>
> wrote:
> 
>> I don't like much the idea of coding a community-related app without the
>> support of the community nor the official mainteners, that's why I asked
>>   
> Hence my remark earlier that if the community feels this is an
> important addition, I'll start working on it.
> 
> I did register a domain for this, symfony-network.com, already. I'd
> gladly work on this app, either alone or together with a few other
> people, to make this reality. Obviously, it would be nice to have the
> support of the official maintainers, but I don't think this is
> necessary. As long as the community wants it, the community can make
> it ;)
> 
> Stefan
> 
 --
   
 Thanks,
   
 Jon Busby
 JBtwo Web Development
   
 Mobile :: +44 (0)7834 22 8887
 Office :: +44 (0)208 0900 351
   
 http://www.jbtwo.com
   
>>> --
>>> Grimoire Guru
>>> SourceMage GNU/Linux
>>> 
>>
>>   
> 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: OT: RAD contract issues

2007-03-25 Thread Georg Gell

Lukas Kahwe Smith schrieb:
> Georg Gell wrote:
>> Lukas Kahwe Smith schrieb:
>>> Georg Gell wrote:
>>>
>>> Well in order to really leverage the benefits from agile development, 
>>> one must really build a trust relationship with the client. Otherwise 
>>> you do not benefit from throwing out things not deemed useful during 
>>> prototyping etc. All in all the entire fixed price model does not really 
>>> apply anymore.
>> Do you really have many clients that pay you per hour just trusting you?
> 
> Sure, I have some projects that are paid per hour/day. But sure most 
> projects are fixed price.
> 

Hi, it seems that i have led us even more OT with my answers. Basically
I would like to know how to make the contract with your clients when you
are working with a fixed price and RAD, just in case something goes
wrong. How are you doing it?

regards
Georg

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: OT: RAD contract issues

2007-03-25 Thread Georg Gell

Lukas Kahwe Smith schrieb:
> Georg Gell wrote:
> 
> Well in order to really leverage the benefits from agile development, 
> one must really build a trust relationship with the client. Otherwise 
> you do not benefit from throwing out things not deemed useful during 
> prototyping etc. All in all the entire fixed price model does not really 
> apply anymore.

Do you really have many clients that pay you per hour just trusting you?

> Basically you define a budget, you define an initial scope and you keep 
> your client in the loop. Its the PM's just to ensure that the must 
> have's will always fit in the budget, even as you add new features and 
> throw out others. I suggest keeping a wiki that is updated immediately 
> as the specs evolve.

Just wondering how many projects exist that have more budget than just
for the bare must-haves? I should definitely get a dot com bubble
company as a client ;-)

> One key thing to state in the contract and make very clear from the 
> start is that client participation is key to the quality of the results. 
> This means that the client has to budget much higher costs on his side, 
> since he has to make sure that all the relevant people have sufficient 
> amount of time to provide feedback.

Good point, what are the arguments to make my client want to have more
budget on his side? They are all making overtime already.

> As a result the overall turnover for you is much reduced with agile 
> development. The project is usually shorter, client involvement means 
> less work for you. On the up side you obviously deliver faster, making 
> the chances better that your client will rake in nice profits that he 
> will probably like to reinvest partially into your services. Oh and if 
> you are not willing to provide the services, others will. So you dont 
> really have a choice these days.

*I* can see it's advantages and *I* am willing to provide this service,
but nobody wants it (I must admit they are engineering and production
companies, used to have the basic requirements before they start working)

regards
Georg

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] OT: RAD contract issues

2007-03-25 Thread Georg Gell

Hi everyone,

this is a little off topic, but I am reading the symfony book atm, it
was mentioned in the book that symfony is very useful for RAD and code
refactoring, as the newer customers often change the requirements.
Technically I am quite used to RAD and I see it's advantages, but I am
working as a project manager in a large company, and I have problems
using RAD there.
The main issue is that if you don't define the exact specifications
before, you cannot give a serious quote on the amount that the project
is going to cost. And if you make it easier for the customer to change
the requirement during the realization, how can you define when the
target is reached? Meaning how can you finish a RAD project in time and
within budget, if you have no defined target, and the client can always
wish for more?
How to you guys/gals cope with this problem? How do you make the
contract, when you are going to use RAD? Is it just that you are so good
and the clients pay so well that you have never thought about it?

Cheers
Georg

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---