[symfony-users] Re: Different format for :sf_culture

2010-12-11 Thread Thor
i think you can simply define your custom cultures as you want by
simply creating the relative xml of the culture,
not so sure though..

On Dec 10, 12:43 pm, "Felix E. Klee"  wrote:
> The default I18N system for transmitting cultures in the URL is nice.
> Simply add:
>
>   /:sf_culture
>
> However, we need a different format. We don't want:
>
>  http://example.com/es_ES
>
> We want:
>
>  http://example.com/es/es   (1)
>
> Or:
>
>  http://example.com/es      (2)
>
>   (defaulting to "es_ES")
>
> Now this can be achieved easily with modrewrite. Is that the way to go?
>
> Or is there an easy alternative with Symfony routing, at least for case
> 1?
>
> Felix
>
> --
> Dipl.-Phys. Felix E. Klee
> Mobile: +34.693759173, +49.174.1386060
> Fax: +49.3212.1021049

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Symfony disable javascript execution on Ajax request

2010-12-11 Thread Massimiliano Arione
On 9 Dic, 11:52, bobey  wrote:
> Jquery mobile transforms html urls links and call them in ajax. When a
> symfony action is called this way, the layout is no longer decorates
> the template and no javascript is executed. For the layout, I have to
> add $this->setLayout('layout') in my action but I can't figured a way
> to authorize script execution in my template.

Maybe I'm missing something, but I can't really understand why you
need javascript in an ajax call :-|

cheers
Massimiliano

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] [Symfony 2] default routes

2010-12-11 Thread dbenjamin
Hi,


With Symfony 2, is it required to define a route for each controller
action ? Are we able to define a route like : "/foo/:action" with
indexAction as the default action ?


Thanks.





br,
Benjamin.

-- 
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: Re : [symfony-users] Where Modify action before saving

2010-12-11 Thread seifolah Ghaderi
Here is schema:
post:
  actAs: { Timestampable: ~ }
  columns:
user_id: { type: integer, notnull: true }
title: { type: string(255) }
location: { type: string(255), notnull: true }
description: { type: string(4000), notnull: true }
is_activated: { type: boolean, notnull: true, default: 0 }
expires_at: { type: timestamp, notnull: true }
color: { type: string(20) }
year: { type: integer }
dealer: { type: boolean, default: 0 }
fuel: { type: integer, notnull:true, default: 0 }
kmeter: { type: integer }
mark_id: { type: integer, notnull: true }
model_id: { type: integer, notnull: true }
  relations:
sfGuardUser : { onDelete: CASCADE, local: user_id, foreign:
id,foreignAlias: Posts }
mark : { onDelete: CASCADE, local: mark_id, foreign: id, foreignAlias:
Posts }
model : { onDelete: CASCADE, local: model_id, foreign: id, foreignAlias:
Posts }
mark:
  actAs: { Timestampable: ~ }
  columns:
title: { type: string(255) }
utitle: { type: string(255) }
dsc: { type: string(4000) }
model:
  actAs: { Timestampable: ~ }
  columns:
title: { type: string(255) }
utitle: { type: string(255) }
dsc: { type: string(4000) }
mark_id: { type: integer , notnull: true }
  relations:
   mark : { onDelete: CASCADE, local: mark_id, foreign: id, foreignAlias:
models }



On Thu, Dec 9, 2010 at 12:06 AM, Alex Pilon  wrote:

> Can you post you schema.yml with respect to this model?
>
>
>> *De :* Seifollh Ghaderi 
>> *À :* symfony-users@googlegroups.com
>> *Envoyé le :* Mer 8 décembre 2010, 19h 59min 17s
>> *Objet :* [symfony-users] Where Modify action before saving
>>
>> Hi all.
>> In my website I have Post module that each Post created by a user.
>> I use SfDocringGuard plugin.
>> I need to hidden used_id that displayed  via a combo box  in post/new page
>> and  set it when user save the form.But I don't know where to do it?
>> I modified Post.class.php as bellow
>> /lib/model/Post.class.php
>>  Code: public function save(Doctrine_Connection $conn=null)
>> {
>>$now=$this->getCreatedAt()?
>> $this->getDateTimeObject('created_at')->format('U'):time();
>>$this->setExpiresAt(date('y-m-d H:i:s'),time() + 84600 * 30);
>>$this->setUserId($this->getUser()->getGuardUser()->getId());
>>$this->setIsActivated(true);
>> }
>>
>> It give this error:
>> Unknown record property / related component "user" on "Post"
>> My Post class has user attribute and relation between them is ok so whats
>> the problem?
>> Did I modify the right class?what's the sequence of function for saving a
>> form?
>>
>> Thanks for any help.
>>
>> --
>> Best Regards.
>> Seifollah Ghaderi
>>
>>  --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to symfony-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>>  --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to symfony-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>
>
> --
> Alex Pilon
> (613) 608-1480
>
>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: [Doctrine2] Mapping issue that only occurs on my remote

2010-12-11 Thread Damon Jones
I'm having the exact same issue. It works fine on my local machine but
not remotely.

On Dec 8, 9:22 pm, Marijn  wrote:
> Hi everybody,
>
> I'm having some trouble with a small test application which won't run
> on my remote server.
> I keep getting the following error:
>
> No mapping file found named
> 'Application.ServiceBundle.Entity.Service.dcm.xml' for class
> 'Application\ServiceBundle\Entity\Service'.
>
> My entities are mapped by annotations, prefixed with the latest orm
> namespace addition (e.g. orm:Entity).
> This problem only occurs on my remote server. But it's running the
> exact same code as my local copy which behaves as expected.
>
> I'm having trouble debugging this since I cannot inspect if the
> annotation loader is instantiated correctly.
>
> Is there any setting that can overrule this?
>
> Kindest regards,
>
> Marijn

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Mapping issue that only occurs on my remote

2010-12-11 Thread Damon Jones
On my development machine, if I dump the Driver Chain's Drivers, I get
an array with a single entry for my "Application/XXXBundle/Entity"
which is a "Doctrine\ORM\Mapping\Driver\AnnotationDriver".
The same thing on the remote server gives me an array of "Doctrine\ORM
\Mapping\Driver\XmlDriver"s for:
Symfony\Bundle\FrameworkBundle\Entity,
Symfony\Bundle\TwigBundle\Entity,
Symfony\Bundle\ZendBundle\Entity,
Symfony\Bundle\DoctrineBundle\Entity,
Application\XXXBundle\Entity,
Symfony\Bundle\WebProfilerBundle\Entity.

As these are all XMLDrivers, including the one for my Application
\XXXBundle\Entity, I can see why it's looking for a *.dcm.xml mapping
file, but I've no idea why the same configuration on the remote server
would default to XML mapping rather than annotations.

On Dec 11, 12:44 pm, Damon Jones  wrote:
> I'm having the exact same issue. It works fine on my local machine but
> not remotely.
>
> On Dec 8, 9:22 pm, Marijn  wrote:
>
>
>
> > Hi everybody,
>
> > I'm having some trouble with a small test application which won't run
> > on my remote server.
> > I keep getting the following error:
>
> > No mapping file found named
> > 'Application.ServiceBundle.Entity.Service.dcm.xml' for class
> > 'Application\ServiceBundle\Entity\Service'.
>
> > My entities are mapped by annotations, prefixed with the latest orm
> > namespace addition (e.g. orm:Entity).
> > This problem only occurs on my remote server. But it's running the
> > exact same code as my local copy which behaves as expected.
>
> > I'm having trouble debugging this since I cannot inspect if the
> > annotation loader is instantiated correctly.
>
> > Is there any setting that can overrule this?
>
> > Kindest regards,
>
> > Marijn

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] [Symfony 2] Not found gives 500 as response code

2010-12-11 Thread Gyula Sallai
Hello everyone!
I started playing with Symfony 2 recently, and I came across an
annoying problem. My application always returns 500 as status code if
something bad happened, but even if the route couldn't be matched or a
NotFoundHttpException was thrown, and I'd really prefer the good ol'
404s in that case. Is this a bug, or I just misused the framework
somehow? Any help would be appreciated.

Thanks,
Gyula

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Catch exceptions in Symfony2?

2010-12-11 Thread eillarra
Hi,


I'm playing with the Symfony2 sandbox and MongoDB.


I can save a mongo document using
$dm->flush(array('safe' => true));

and I get a MongoCursorException when one of the index keys is
duplicated in the database, but I would like to catch that exception in
the controller to tweak the response: maybe set a flash message, or a
redirect, or whatever when the document could'n be saved.


How can I do this?
I don't see any example like this in the documentation, and I tried a
try {} catch {} but it doesn't work.


Thanks!


PD: here, a code snippet of my controller (action):



$user = new User();
$user->setUsername($username);
$user->setEmail($email);
$user->setPassword($password);

// Load Doctrine ODM
$dm = $this->get('doctrine.odm.mongodb.document_manager');
$dm->persist($user);

// Flush in "safe" mode to enforce an Exception if keys are not unique
try {
$dm->flush(array('safe' => true));
} catch (MongoCursorException $e) {
throw new NotFoundHttpException('Just a 404 error, not what I want.
Anyway, it doesn't work.');
}

return $this->redirect($this->generateUrl('user_index'));

-- 
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] Catch exceptions in Symfony2?

2010-12-11 Thread Francis Besset
Hi,

Have you added MongoCursorException namespace with "use" in begin of your
class ?
Else, what is the name Exception returned ?


Francis.


2010/12/11 eillarra 

> Hi,
>
> I'm playing with the Symfony2 sandbox and MongoDB.
>
> I can save a mongo document using
> *$dm->flush(array('safe' => true));*
> and I get a MongoCursorException when one of the index keys is duplicated
> in the database, but I would like to catch that exception in the controller
> to tweak the response: maybe set a flash message, or a redirect, or whatever
> when the document could'n be saved.
>
> How can I do this?
> I don't see any example like this in the documentation, and I tried a try
> {} catch {} but it doesn't work.
>
> Thanks!
>
> PD: here, a code snippet of my controller (action):
>
> $user = new User();
> $user->setUsername($username);
> $user->setEmail($email);
> $user->setPassword($password);
>
> // Load Doctrine ODM
> $dm = $this->get('doctrine.odm.mongodb.document_manager');
> $dm->persist($user);
>
> // Flush in "safe" mode to enforce an Exception if keys are not unique
> try {
> $dm->flush(array('safe' => true));
> } catch (MongoCursorException $e) {
> throw new NotFoundHttpException('Just a 404 error, not what I want.
> Anyway, it doesn't work.');
> }
>
> return $this->redirect($this->generateUrl('user_index'));
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Catch exceptions in Symfony2?

2010-12-11 Thread eillarra
I haven't added it.
But the exception is a MongoCursorException, or so it seems...


E11000 duplicate key error index: db.users.$username_1 dup key:
{ : "whatever" }500 Internal Server Error - MongoCursorException

-- 
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] Catch exceptions in Symfony2?

2010-12-11 Thread Francis Besset
Sorry,
MongoCursorException is a class of base of PHP.

In your catch, you must add backslash :
try { ... } catch (\MongoCursorException $e) { ... }


Good luck.

2010/12/11 eillarra 

> I haven't added it.
> But the exception is a MongoCursorException, or so it seems...
>
> E11000 duplicate key error index: db.users.$username_1 dup key: { :
> "whatever" }*500* Internal Server Error - MongoCursorException
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

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

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Mapping issue that only occurs on my remote

2010-12-11 Thread Damon Jones
It seems that DoctrineExtension::detectMetadataDriver() uses glob() to
check for xml and yml files and falls back to using an annotation
mapping driver.

It uses if (count(glob(...)) to check for matching files. If glob()
returns an array then a non-empty array (one or more matching files)
means that an XML mapping driver is used. However, glob() can return
false upon an error condition and as count(false) == 1, it will always
use an XML mapping driver on systems where glob() returns false.

Replacing:
if (count(glob($dir.'/Resources/config/doctrine/metadata/orm/*.xml')))
{
return 'xml';
} elseif (count(glob($dir.'/Resources/config/doctrine/metadata/orm/
*.yml'))) {
return 'yml';
}

with:
$xmlFiles = glob($dir.'/Resources/config/doctrine/metadata/orm/
*.xml');
if ($xmlFiles && count($xmlFiles)) {
return 'xml';
} else {
$ymlFiles = glob($dir.'/Resources/config/doctrine/metadata/orm/
*.yml');
if ($ymlFiles && count($ymlFiles)) {
return 'yml';
}
}

seems to fix the problem.

On Dec 11, 1:12 pm, Damon Jones  wrote:
> On my development machine, if I dump the Driver Chain's Drivers, I get
> an array with a single entry for my "Application/XXXBundle/Entity"
> which is a "Doctrine\ORM\Mapping\Driver\AnnotationDriver".
> The same thing on the remote server gives me an array of "Doctrine\ORM
> \Mapping\Driver\XmlDriver"s for:
> Symfony\Bundle\FrameworkBundle\Entity,
> Symfony\Bundle\TwigBundle\Entity,
> Symfony\Bundle\ZendBundle\Entity,
> Symfony\Bundle\DoctrineBundle\Entity,
> Application\XXXBundle\Entity,
> Symfony\Bundle\WebProfilerBundle\Entity.
>
> As these are all XMLDrivers, including the one for my Application
> \XXXBundle\Entity, I can see why it's looking for a *.dcm.xml mapping
> file, but I've no idea why the same configuration on the remote server
> would default to XML mapping rather than annotations.
>
> On Dec 11, 12:44 pm, Damon Jones  wrote:
>
>
>
> > I'm having the exact same issue. It works fine on my local machine but
> > not remotely.
>
> > On Dec 8, 9:22 pm, Marijn  wrote:
>
> > > Hi everybody,
>
> > > I'm having some trouble with a small test application which won't run
> > > on my remote server.
> > > I keep getting the following error:
>
> > > No mapping file found named
> > > 'Application.ServiceBundle.Entity.Service.dcm.xml' for class
> > > 'Application\ServiceBundle\Entity\Service'.
>
> > > My entities are mapped by annotations, prefixed with the latest orm
> > > namespace addition (e.g. orm:Entity).
> > > This problem only occurs on my remote server. But it's running the
> > > exact same code as my local copy which behaves as expected.
>
> > > I'm having trouble debugging this since I cannot inspect if the
> > > annotation loader is instantiated correctly.
>
> > > Is there any setting that can overrule this?
>
> > > Kindest regards,
>
> > > Marijn

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