This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Today's Messages (OFF)  | Unanswered Messages (ON)

Forum: symfony 1.1
 Topic: Front Controller Problem
Front Controller Problem [message #66196] Thu, 27 November 2008 20:21
ronni  is currently offline ronni
Messages: 9
Registered: November 2008
Junior Member
Hi!

I have similar problem:
http://www.symfony-project.org/forum/index.php/m/61798/?srch =form_tag+dev+prod#msg_61798

and

http://www.symfony-project.org/forum/index.php/m/65131/?srch =front+controller+problem#msg_65131

ModRewrite enabled!

I work on Ubuntu on Apache2, and in /etc/apache2/sites-aviable/default set:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

When I try use to make form form_tag('module/index') in prod, i become link:
project/module
(it must be /project/backend/module)

It reports 404 Error.

What's wrong?

[Updated on: Thu, 27 November 2008 20:28]

 Topic: some problems between admin-generator and foreign table
some problems between admin-generator and foreign table [message #66222] Fri, 28 November 2008 03:37
heralu  is currently offline heralu
Messages: 3
Registered: November 2008
Junior Member
I designed my schema referenced from ths page HowToHandlei18nDbFieldsWithAdminGenerator.

And this is my schema:
  sf_email_template:
    _attributes:  { phpName: sfEmailTemplate, isI18N: true, i18nTable: sf_email_template_i18n }
    id:           ~
    name:         { type: varchar(50) }
    created_at:
    updated_at:

  sf_email_template_i18n:
    _attributes:  { phpName: sfEmailTemplateI18n }
    id:           ~
    template_id:  { type: integer, required: true, foreignTable: sf_email_template, foreignReference: id, onDelete:cascade }
    culture:      { isCulture: true, type: varchar, size: 7, required: true, primaryKey: true }
    subject:      { type: varchar(255) }
    body:         { type: longvarchar }


The scenario is as following:
I created an template in sfEmailTemplate, and decide the template name.
Then in the sfEmailTemplateI18n table, I can create different culture(language) templates mapping to the template in sfEmailTemplate.

I used init-admin to generate admin backend for each table.
And my problems is that:
First, I created one template in sfEmailTemplate backend.
Then in sfEmailTemplateI18n backend, I want to create different culture templates mapping to this template id.
(there are drop-down list showing the tempalte id in create page)
But after submitting, it couldn't insert data to the database.
The webpage just jumped from the edit page to the list page.
Why can't I insert data in sfEmailTemplateI18n backend?

By the way, if I want to change the appearance in the backend template, for example, adding select_language_tag.
The way in the tutorial I've mentioned above is to change the Project_name/apps/backend/templates/layout.php,
and this way will affect all the webpages in the backend directory.
But I only want to change one specific module.
Is there any way to solve this problem?
Thanks a lot! Smile
 Topic: Admin use second table for build form
Admin use second table for build form [message #66425] Mon, 01 December 2008 11:43
Ph03n1x  is currently offline Ph03n1x
Messages: 2
Registered: December 2008
Junior Member
Hi all,
I have a little problem , but i'm new with symfony.

I have this situation in my schema.yml

people:
id:
name: {type: varchar(255)}

agency:
id:
name: {type: varchar(255)}

structure:
id:
name: {type: varchar(255) }

jobs:
people_id:
agency_id:
structure_id:
notes: { type: varchar(255)}

I build admin panel with AdminGenerator. The main form for insert data is people form, but this show only name fields.
It's possible insert select for agency and structure in the people insert form ??? how ?

When i save, after compile people's name and select agency and structure on generated select, the jobs table is update automaticaly ?? If not ... how to obtain this?

Please help me !!!

Sad
 Topic: problem with listbox - foreingkeys
problem with listbox - foreingkeys [message #66495] Tue, 02 December 2008 04:46
danram.racing  is currently offline danram.racing
Messages: 5
Registered: November 2008
Location: Cali, Colombia
Junior Member
hello again....how are you??
I have a table with a few foreing keys, i build a model according the manuals, the askeet tutorial, etc...I cannot create the database and from there import my model, cause the function have some mistakes, and sometimes the function propel-build-schema dont create all the colums...so i decide to create the schema.yml manually, and then create the database with it..with this option all the foreing keys were created, but i have a big problem when I create the CRUD and use the forms...when i have more than one listbox - foreing key in my form...my server apache 2.2 stops and obviusly the aplication doesnt work anymore until I restart the server...i dont know if there is an error in the request, if there is something wrong in the configuration of the server or php...I use this to create all my foreing keys in the schema.yml
category_id: {type: integer, foreignTable: Category, foreignReference: id}

what could i do? thanks for any help...


Daniel Alejandro
 Topic: [SOLVED] Package Folder Not Created
icon4.gif  [SOLVED] Package Folder Not Created [message #66496] Tue, 02 December 2008 05:10
theepan  is currently offline theepan
Messages: 16
Registered: November 2008
Location: Canada
Junior Member
Hi,

I'm try to refactor my code, project strusture . So I decided to move my model in different folders.

When I do the build, folders are not created.

propel:
  user_info:
    _attributes: { phpName: User, Package: lib.model.user }
    id:                 { type: integer, required: true, primaryKey: true, autoIncrement: true } 
    first_name:          { type: varchar(30), required: true }
    last_name:           { type: varchar(30), required: true }
    email:              { type: varchar(50), required: true }
    password:           { type: varchar(15), required: true }
    status:             { type: boolean, required: true, default: false }
    updated_at:         ~
    created_at:         ~ 
    _indexes:
      my_index:       [id]
    _uniques:
      my_other_index: [email]






SOLUTION:

Also Eclipse Didn't list the directory

[Updated on: Tue, 02 December 2008 06:17]

 Topic: sfTestBrowser - how to show php errors?
sfTestBrowser - how to show php errors? [message #66580] Tue, 02 December 2008 23:20
caponica  is currently offline caponica
Messages: 69
Registered: March 2008
Location: London
Member
Hi,

is there a way to get sfTestBrowser to catch and show php errors so that you can check if pages are throwing such notices/warnings?


e.g. messages like:
Notice: Use of undefined constant foo - assumed 'foo' in 
C:\web\myproject\apps\myapp\modules\mymodule\actions\actions.class.php 
on line 50")


These are shown in frontend_dev.php when you turn on the web debug toolbar, but sfTestBrowserInstance->checkResponseElement() doesn't seem to pick them up, even if I turn on the web debug toolbar in the test environment.

Thanks for your help!


C
 Topic: [PATCH] sfWebController: fixed lost session id when redirected while cookies off, use_trans_sid on.
[PATCH] sfWebController: fixed lost session id when redirected while cookies off, use_trans_sid on. [message #66581] Tue, 02 December 2008 23:28
gagarin61  is currently offline gagarin61
Messages: 1
Registered: December 2008
Location: LV
Junior Member
Hello,

Recently I found this widely known mistake when not including session id in URL when redirecting gets the session lost. Couldn't log on to trac to submit the patches for version 1.1 as for 1.2. So will do it here. Hope some of you'll find them useful.

Enjoy.

[Updated on: Tue, 02 December 2008 23:30]

 Topic: install sfSimpleForumPlugin
install sfSimpleForumPlugin [message #66689] Wed, 03 December 2008 20:47
simoelasimo  is currently offline simoelasimo
Messages: 47
Registered: November 2008
Member
hi all

can someone help me to install the plugin sfSimpleForumPlugin on symfony 1.1.6

thx

[Updated on: Wed, 03 December 2008 20:47]

 Topic: How to write forms which envolves more than one models
How to write forms which envolves more than one models [message #66835] Fri, 05 December 2008 05:57
servlet  is currently offline servlet
Messages: 27
Registered: November 2008
Junior Member
forms book is missing some chapters.
Where are those? Are they yet to be written?

I have a problem with implementing forms which envolves more than one model, but I don't find any useful information in book.

Scenario:

I want to create a CRUD page which involves more than one models.

Ex.

- I want to create a registration page for user registration.
- On registration page, user fills info for profile and username/password

- Profile is represented by UserProfile and user info with User.

- This page involves two models, UserProfile and User.

- How to write forms for such scenarios, or even more complex then this

I think there's some thing like embedded forms, but I don't see any example in book.

Thanks
SN




JSP tutorial,Servlet tutorials
 Topic: Symfony with DB2
Symfony with DB2 [message #66838] Fri, 05 December 2008 07:00
rapraaj  is currently offline rapraaj
Messages: 10
Registered: November 2008
Location: Noida
Junior Member
Hi everybody...!

I have completed basic study for symfony and now my requirement is to work for project with DB2 and symfony framework. Kindly, someone, reply me:
1) Is there any step by step study doc/ e-book for starting my project with symfony, php5.2 and DB2(database)?
2) Is it feasible/ manageable selection (php5.2, symfony and DB2) for the point of performance...etc?


Although this is client requirement but if I shall face any critical problem by choosing this seletion(php5.2, symfony and DB2),kindly suggest me and any other better option.


Rapraaj,
Sr. Software Engineer,
Netsoft Informatics,
Noida (India)
 Topic: propel:data-load not working with special chars
propel:data-load not working with special chars [message #67301] Wed, 10 December 2008 13:16
doox  is currently offline doox
Messages: 6
Registered: December 2008
Junior Member
hello,

when using "propel:data-load" its adding things fine into the database, except words with special chars like "Empfänger" will end up like this: "Empfänger".
my db is mysql with utf8_general_ci collation.

anyone having an idea how to fix this?

thanks
 Topic: How descibe validators in schema.yml file
How descibe validators in schema.yml file [message #67303] Wed, 10 December 2008 13:22
innocead  is currently offline innocead
Messages: 1
Registered: December 2008
Junior Member
Hi. I want know how to describe propel validators in schema.yml
http://propel.phpdb.org/trac/wiki/Users/Documentation/1.2/Va lidators

I have described this in schema.xml and all works done.

for example:

xml
<column name="security_level" type="INTEGER" required="true" />
<validator column="security_level">
<rule
name="maxValue"
value="1000"
message="Maximum security level is ${value} !" />
</validator>

yml

???


sorry, for my English )
 Topic: Multiple Partials with JS / AJAX
Multiple Partials with JS / AJAX [message #67327] Wed, 10 December 2008 17:59
anachna  is currently offline anachna
Messages: 5
Registered: March 2008
Junior Member
Hello,

i want to display a partial with chained selects multiple times in order to compare different products.
The AJAX Request in _show.php would have to be implemented dynamically.

Does anybody know how to do this? I'm sure that there are already solutions.


Thank you,

Wolfgang




showSuccess.php:

<div class="vlist">
    <?php include_partial('show'); ?>
</div>



partial _show.php:

script type="text/javascript">
  //<![CDATA[
    function onFailure(transport)
        {
            alert('Ajax Error');
            alert(transport.status);
        }

    function onSuccess(transport)
     {
        var sub_category_options = transport.responseText.evalJSON();
        if (sub_category_options == null) {
            var opt = new Element('option', {value: 0 });
             opt.update('Keine Einträge');
            $('sub_category').insert(opt);
        }
        else {
        sub_category_options.each(function(sub_category_option)
               {
                  var opt = new Element('option', {value: sub_category_option.key });
                  opt.update(sub_category_option.value);
                  $('sub_category').insert(opt);
                });
        }
     }

    function handler_update_sub_category(e)
    {
        var select = Event.findElement(e, 'select'); //Finding the select field on which an Event was Observed
        var val_selected = $F(select);   //extracting value of selected parent
        var params = 'id=' + val_selected;
        var options = {
            method: 'get',
            parameters: params,
            onSuccess: onSuccess,
            onFailure: onFailure
        }
        $('lph').length = 0;
        new Ajax.Request('/categorie/showOptionsSubCategory', options);

        handler_update_text(e);
    }

  Event.observe(window, 'load', function()
    {
            Event.observe($('categorie'), 'change', handler_update_sub_category);
    }
  );
  //]]>
</script>

<table>
<tr>
  <th>category:</th>
</tr>
<tr>
  <td><?php echo object_select_tag('category', 'category', array (
  'related_class' => 'category',
  'include_custom' => 'Choose a category!',
)) ?></td>
<tr>
<tr>
  <th>Subcategory:</th>
<tr>
<tr>
  <td><select id="sub_category" name='sub_category'><option value="">Choose a subcategory!</option></select></td>
</tr>
</table>
 Topic: Problem with plugin
Problem with plugin [message #67376] Thu, 11 December 2008 00:32
sirmajk  is currently offline sirmajk
Messages: 2
Registered: December 2008
Junior Member
Hi

I have a problem with install some plugin
I have symfony in version 1.1.6


When I install plugin , symfony always want to install symfony 1.2

It is ma log:

$ ./symfony plugin:install sfLightboxPlugin --release=1.0.8
>> plugin installing plugin "sfLightboxPlugin"
>> sfPearFrontendPlugin downloading sfLightboxPlugin-1.0.8.tgz ...
>> sfPearFrontendPlugin Starting to download sfLightboxPlugin-1.0.8.tgz (24,244 bytes)
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin ...done: 24,244 bytes
>> sfPearFrontendPlugin symfony/sfLightboxPlugin is not compatible with downloaded
>> sfPearFrontendPlugin package "symfony/symfony" version 1.2.0
>> sfPearFrontendPlugin downloading symfony-1.2.0.tgz ...
>> sfPearFrontendPlugin Starting to download symfony-1.2.0.tgz (2,671,836 bytes)
>> sfPearFrontendPlugin ...done: 2,671,836 bytes

Why I can't install plugin ?
 Topic: phantom symfony installation
phantom symfony installation [message #67489] Thu, 11 December 2008 21:37
yshaf13  is currently offline yshaf13
Messages: 22
Registered: November 2008
Junior Member
hi, I decided to reinstall my webserver and therby lost my symfony installation. on reinstalll i accidently installed sf1.2 - which my plugins wont work with, so i did a pear uninstall and reinstalled 1.1 no problem. now i'm trying to install a new plugin (sfGallery2plugin) and it says:
 plugin "sfGallery2Plugin"
 
 symfony-plugins/sfGallery2Plugin is not compatible with
 downloaded package "symfony/symfony" version 1.2.0
 downloading symfony-1.2.0.tgz ...
 Starting to download symfony-1.2.0.tgz (2,671,836 bytes)
 ...done: 2,671,836 bytes
Installation of "sfGallery2Plugin" plugin failed: pear.symfony-project.com/symfony not installed


question is, why does it still think i have 1.2?
A search of the plugin forums did not find anything.
p.s. a "symfony -V" results in "symfony version 1.1.6"
 Topic: Same autentication way for different aplications
Same autentication way for different aplications [message #67524] Fri, 12 December 2008 09:50
fran74  is currently offline fran74
Messages: 20
Registered: May 2008
Junior Member
Hi guys...

I did that cuestion 6 months ago, but now on symfony1.1 and 1.2 maybe now there is some light on this question.

Is there anyway to use the same autentication proces for all aplications in one project???, i mean... if you need some credentials on one module of one aplication, it redirects you to a module "called" "accessControl" on other aplicaction that logs you and then redirect to the original module on the other aplication, i mean one module one on one aplication to autenticate in all modules of all aplications on same project.

I've done this way by one real-autentication module in one aplication (wich has only this module), and i have in the rest of aplications a mini-false-module of autentication-redirecting to the real autentication module in his own aplication, the real-autenticating module autenticates you andthe redirects again to the place where the autentication was needed...

Definively my question is... can this problem be solved by a native way of symfony???

Thaks for the support.
 Topic: project:deploy ignores a backend module called "tags"
icon5.gif  project:deploy ignores a backend module called "tags" [message #67617] Sat, 13 December 2008 00:02
beaulebens  is currently offline beaulebens
Messages: 1
Registered: December 2008
Location: San Francisco, CA
Junior Member

I've got a project that I'm deploying to another server using the built in rsync method and doing

./symfony project:deploy live --go


("live" is the name of my production server configuration). Everything works as expected, except that I have a apps/backend/modules/tags module that never gets deployed for some reason. It appears to be getting completely ignored because if I manually upload it, it doesn't delete it either.

My config/rsync_exclude.txt looks like this;

.svn
/web/uploads/*
/cache/*
/log/*
/web/*_dev.php
/web/*_test.php
/web/blog
/html


Anyone have any idea what's going on here? I'm using v1.1.6-DEV
 Topic: sfRegexValidator: special chars
icon5.gif  sfRegexValidator: special chars [message #67710] Sun, 14 December 2008 19:22
Andi  is currently offline Andi
Messages: 8
Registered: January 2008
Junior Member
Hello Symfonyans,

I'm working on a regexp for the sfRegexValidator, which should allow normal characters (A-Za-z0-9) and special characters like äöüßçñ etc.

So far I have:
sfRegexValidator:
  match:        Yes
  match_error:  The name contains invalid characters
  pattern:        /[A-Za-z0-9äÄäÄüÜöÖßœŒŽžàÀÁáâÂãÃåÅæÆçÇèÈéÉêÊëËíÍîÎïÏñÑòÒóÓôÔõÕøØšŠùÙúÚûÛýÝÿŸÌì]+/


I'm using the utf-8-charset.

Problem:
chars like © or £ are allowed and the validator does not throw an error.

Anybody any ideas or do you know how to handle special char-validation in a better way?

Thanks for your ideas!
 Topic: Join of the same table, twice
Join of the same table, twice [message #67819] Mon, 15 December 2008 21:28
farrellj  is currently offline farrellj
Messages: 3
Registered: November 2008
Junior Member
How would you sort a specific table, if you join it twice, by different criteria? Right now this is sorting by the title of my first sfArticlePeer. I've posted/commented the code below so you can understand my logic:

//get the related articles for the ID article ID we're on
$c->add(sfMetaArticleRelatedPeer::META_ARTICLE_ID, $id);

//then let's join the related articles (the sfArticle object):
$c->addJoin(sfMetaArticleRelatedPeer::ARTICLE_ID, sfArticlePeer::ID);

//Then let's get the related articles of those related articles:
$c->addJoin(sfArticlesRelatedPeer::ARTICLE_RELATED_ID, sfArticlePeer::ID);

//Here's the problem, I want to order by the second sfArticlePeer::TITLE, but sfArticlePeer has been joined twice
$c->addAscendingOrderByColumn(sfArticlePeer::TITLE);

//Select the related articles
$v = sfArticlesRelatedPeer::doSelect($c);
 Topic: Report
Report [message #67991] Wed, 17 December 2008 13:59
Alphax  is currently offline Alphax
Messages: 42
Registered: February 2008
Member
Hello ...

Does anyone Plugin for generating reports on the PHPReports type symfony 1.1?

I am very ...

Thank you!
 Topic: How to use old (sfMail) Templates with Swiftmailer
How to use old (sfMail) Templates with Swiftmailer [message #68190] Fri, 19 December 2008 11:52
jefferson  is currently offline jefferson
Messages: 27
Registered: November 2007
Junior Member
i send mails from batch so i use
$raw_email = $context->getController()->getPresentationFor('mail', 'sendBlablaMail', 'sfMail');

in sendBlablaMail action i use setTemplate because i have 2 different templates for the mail
have i now rename the blablaMailSuccess.php templates in partials _blablaMailPartial.php and use get_partial(..) or can i use the Successfiles with Swiftmailer?
 Topic: redirect-problem with email submission in forms
redirect-problem with email submission in forms [message #68220] Fri, 19 December 2008 15:11
dierckes  is currently offline dierckes
Messages: 24
Registered: October 2008
Junior Member
Hi,

I have a "callback"-form on a customer's website. It takes an email-address and/or a phone-number, depending on a checkbox whether the user wants to send an email or generate a callback by the company.
The conditional validation works fine, but I cannot submit the form.

The problem: when I submit the form, I get a 404-error (a "normal" one, not the symfony-error), but ONLY if I'm not in DEV-mode.
Using frontend_dev.php, everything is fine (that's why it took me so long to run into this error).

The URL that's causing the error looks something like this:

(...)/callbackservicethanks/cb_email/test%40test.com/cb_phone/test/cb_callback/test

What I found out after a hard time looking for the error: removing the "." from the email-address will make it work! (of course, than the form won't validate, I just tried it in the url)

The values are all in an array and I pass this array to "$this->redirect()" using "http_build_query". That'll work with ALL other forms on the website, except this one that takes an email-address.
What confuses me even more is the fact that using frontend_dev.php will just make the site behave like it should ...

Is there something like a passthrough-function that I should be using on email-addresses or something? Haven't seen anything like that and I've been through the forms-tutorial a couple of times.

Any help/hint is appreciated.

Greetings,
Martin


http://www.beehave.de
 Topic: Ajax forms using Form plugins
Ajax forms using Form plugins [message #68304] Sun, 21 December 2008 05:51
Janess
Messages: 4
Registered: December 2008
Junior Member
Sorry, I just realized that my previous question this is not a 1.1 specific question. So here's something 1.1 specific:

Is there any way to use ajax functions with the new form plugins? I couldn't find any ref material on this.

[Updated on: Sun, 21 December 2008 21:15]

 Topic: [SOLVED] $request->getParameter returns null !
[SOLVED] $request->getParameter returns null ! [message #68492] Tue, 23 December 2008 17:41
grenoult  is currently offline grenoult
Messages: 52
Registered: September 2008
Location: France
Member
Hi.

I've completed an action page, which insert a new line (in the database), following the choice of the user :
public function executeUpdate($request)
  {
    $this->forward404Unless($request->isMethod('post'));

    $this->form = new IncidentsForm(IncidentsPeer::retrieveByPk($request->getParameter('idincident')));

    $this->form->bind($request->getParameter('incidents'));
    if ($this->form->isValid())
    {
      $incidents = $this->form->save();
      
      if ($request->getParameter('definirmodele') == '1') // If the user checked the checkbox
      {
        $modele = new Modeles(); // A new object (modele) is created
        //each field of the line of modele is similar to the lines of modele

$modele->setNommodele($request->getParameter('nomincident'));
        $modele->setEtatmodele($request->getParameter('etatincident'));
        $modele->setIdservice($request->getParameter('idservice'));
        $modele->setDescriptionmodele($request->getParameter('detailincident'));
        $modele->setEtatmodele($request->getParameter('etatincident'));
        
        $modele->save(); // Finally the modele object is saved
      }
      
      // $this->redirect('incidents/edit?idincident='.$incidents->getIdincident());
      $this->redirect('incidents/index?choix=incident');
    }

    $this->setTemplate('edit');
  }


But each getParameter after the "if" of the checkbox returns a null value, whereas it should return what the user wrote... (i notice the first getparameter works fine (idincident))

Why am I having this problem ? I don't understand...

Thanks

Solved :
I forgot to write the field names with the name of the module. Instead of writing $modele->setNommodele($request->getParameter('nomincident'));, i write $modele->setNommodele($request->getParameter('incidents[nomincident]'));.

[Updated on: Mon, 29 December 2008 10:28]

 Topic: Embed Images in Emails
Embed Images in Emails [message #69037] Fri, 02 January 2009 12:35
Shawnstein  is currently offline Shawnstein
Messages: 61
Registered: April 2008
Member
Hello,

i want to send embed images in an email. I have try to use this example:

http://www.symfony-project.org/cookbook/1_1/en/email

// Create the mailer and message objects
  $mailer = new Swift(new Swift_Connection_NativeMail());
  $message = new Swift_Message('Test Email');
 
// Inline images
$images = array();
$images['oben'] = new Swift_Message_Image(new Swift_File(sfConfig::get('sf_web_dir').'/images/468x60_1.gif'));

 
$imageReferences = array();
foreach ($images as $name => $image)
{
  $imageReferences[$name] = $message->attach($image);
}



  // Render message parts
  $mailContext = array('name' => 'Name', 'images' => $imageReferences);
  $message->attach(new Swift_Message_Part($this->getPartial('mailBody', $mailContext), 'text/html'));
  $message->attach(new Swift_Message_Part($this->getPartial('mailBody', $mailContext), 'text/plain'));
 
  // Send
  $mailer->send($message, 'test@googlemail.com', 'info@test.de');
  $mailer->disconnect();



but i have the problem, that when i take the image into my partical like this:


<img src="<?php echo $images['oben']; ?>"/>


the email doen't send=( If i take it away, it works and my image is a the end of my email.

Does anybody know whats wrong?

Thanks


 Topic: HOWTO sfValidatorDate in validators/*.yml
icon5.gif  HOWTO sfValidatorDate in validators/*.yml [message #69713] Mon, 12 January 2009 13:07
rodush  is currently offline rodush
Messages: 33
Registered: October 2008
Location: Ukraine
Member
Hi all!

Using Symfony 1.1.6

I have a question about how one can implement validating of date field via new sfValidator* Classes in YAML files?

What I'm trying to do is validate date format posted from form.
I tried to put in my "edit.yml" smth. like this:

fields:
  v_currency_rate{date}:
    required:
      msg:       The «Date» field cannot be left blank
    sfValidatorDate:
      bad_format:           Bad date format
      date_format:          /[0-9]{4}-[0-9]{2}-[0-9]{2}/
      date_format_error:    The date format is wrong


When I post data exception occurs:
sfValidatorDate does not support the following error codes: 'date_format', 'date_format_error'.


In old symfony versions sfDateValidator was used. But it belongs to Symfony 1.0 family, and sfCompat10 mode should be enabled for it to work correctly...


P.S.: my form is generated with sfAdminGenerator, not throw sfFormWidgets...


Don't worry!
Be happy!
 Topic: Admin generator problem
Admin generator problem [message #70147] Sun, 18 January 2009 03:57
Jayrome  is currently offline Jayrome
Messages: 18
Registered: November 2008
Junior Member
Hi,

During the development of my app, I'm encoutering a strange problem. I created 4 tables in my database, and I did the propel-init-admin 4 times.

Three of the four modules work fine, which means I can properly add items to the database via the generated admin. For the fourth module, I can access all the views, but the forms don't seem to work (I click on the create button which brings me to a new and fresh form, but when I click on the save button, I'm redirected to the list action).

On my way googling, I found a message on the symfony-users Google Group, where the poster had the same problem as me. Fabien Potencier answered and told him it was a routing issue.

As a matter of fact, I can't resolve my problem that way since the routing.yml I'm using is the default one.

The logs tell me this :

{sfWebResponse} Send content (35633 o)
{sfPatternRouting} Connect "/"
{sfPatternRouting} Connect "/symfony/:action/*"
{sfPatternRouting} Connect "/:module"
{sfPatternRouting} Connect "/:module/:action/*"
{sfFrontWebController} Initialization
{sfPatternRouting} Match route [default] for "/:module/:action/*"
{sfWebRequest} Request parameters array (  'module' => 'answer',  'action' => 'save',  'id' => '',  'answer' =>   array (    'question_id' => '3',    'content' => 'Test',    'right' => 'Y',  ),  'save' => 'save',)
{sfContext} Initialization
{sfFrontWebController} Dispatch request
{sfFilterChain} Executing filter "sfRenderingFilter"
{sfFilterChain} Executing filter "sfCommonFilter"
{sfFilterChain} Executing filter "sfValidationExecutionFilter"
{answerActions} Call "answerActions->executeSave()"
{answerActions} Forward to action "answer/edit"
{sfFilterChain} Executing filter "sfRenderingFilter"
{sfFilterChain} Executing filter "sfCommonFilter"
{sfFilterChain} Executing filter "sfValidationExecutionFilter"
{answerActions} Call "answerActions->executeEdit()"
{sfDebugConnection} connect(): DSN: array (   'compat_assoc_lower' => NULL,   'compat_rtrim_string' => NULL,   'database' => 'sf_pmi',   'encoding' => NULL,   'hostspec' => 'localhost',   'password' => NULL,   'persistent' => NULL,   'phptype' => 'mysql',   'port' => NULL,   'protocol' => NULL,   'socket' => NULL,   'username' => 'root', ), FLAGS: 0
{sfDebugConnection} beginning transaction.
{sfDebugConnection} beginning transaction.
{sfDebugConnection} prepareStatement(): INSERT INTO answer (QUESTION_ID,CONTENT,RIGHT) VALUES (?,?,?)
{sfDebugConnection} executeUpdate(): INSERT INTO answer (QUESTION_ID,CONTENT,RIGHT) VALUES (3,'Test',0)
{sfDebugConnection} rolling back transaction.
{sfDebugConnection} rolling back transaction.
{sfWebRequest} Error in form for parameter "edit" (with message "Could not save the edited Answers.")
{answerActions} Forward to action "answer/list"


Any other idea ? Thanks a lot Smile
 Topic: Admin generator with ajax
Admin generator with ajax [message #70200] Mon, 19 January 2009 13:01
rvfernandes  is currently offline rvfernandes
Messages: 4
Registered: August 2008
Junior Member
How do I use the Admin generator with ajax?
 Topic: Search engine for symfony 1.1
Search engine for symfony 1.1 [message #70747] Mon, 26 January 2009 15:09
lore80281  is currently offline lore80281
Messages: 75
Registered: October 2008
Member
Hi, i have implement a search engine in my web site as askeet projet (tabel search).

The search go well:
If i search boys, i have the result of boys.

Now, i'd like th have the result even if i insert a fartial word (if i search symf, i have also the result symfony).

This is my query:
...
    $con = sfContext::getInstance()->getDatabaseConnection('propel');
   
    // define the base query
    $query = '
        SELECT DISTINCT '.RicercaPeer::PRODOTTO_ID.', COUNT(*) AS number, SUM('.RicercaPeer::PESO.') AS total_weight
        FROM '.RicercaPeer::TABLE_NAME;
        
    $query .= '
      WHERE ';
   
    $query .= '
        ('.implode(' OR ', array_fill(0, $nb_words, RicercaPeer::PAROLA.' = ?')).')
        GROUP BY '.RicercaPeer::PRODOTTO_ID;
   
    // AND query?
    if ($exact)
    {
      $query .= '
        HAVING number = '.$nb_words;
    }
   
    $query .= '
        ORDER BY number DESC, total_weight DESC';
...

What must i change or add for implement a select LIKE ?
 Topic: Ajax reqest from one form and two urls
Ajax reqest from one form and two urls [message #70811] Tue, 27 January 2009 13:18
rajeevr
Messages: 91
Registered: April 2008
Member
How can I call two urls with one condition in link_to_remote tag?
 echo link_to_remote(image_tag('icn_delete.gif',array('height'=>'11',
'width'=>'11','title'=>'Delete')),array(
'update' => 'Tabs',
'url' => 'module/firstList' 

)) 


I need another url as 'url' => 'module/secondList' ...
And my condition is
if (!$sf_flash->get('flash_value'))
{
'url' => 'module/firstList' 
}
{

'url' => 'module/secondList' 
}

How can I wrote this in link_to_remote tag...( Note: the same situation happends to form_tag also)?
 Topic: Transactional Behaviors?
Transactional Behaviors? [message #70847] Tue, 27 January 2009 17:52
Player0  is currently offline Player0
Messages: 1
Registered: January 2009
Location: Boston, MA
Junior Member
I'm using symfony 1.1 and sfPropel 1.3 and want to use behaviors to generate audit logs. So anytime a particular entity is save()'d, I will use a behavior hook in order to write this event to a separate audit table. In fact, this is done and seems to work well.

Some questions:

1.) I assume that this behavior is not transactional automatically, is this correct? I'm using MySQL & InnoDB but I do not start transactions before every save() call. Currently I am using the save:pre hook.

2.) Since doing proper transactions may be difficult in this case, can I assume that save:post implies a successful save of the object? If not, is there some status of the failure passed to the behavior? I only want to report to the audit log things that have successfully saved.

I'm still a symfony newbie so please forgive these questions if they don't make sense Smile
 Topic: File Upload vs Post validator
File Upload vs Post validator [message #70879] Wed, 28 January 2009 02:01
d_chu  is currently offline d_chu
Messages: 1
Registered: January 2009
Location: Sydney
Junior Member
Hi all,

I am now facing an issue with using post validator + file upload widget... it looks like when I am using post validator, the traditional input file code doesn’t work… Pls see below for detail:

1) Code written in modules/ob/action.class [action class in module]

$this->form = new obForm();
……..

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

$this->form->bind($request->getParameter('ob'),$request->getFiles('ob'));
if ($this->form->isValid())
{
$file =this->form->getValue('relatedAttachment');
if ($file)
{
$this->getUser()->setAttribute('filename', $file->getOriginalName());
$file->save(sfConfig::get('sf_upload_dir').'/' . $file->getOriginalName());
}
}
}


2) code written for post validator in lib/form/obform.class [form class]

$this->validatorSchema->setPostValidator(new sfValidatorCallback(
array('callback' => array('ccblSMEValidator', 'execute'),
'arguments' => array()),
array('invalid' => 'Please provide SME name.')
));


When I include code post validator code in form class, then no matter I attach file path link or not, the return value of this->form->getValue('relatedAttachment') is always return as null, while I comment out post validator, it returns the value of file link.

I believe there is something wrong happened when the form called form->isValid function then trigger post validator function to be run which then clear the value of file input box... however this is just my guess...

 Topic: Form Value Failed by sfValidatorCallback Incorrectly Fails sfValidatorSchemaCompare
Form Value Failed by sfValidatorCallback Incorrectly Fails sfValidatorSchemaCompare [message #70962] Wed, 28 January 2009 21:14
asutula  is currently offline asutula
Messages: 11
Registered: July 2008
Junior Member
I have a form that accepts an email address and email address confirmation. I use sfValidatorEmail to verify the email address as being valid and sfValidatorCallback to call a custom validator that does a case-insensitive check of whether the email already exists in my database. Here is that part of my form class:
    $this->setValidators
    (
      array
      (
        'email' => new sfValidatorAnd(
          array(
            new sfValidatorEmail(),
            new sfValidatorCallback
            (
              array
              (
              	'callback' => array
                (
                  'myUniqueEmailValidator',
                  'execute',
                ),
                'arguments' => array()
              ),
              array
              (
              	'invalid' => 'This email addess is already registered.'
              )
            )
          )
        ),
        'email_conf' => new sfValidatorEmail()
      )
    );

And here is my myUniqueEmailValidator class that gets called with sfValidatorCallback:
class myUniqueEmailValidator
{
  public static function execute($validator, $value, $arguments)
  {
    $email = $value;

    $c = new Criteria();
    $c->setIgnoreCase(true);
    $c->add(MobileUserPeer::EMAIL, $email);
    $user = MobileUserPeer::doSelectOne($c);

    if(!$user)
    {
      return $value;
    }

    throw new sfValidatorError
    (
      $validator,
      'invalid',
      array
      (
      	'value'   => $value,
      	'invalid' => $validator->getOption('invalid')
      )
    );
  }
}

I then use a post validator with sfValidatorSchemaCompare to check that the supplied email and email confirmation are equal. Here is my form class code that does that:
    $this->validatorSchema->setPostValidator
    (
      new sfValidatorAnd
      (
        array
        (
          new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_conf', array(), array('invalid' => 'Passwords do not match.')),
          new sfValidatorSchemaCompare('email', sfValidatorSchemaCompare::EQUAL, 'email_conf', array(), array('invalid' => 'Email addresses do not match.'))          
        )
      )
    );

My problem is this: Given that the email and email confirmation supplied in the form are equal, if sfValidatorCallback (which uses myUniqueEmailValidator) fails, then sfValidatorSchemaCompare in the post validator fails as well. It is as if the email value being passed to sfValidatorSchemaCompare has changed because it failed sfValidatorCallback and is no longer equal to the email confirmation value.

Any idea what is going on here? Thank you.

- Aaron
 Topic: Error when Upload file to database
Error when Upload file to database [message #71232] Mon, 02 February 2009 12:20
elmarkivo  is currently offline elmarkivo
Messages: 3
Registered: November 2008
Junior Member
hi, i'm having troubles uploading files to a database, any help is welcome.

this is the error.

Fatal error: Out of memory (allocated 279183360) (tried to allocate 51396931 bytes) in /var/www/apache2-default/path/Symfony_1.1/lib/symfony/plugin s/sfPropelPlugin/lib/vendor/creole/SQLException.php on line 63

this is the SQLExecepction file, lines 60 to 64.

60 public function setUserInfo($info)
61 {
62 $this->userInfo = $info;
63 $this->message .= " [User Info: " .$this->userInfo . "]";
64 }

the error appear when i try to upload files greater than 10 MB.
I have configured PHP.ini file like this.

max_execution_time = 500 ;
max_input_time = 500 ;
memory_limit = 500M;
post_max_size = 500M

so... i have no troubles to upload files of 50MB, but, when i want to encrypt them and store in database that error comes out.
i'm using Postgres 8.1 with pgcrypto function to store the files encrypted in database.

thanks !




 Topic: generate html/xml based on a template and send using action
generate html/xml based on a template and send using action [message #71254] Mon, 02 February 2009 15:19
Larzack  is currently offline Larzack
Messages: 71
Registered: April 2007
Member
Hello,

I'm implementing a payment mode and i have to use a webservice.
On this webservice, i have to send an XML file.
On this XML file i have to put some HTML code ( the order )

Here is the process :
1) save order into DB before calling the payment provider
2) generate the xml and the html order details
3) call the payment provider

I generated the HTML code into the action class. ( I table + rows + localized text + order informations )

My question is :
How to design the page in the template and use it in the action to communicate with the payment provider ?

Rgs
 Topic: display multipal checkbox checked ?
display multipal checkbox checked ? [message #71539] Thu, 05 February 2009 13:04
rupali  is currently offline rupali
Messages: 15
Registered: December 2008
Location: india
Junior Member

hi all

my problem is

how to pass checked values array into checkbox class into lib

i mean to se that how can i display multipal checkbox checked at same time(edit profile) using symfony1.2 + doctrine


single checkbox checked and unchecked working fine



waiting for reply
thanks in advance
rupali
 Topic: how to store parameter/tag in response?
how to store parameter/tag in response? [message #71726] Sat, 07 February 2009 13:44
layanto  is currently offline layanto
Messages: 35
Registered: September 2007
Member
I am using isicsBreadcrumbsPlugin which in symfony 1.0 uses sfResponse to store breadcrumbs parameter in the response (as such is cached).

In symfony 1.1, sfResponse (or rather sfWebResponse) no longer support ParameterHolder. Is there a way to store parameter or custom data in the response (other than javascript, css, etc)?
 Topic: Second argument of $sf_params->get in template.
Second argument of $sf_params->get in template. [message #71828] Mon, 09 February 2009 02:53
gomo  is currently offline gomo
Messages: 5
Registered: December 2008
Junior Member
Hi.
When escaping_strategy is off, Second argument of '$sf_params->get' in tamplate is default value.But When escaping_strategy is on, it is escaping method name.
This is correct?
I think same results is better.

[Updated on: Mon, 09 February 2009 02:54]

 Topic: SfFPDFPlugin configuration
icon10.gif  SfFPDFPlugin configuration [message #72021] Tue, 10 February 2009 16:03
aabbassi  is currently offline aabbassi
Messages: 2
Registered: February 2009
Location: France
Junior Member
Bonjour,
je suis un développeur web je suis en train de développer une application avec Symfony,
j'ai besoin d'utiliser le plugin sfFPDFPlugin pour créer un fichier pdf. quelqu'un a une idée comment utiliser ce plugin car je suis limité par le temps et je dois finir cr truc dans le plus proche possible merci d'avance pour vos aides.Smile
 Topic: Strange Session/Cookie-Problem
Strange Session/Cookie-Problem [message #72345] Fri, 13 February 2009 12:02
Moridin  is currently offline Moridin
Messages: 1
Registered: November 2008
Junior Member
Hello,

i´ve a very strange problem with sessions/cookies.

All works fine, when the root-dir of my symfony-project is on the same drive like xampp (1.7.0 on win xp) and symfony 1.1
But when i try to run my symfony-project on another drive, no session-data will be available after any request.
It does not matter, where symfony itself is located, it seems that this problem only depends on if my symfony-project is located on the same drive like xampp or not.
This problem also exists with symfony 1.2.
This problem does not exist in other PHP-projects.
I think all pathes in php.ini are correct.

Any ideas how i could my projects working on another drive than xampp?
Pages (169): [ «  <  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  >  »]

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software