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: sfFormPropel save behaviour
sfFormPropel save behaviour [message #57338] Wed, 30 July 2008 15:08
cthulhu  is currently offline cthulhu
Messages: 48
Registered: February 2006
Member
Hi,
before I open a ticket for my issue, I post it here to ask your opinions.
If I use a form without including a field in the view (E.G. I have a field comments that is not visible in some views) and I don't unset the field in the configure method of the form, when I save the form the missing field is overwritten as null.
I think this is a little weird. Don't you?
Do I have to implement two different subclasses, one with the comments field unset and one not?
Or should I have to unset comments field in the action where I don't want it to display?

Thanks
 Topic: [Admin Generator] How to transform posted value after the validation
[Admin Generator] How to transform posted value after the validation [message #57361] Wed, 30 July 2008 21:34
polem  is currently offline polem
Messages: 1
Registered: July 2008
Junior Member
Hello,

I trying to transform one posted value from admin generator.
I want transform this value after validation.
and i want that action occures only if this value is updated or is new.

I try with save() but it transform my value everytime i save something.

Two examples :

1.

I want save the date of last modification of an article only if the content of article is edit.

2.

I want encrypt a password only if a new password is set ( and after the validation of the lengh of the password)



I would be very gratefull, if someone could resolve my problem


thx a lot - and escuse my english




 Topic: sfTestBrowser and setField
sfTestBrowser and setField [message #57373] Thu, 31 July 2008 02:46
symfbab  is currently offline symfbab
Messages: 1
Registered: July 2008
Junior Member
Dear all,

I am trying to set field in a form for testing purpose.
Here is an excerpt of the file
test/functional/frontend/postActionsTest.php

$browser->get('/post/create') ;
$browser->click ( 'Save', array ( 'title' => 'Populated by a test run' ) ) ;

It does create a new record but does not populate the field 'title' with the value 'Populated by a test run'.

Do you see any reason for that in 1.1 (I tried to put 'post[title]' but does not work either).

Thx for your help, Fred.

Context :
I am using the Blog project depicted at
http://www.symfony-project.org/tutorial/1_1/my-first-project
and I created it from scratch using
symfony generate:project and symfony generate:app
 Topic: Special characters in URL
Special characters in URL [message #57397] Thu, 31 July 2008 12:24
joostdj  is currently offline joostdj
Messages: 44
Registered: November 2007
Member
I would like the following URL to be working (the tag is 'ac/dc'):

http://www.domain.com/tag/ac%2Fdc


When I try this, it gives a 404 error.

The routing rule is:

tag:
  url:   /tag
  param: { module: event, action: tag }


Is there a way to allow some special characters, so that URL-encoded strings can be used in a pretty URL?

[Updated on: Thu, 31 July 2008 12:25]

 Topic: sfPropelPlugin loadData() and loadDataFromArray() troubles (with solution, kind of)
sfPropelPlugin loadData() and loadDataFromArray() troubles (with solution, kind of) [message #57479] Thu, 31 July 2008 21:08
rsevero  is currently offline rsevero
Messages: 18
Registered: July 2008
Junior Member
I'm having troubles loading data fixtures for unit tests with sfPropelPlugin loadData() and loadDataFromArray() as per Chapter 15 of symfony's book < http://www.symfony-project.org/book/1_1/15-Unit-and-Function al-Testing#Accessing%20a%20Database>.

loadData() is complaining about The object "County_3100906" from class "County" is not defined in your data file. when trying to load the file below:
Pib:
  Pib_3100906_10025:
    county_id: County_3100906
    activity_id: Activity_10025
    past: '40.00'
    present: '49.94'
    future: '111.66'

The "County_3100906" isn't really defined in the yml file because I'm trying to separate several fixtures for several different tests.

"County_3100906" is already at the database so referential integrity is guaranteed in my database. As loadData() still complains I can only understand that loadData() is complaning about the lack of referential integrity on the yml file!?!? Is this intented? Should yml fixture files be tested by this kind of validation? I thought yml fixture files where simple (as in no hassle) containers for data to be loaded. Just that.

Then I tried the second option present on the above link: loadDataFromArray(). Unfortunatelly I got the following error:

Notice: Undefined property: sfPropelData::$dbMap in /var/www/localhost/sedvan_mapa/plugins/sfPropelPlugin/lib/pr opel/addon/sfPropelData.class.php on line 80

There already is a ticket about this issue here: http://trac.symfony-project.org/ticket/3975. Unfortunatelly the proposed patch didn't solve the problem for me. I even applied it to both /usr/share/php/symfony/plugins/sfPropelPlugin/lib/propel/sfP ropelData.class.php (installed by PEAR) and /var/www/localhost/myproject/plugins/sfPropelPlugin/lib/prop el/addon/sfPropelData.class.php (installed by sfPropelPlugin1.3).

As both proposed solutions failed to me I using a more straight solution: loading my fixtures straight from SQL files like the one below:
INSERT INTO `pib` (`county_id`, `activity_id`, `past`, `present`, `future`) VALUES
(3100906, 10025, '40.00', '49.94', '111.66')

It's working but should it be like this?

[Updated on: Thu, 31 July 2008 21:15]

 Topic: Can I put schema.xml in my module
Can I put schema.xml in my module [message #57594] Fri, 01 August 2008 18:01
ingvar  is currently offline ingvar
Messages: 21
Registered: July 2008
Location: Ukraine
Junior Member
For example:

/home/symfony_sandbox/apps/frontend/modules/content/config/s chema.xml
/home/symfony_sandbox/apps/frontend/modules/posts/config/sch ema.xml

This command not make files, this dir is ignored.

$ symfony propel:build-model
$ symfony propel:build-sql

What can I do?
 Topic: My First Project Propel Exception
My First Project Propel Exception [message #57611] Fri, 01 August 2008 21:17
thatsgreat2345  is currently offline thatsgreat2345
Messages: 1
Registered: August 2008
Junior Member
I was following the My First Project. When I got to the part where it says you can add some posts I went to the module http://localhost/sf_sandbox/web/frontend_dev.php/post
http://localhost/sf_sandbox/web/frontend_dev.php/comment

but it through propel exceptions when I tried to go to them

comment - http://i38.tinypic.com/34qk9wm.jpg
post - http://i33.tinypic.com/281hnr9.jpg

any help would be greatly appreciated
 Topic: i18n problem
i18n problem [message #57929] Tue, 05 August 2008 15:18
chick  is currently offline chick
Messages: 3
Registered: August 2008
Junior Member
Hi,

I'm developping a site which has to be translated from french to english.

Here is my settings.yml file :

all:
  .settings:
    rich_text_fck_js_dir:	js/FCKeditor
    i18n:					on
    standard_helpers:       [Partial, Cache, Form, I18N]
    default_culture:		fr_FR
    charset:				utf-8

prod:
  .settings:
    web_debug:              on
    cache:                  on

dev:
  .settings:
    web_debug:              on
    cache:                  off

test:
  .settings:
    cache:                  on
    web_debug:              on


I have a messages.en.xml in the i18n folder which is valid.

In my main layout.php, i have added somme translation calls, for instance :

<?php echo __('Présentation') ?>


It works just fine when i'm using the dev environment (site_dev.php). When i set the culture to en_US, the translation specified in my XLIFF file is displayed.

BUT when i use the prod environment, i've got a blank page (actually when i look at the HTML source, the code stops at the first __() call).

If i add manually the use_helper('I18N') in my layout file, the page is displayed but the translation doesn't work.

Can anyone help me ?
Thanks in advance Smile
 Topic: Module by AdminGenerator
Module by AdminGenerator [message #58067] Wed, 06 August 2008 15:16
Alphax  is currently offline Alphax
Messages: 42
Registered: February 2008
Member
Hello

created a module by AdminGenerator, but must disable the action edit and create ... It is possible to do this?
 Topic: Doctrine problem
Doctrine problem [message #58080] Wed, 06 August 2008 16:59
nemodex  is currently offline nemodex
Messages: 3
Registered: March 2008
Location: Castelfranco Veneto(TV)
Junior Member
Hi guys,
today i installed the new symfony 1.1 with doctrine plugin.

I follewed these tutorial
http://www.symfony-project.org/blog/2008/06/16/getting-start ed-with-doctrine-and-symfony-1-1

but when i run :
-> php symfony doctrine-build-all-reload frontend
I got these message

Invalid schema element named "record_listeners"
at path "all"

and i can't get the model!!!!! Sad
What can i do??

Many thanks

Andrea


Fletto i muscoli .... e sono nel vuoto!
 Topic: Form-Validation -> Login, checking username and password
Form-Validation -> Login, checking username and password [message #58081] Wed, 06 August 2008 17:04
hasch  is currently offline hasch
Messages: 12
Registered: August 2008
Junior Member
I have a little validator-class:
class LoginValidator extends sfValidatorString {
    public function configure($options = array(), $messages = array()) {  
    }                                          
    
    public function doClean($value) {
        $query = new Doctrine_Query();
/** Query **/
        throw new sfValidatorError($this, 'wrong_user');
    }
}


class LoginValidatorSchema extends sfValidatorSchema {
	public function __construct($options = array(), $messages = array()) {
		parent::__construct(array(
								 	'name' => new LoginValidator(),
									'password' => new sfValidatorPass()), $options, $messages);
	}
} 


I can use this validator for one parameter, but how can I get the password-post-parameter to check login in the database?

[Updated on: Wed, 06 August 2008 17:06]

 Topic: Doctrine + init-admin problem
Doctrine + init-admin problem [message #58117] Wed, 06 August 2008 22:11
bashman  is currently offline bashman
Messages: 2
Registered: August 2008
Junior Member
Greetings. I am working in Doctrine and
I have followed these steps:

$ symfony generate:project sead (Perfectly)
$ symfony generate:app sistema (Perfectly)
$ svn co http://svn.symfony-project.com/plugins/sfDoctrinePlugin/trun kplugins/sfDoctrinePlugin (Perfectly)
$ symfony doctrine:buil-schema sistema (perfectly)
$ symfony doctrine:build-model (Perfectly)
$ symfony doctrine:init-admin sistema articulos Articulos (Perfectly)
$ symfony doctrine:init-admin sistema grupo Grupo (Perfectly)
[...]
The database:
[...]
databases.yml:
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: mysql://root@localhost/sead
[...]
CREATE TABLE `articulos` (
`codarticulo` int(10) NOT NULL auto_increment,
`codgrupo` int(5) NOT NULL,
'nombre` varchar(20)
...
PRIMARY KEY (`codarticulo`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Articulos'
AUTO_INCREMENT=1 ;

CREATE TABLE `grupo` (
`codgrupo` int(5) NOT NULL auto_increment,
`nombre` varchar(10) default NULL,
PRIMARY KEY (`codgrupo`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Grupo de artículos'
AUTO_INCREMENT=1 ;

.../sistema_dev.php/articulos -> 404
.../sistema_dev.php/grupo -> You must set "compat_10" to true if
you want to use this method which is deprecated.

symfony version 1.1.1 (/usr/share/pear/symfony)
Fedora Linux - PHP 5.2.6 (cli) (built: May 8 2008 10:23:54)

Propel Works FINE!.

Doctrine should work correctly?, I have a mistake?,
I make any changes?.


Jose Luis Regalado
Linux user 280.381
http://bashman.wordpress.com
 Topic: Propel Timestamp conversion Exceptions
Propel Timestamp conversion Exceptions [message #58222] Thu, 07 August 2008 20:31
anveo  is currently offline anveo
Messages: 6
Registered: July 2008
Junior Member
I am getting this exception

Error populating Article object [wrapped: Unable to convert value at column 13 to timestamp: 0000-00-00 00:00:00]


From what I understand this was a bug in PHP 5.2.4 but is fixed now in Symfony/Creole. I do not receive this error on my development workstation, but I do on staging and production.

Development: Ubuntu 8.04, PHP 5.2.4, MySQL 5.0.51a, symfony 1.1.0
Staging: Ubuntu 8.04, PHP 5.2.4, MySQL 5.0.51a, symfony 1.1.0
Production: CentOS 4.6, PHP 5.2.5, MySQL 5.0.51a, symfony 1.1.0

Databases have same table types, columns, and collations.

If I change the MySQL DATETIME's to NULL default, everything is fine. However I do not understand why I receive no errors on development, but I do on similar setups. I would also rather avoid changing the defaults to NULL if I can avoid it.

I also understand this might not be an issue anymore in Propel 1.3, but we are still using 1.2 and would rather not switch at the moment.

[Updated on: Thu, 07 August 2008 20:33]

 Topic: Cascading Dropdowns in new Forms Framework
Cascading Dropdowns in new Forms Framework [message #58239] Fri, 08 August 2008 01:46
bltcoder  is currently offline bltcoder
Messages: 9
Registered: January 2008
Location: Austin, TX
Junior Member
Anyone have any ideas on how to easily implement server-side cascading dropdowns in the new Forms framework?

My initial thought was to do something similar to:
class MyForm extends sfForm
{
   static $make = array('Acura', 'Audi', 'BMW');

   static $model = array(
      'Acura' => array('Integra', 'RL', 'TL'),
      'Audi'  => array('A4', 'S4', 'A6'),
      'BMW'   => array('3 series', '5 series', '7 series')
   );

   public function configure()
   {
      $this->setWidgets(array(
         'make' => new sfWidgetFormSelect(array('choices'=>$make)),
         'model' => new sfWidgetFormSelect(array('choices'=>$model[$this->getValue('make')]))
      ));
   }
}

but this clearly won't work as configure is called before any tainted or cleaned values have been bound.

I realize I can (and probably should) do this in javascript, but from a rapid-prototyping point of view it would be nice to do this via the forms framework.

Any ideas would be much appreciated.
 Topic: Passing data from template to validator.yml
Passing data from template to validator.yml [message #58285] Fri, 08 August 2008 14:49
ringhio  is currently offline ringhio
Messages: 54
Registered: August 2008
Member
Hi guys, I'm looking for a way to get data in a .yml validation file for a form (old way with compat_10) from the template where I've some hidden input tags like name_field_1, name_field_2, name_field_3... numbered in a foreach loop.

How can I pass the number of the field to the validation file? Is it possible?

methods:
  post: [credits, bet_result_XXX]

names:
  credits:
    required:       true
    required_msg:   The credit field cannot be left blank
    validators:     creditsValidator
  bet_result_XXX:
    required:       true
    required_msg:   You must select a result
    validators:     creditsValidator


Thanks in advance

Daniel
 Topic: load-data not correct working?! (Composite Primary Key with Foreign Key)
load-data not correct working?! (Composite Primary Key with Foreign Key) [message #58292] Fri, 08 August 2008 15:58
rillsoft  is currently offline rillsoft
Messages: 5
Registered: August 2008
Junior Member
Hello all,

schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<database name="propel" defaultIdMethod="native" package="lib.model">
  <table name="client">
    <column name="id" type="INTEGER" required="true" primaryKey="true"/>
    <column name="name" type="VARCHAR" size="255"/>
  </table>
  <table name="folder">
    <column name="id" type="INTEGER" required="true" primaryKey="true"/>
    <column name="client_id" type="INTEGER" required="true" primaryKey="true" />
    <foreign-key foreignTable="client" onDelete="cascade">
       <reference local="client_id" foreign="id"/>
    </foreign-key>
    <column name="folder_id" type="INTEGER"/>
    <foreign-key foreignTable="folder" onDelete="cascade">
        <reference local="folder_id" foreign="id" />
    </foreign-key>
    <column name="name" type="VARCHAR" size="255" required="true" />
  </table>
</database>



data.yml
Client:
   C1:
      id:           0
      name:         Main
      
Folder:
   F1:
      id:           0
      client_id:    C1
      name:         Root
   F2:
      id:           1
      client_id:    C1
      folder_id:    F1
      name:         Child1
   F3:
      id:           2
      client_id:    C1
      folder_id:    F2
      name:         Child2
   F4:
      id:           3
      client_id:    C1
      folder_id:    F3
      name:         Child3



Folder: original results (folder_id not correct)
id      client_id  folder_id  name
----------------------------------
0       0          (Null)     Root
1       0          1          Child1
2       0          1          Child2
3       0          1          Child3


Folder: expected results
id      client_id  folder_id  name
----------------------------------
0       0          (Null)     Root
1       0          0          Child1
2       0          1          Child2
3       0          2          Child3


How I can load my data in my database?

Thanks for all
 Topic: How can the class attribute of an auto generated select menue be changed?
How can the class attribute of an auto generated select menue be changed? [message #58300] Fri, 08 August 2008 16:45
Stasy  is currently offline Stasy
Messages: 30
Registered: January 2007
Member
Hi,

how can I change the class attribute of an auto generated select menue?

I have a database table named "user" that contains a datetime column. After I executed "symfony propel:build-forms" and "symfony propel:generate-crud" the UserForm.class.php contains an emtpy configure() method.

When I open a browser to edit an entry, 5 dropdown menues are displayed for this datetime column.

I could not find a solution how to set an alternate class name for the auto generated selects. By default, the dropdowns are too small and I'd like to change their widths via CSS.

When I try
$this->widgetSchema['username']->setAttributes(array('class' => 'foobar'));
for a text type input field everything works fine.

But
$this->widgetSchema['registered_at']->setAttributes(array('class' => 'foobar'));
does not work.

Please help.
Thanks!
 Topic: Problem with sfWidgetFormSelect
Problem with sfWidgetFormSelect [message #58308] Fri, 08 August 2008 18:04
JackJones  is currently offline JackJones
Messages: 67
Registered: February 2007
Member
Hello Everyone

I want use the sfWidgetFormSelect. I wrote in my configure method:


$choices = ArticlePeer::getClientArticles(sfContext::getInstance()->getUser()->getAttribute('clientID'));
$this->widgetSchema['sub_article_id']->setOption('choices', $choices); 	



And this one is my peer function:

public static function getClientArticles(){
  $c	= new Criteria();
$c->add(ArticlePeer::CLIENT_ID,sfContext::getInstance()->getUser()- >getAttribute('clientID'));
  return ArticlePeer::doSelect($c);
	}


So i return not a criteria, i return objects. In SF 1.0 i use objects in sf 1.1 i need to return a criteria.

Is there a way to use objects for my sfWidgetFormSelect ? Because I can edit my hole object_select_tag's.

[Updated on: Fri, 08 August 2008 18:21]

 Topic: Doctrine Plugin and Firebird
Doctrine Plugin and Firebird [message #58340] Fri, 08 August 2008 23:06
glauberportella  is currently offline glauberportella
Messages: 8
Registered: July 2007
Location: Belo Horizonte, Minas Ger...
Junior Member
Hello,

I try many times to call doctrine:build-schema in my interbase 6.0 database but always got errors. So i get the root of the problem in connecting to Interbase via Doctrine and modified some line in /plugins/sfDoctrinePlugin/lib/doctrine/Doctrine/Connection.p hp on line 458 to put the default user and pass if the base was an Interbase/Firebird (i think it was some hard way and is not a solution, but i was research where are the error) so i put above line 458:

if (strtolower($e[0]) == 'firebird') {
  $this->options['username'] = !$this->options['username'] ? 'SYSDBA' : $this->options['username'];
  $this->options['password'] = !$this->options['password'] ? 'masterkey' : $this->options['password'];
}


Now i am getting the following error when try to run doctrine:build-schema:

SQLSTATE[HY000]: General error: -104 Dynamic SQL Error SQL error code = -104 Token unknown - line 1, char 4 NAMES

I need some help to get my Symfony app work with Interbase 6.0 and Doctrine (or if someone has another ORM i will be happy).

Thanks.


Glauber Portella
MacWeb Solutions
www.macweb.com.br
 Topic: Popel 1.3
Popel 1.3 [message #58346] Sat, 09 August 2008 08:50
galileo  is currently offline galileo
Messages: 9
Registered: October 2007
Junior Member
Hello i have problem with my project i installed a propel 1.3 and a build my model all was good and i freezed the project andworks with him and i want now extended my model when i do propel:build-all i get something like that:

>> schema putting ...rts/config/generated-schema.xml
Buildfile: ...\htdocs\emotorsports\plugins
\sfPropelPlugin\lib\vendor\propel-generator\build.xml
[PHP Error] Phing::include_once(phing\tasks\ext\svn\SvnLastRevisionTask. php): fa
iled to open stream: No such file or directory [line 1005 of ...\htdocs\emotorsports\plugins\sfPropelPlugin\lib\vendor\ph i
ng\Phing.php]
[PHP Error] Phing::include_once(): Failed opening 'phing\tasks\ext\svn\SvnLastRe
visionTask.php' for inclusion (include_path='...\htdocs\emotorsports;...\htdocs\emot
orsports\plugins\sfPropelPlugin\lib\task\..\vendor\propel-ge nerator\classes;
...\htdocs\emotorsports;D:\portables\PortableA
pps\XAMPP\App\xampp\php\PEAR\symfony;...\h
tdocs\emotorsports\plugins\sfPropelPlugin\lib\vendor/;.;...
\php\pear;...\php\pear\;D
:\portables\PortableApps\XAMPP\App\xampp\htdocs\emotorsports \plugins\sfPropelPlu
gin\lib\task/../vendor') [line 1005 of ...
\htdocs\emotorsports\plugins\sfPropelPlugin\lib\vendor\phing \Phing.php]

BUILD FAILED
exception 'ConfigurationException' with message 'Error importing phing\tasks\ext
\svn\SvnLastRevisionTask.php' in ...\htdoc
s\emotorsports\plugins\sfPropelPlugin\lib\vendor\phing\Phing .php:1013
Stack trace:
#0 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\vendor\phing\Phing.php(963): Phing::__import('phing\tasks\ext...', N
ULL)
#1 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\vendor\phing\Project.php(514): Phing::import('phing.tasks.ext...', N
ULL)
#2 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\vendor\phing\Project.php(149): Project->addTaskDefinition('svnlastre
vision', 'phing.tasks.ext...')
#3 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\vendor\phing\Phing.php(501): Project->init()
#4 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\task\sfPropelBaseTask.class.php(261): Phing->runBuild()
#5 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\task\sfPropelBuildModelTask.class.php(58): sfPropelBaseTask->callPhi
ng('om', true)
#6 ...\php\PEAR\symfony\task\sfBaseTask.cl
ass.php(68): sfPropelBuildModelTask->execute(Array, Array)
#7 ...\php\PEAR\symfony\task\sfTask.class.
php(97): sfBaseTask->doRun(Object(sfCommandManager), '')
#8 ...\htdocs\emotorsports\plugins\sfPrope
lPlugin\lib\task\sfPropelBuildAllTask.class.php(60): sfTask->run()
#9 ...\php\PEAR\symfony\task\sfBaseTask.cl
ass.php(68): sfPropelBuildAllTask->execute(Array, Array)
#10 ...\php\PEAR\symfony\task\sfTask.class
.php(75): sfBaseTask->doRun(Object(sfCommandManager), NULL)
#11 ...\php\PEAR\symfony\command\sfSymfony
CommandApplication.class.php(72): sfTask->runFromCLI(Object(sfCommandManager), N
ULL)
#12 ...\php\PEAR\symfony\command\cli.php(2
0): sfSymfonyCommandApplication->run()
#13 ...\htdocs\emotorsports\symfony(15): i
nclude('D:\portables\Po...')
#14 {main}

Total time: 0.7469 seconds



Error importing phing\tasks\ext\svn\SvnLastRevisionTask.php

Any Solution ??
 Topic: Getting the column name from a ResultSet
Getting the column name from a ResultSet [message #58558] Wed, 13 August 2008 01:11
tomerb  is currently offline tomerb
Messages: 8
Registered: August 2008
Location: Israel
Junior Member
Hello,

I have a query that gets information from 4 table sat the same time. Hence I do it in doSelectRS, and get a ResultSet object back.

My goal is to change it to JSON but for it to be general enough I need to put in the JSON the column names of the got columns.

Does anyone know how to do this?
How can I retrieve the column names from a ResultSet??

Thanks,


If there's a will there's a way,

Tomer.
 Topic: Is ConfigCache now a factory too?
Is ConfigCache now a factory too? [message #58620] Wed, 13 August 2008 18:57
GaryFx
Messages: 377
Registered: May 2008
Location: Masschusetts
Faithful Member
I'm finally getting around to finishing my 1.0->1.1 upgrade (or 1.1.1, to be precise). One of the first things I ran into was a failure in a custom generator on sfConfigCache->getInstance(). Changing this to sfContext::getInstance()->getConfigCache() seems to have worked.

Is this correct? If so, is this just a bug in the UPGRADE file, i.e. should sfConfigCache be added to the list of objects that are no longer singletons (in the section titled Singletons)?

Thanks,
Gary
 Topic: propel 1.3: Update foreign key
propel 1.3: Update foreign key [message #58690] Thu, 14 August 2008 15:54
ingvar  is currently offline ingvar
Messages: 21
Registered: July 2008
Location: Ukraine
Junior Member
Help me!

Use Symfony 1.1.2DEV
Propel 1.3

I have schema:
propel:
  catalog:
    id :            ~
    name:           { type: varchar, size: 255, required: true, index: unique }
    description:    { type: longvarchar }
    created_at:     ~
  
  catalog_product:
    id:             ~
    catalog_id:     { type: integer, primaryKey: true, required: true, foreignTable: catalog, foreignReference: id, onUpdate: cascade }
    title:          { type: varchar, size: 128 }
    price:          { type: integer }
    created_at:     ~



How I can update foreign key catalog_id. Example:

$product = CatalogProductPeer::retrieveByPK(1, 2);
echo $product->getCatalogId(); // print 2

$product->setCatalogId(3);
$product->save();


I don't see any changes

MySQL general log:
UPDATE catalog_product SET `CATALOG_ID`=3 WHERE catalog_product.ID=1 AND catalog_product.CATALOG_ID=3


catalog_product.CATALOG_ID=3 - why new CATALOG_ID


I want to see that:
UPDATE catalog_product SET `CATALOG_ID`=3 WHERE catalog_product.ID=1 AND catalog_product.CATALOG_ID=2
 Topic: Admin-generator vs builds-form + generate CRUD
Admin-generator vs builds-form + generate CRUD [message #58705] Thu, 14 August 2008 19:04
rccc  is currently offline rccc
Messages: 22
Registered: June 2008
Junior Member
Hello everybody,

As the admin generator uses symfony 1.0 validation system, i wonder if it would be better not to use it.

In another way, what is the difference between : init-admin on one side and builds-form + generate-crud on the other side ?

thanks by advance for response

rccc
 Topic: sfControlPanelPlugin not supported anymore
sfControlPanelPlugin not supported anymore [message #58808] Fri, 15 August 2008 17:35
kuckuck  is currently offline kuckuck
Messages: 21
Registered: September 2006
Junior Member
Hi

Is sfControlPanelPlugin not continued anymore? I can not install it for 1.1.

Best regards,
Jonas
 Topic: Filter and setTitle doesn't work?
Filter and setTitle doesn't work? [message #58890] Sun, 17 August 2008 13:13
freakx0  is currently offline freakx0
Messages: 77
Registered: November 2006
Location: Germany
Member
I've build a filter which sets the title of the page.
but it doesn't work correct...

<?php

class seitentitelFilter extends sfFilter
{
  public function execute($filterChain)
  {

    $response = $this->getContext()->getResponse();
    # $response->setTitle('IT WORKS!');
    // Nothing to do before the action
    $filterChain->execute();
 

    $items = isicsBreadcrumbs::getInstance()->getItems();

    $response->setTitle( 'test'. $items[count($items)-1]->getText() );

   }
}


The $items array is after the ->execute() correct, but after that the $response->setTitle( doesn't work, what goes wrong at my code?

 Topic: Escaping in View - nl2br doesn't work
Escaping in View - nl2br doesn't work [message #58925] Mon, 18 August 2008 12:00
hasch  is currently offline hasch
Messages: 12
Registered: August 2008
Junior Member
I read some data from the database and wrote it to $this->content[] array. I set escaping to on:
Quote:


escaping_strategy: on
escaping_method: ESC_SPECIALCHARS



How can I enable nl2br for this $content array in view without setting escaping_strategy to off?

Action:
$query = Doctrine_Query::create();
		$content = $query->from('phpbb_posts_text')->where('post_id = ?', $topic->getTopic_First_Post_Id())->execute();
		if($content->count() == 0) continue;
		$this->news[] = array(
							"title" => $topic->getTopic_Title(),
							"date" => $content[0]->phpbb_posts->getPost_Time(),
							"content" => ((strlen($content[0]->getPost_Text()) > sfConfig::get('app_news_short')) ? nl2br(substr($content[0]->getPost_Text(), 0, sfConfig::get('app_news_short')).'...') : nl2br($content[0]->getPost_Text()))
							);


View:
<?php foreach($news AS $entry): ?>
<h1><?php echo $entry['title']; ?></h1>
<p><?php echo strftime('%d. %B %Y', $entry['date']); ?></p>
<p><?php echo $entry['content']; ?></p>
<?php endforeach; ?> 
 Topic: admin generator - partials - pb for validation
admin generator - partials - pb for validation [message #58947] Mon, 18 August 2008 16:07
rccc  is currently offline rccc
Messages: 22
Registered: June 2008
Junior Member
Hello everybody,

Using the admin generator, I have some issues when including a custom field defined in a partial - i'm base on the example of the admin generator tutorial.

Here is my /modules/article/config/generator.yml
...

    edit:
      display: [id, title, content, created_at, _testPartial]



in /modules/article/templates/_test_partial.php
<?php echo textarea_tag('fieltest','') ?>


in /modules/article/validate/edit.yml
methods:  [post]
fields:
  article{title}:
    required:
      msg: ...
  article{content}
    required:
      msg: ...
  article{fieldtest}
    required:
      msg: ...


When editing an article, i have an 'undefined index': article{fieldtest} notice.

is someone has an idea of the problem ?

ps: if i change my edit.yml to :
methods:
  post:
    - "article{title}"
    - "article{content}"
    - "article{fieldtest}"

then, i have an sfParseException : "unregistered parent 'article' or subname'title'".

thanks by advance for any response

rccc

[Updated on: Mon, 18 August 2008 16:08]

 Topic: validating paired data
validating paired data [message #58965] Mon, 18 August 2008 21:52
BabySnake  is currently offline BabySnake
Messages: 81
Registered: March 2008
Location: Sweden
Member

Hi all!

I'm trying out the new form handling in 1.1 and i came upon a problem.
Let's say we have a page with two selects/dropdown boxes. The second one is sometimes required and sometimes not, it depends on which value we selected in the first select. In this example subcategory_id depends on the value selected in "category_id".

the template:
 <tr>
        <th><label for="item_category_id">Category</label></th>
        <td>
          <?php echo $form['category_id']->renderError() ?>
          <?php echo $form['category_id'] ?>
        </td>
</tr>
<tr>
        <th><label for="item_subcategory_id">Subcategory id</label></th>
        <td>
          <?php echo $form['subcategory_id']->renderError() ?>
          <?php echo $form['subcategory_id'] ?>
        </td>
      </tr>



This is from the form validation class (setup method):
$this->setWidgets(array(
      'category_id'    => new sfWidgetFormPropelSelect(array('model' => 'Category', 'add_empty' => 'Choose category here')),
      'subcategory_id' => new sfWidgetFormPropelSelect(array('model' => 'SubCategory', 'add_empty' => 'Choose subcategory here')),
    ));
$this->setValidators(array(     
      'category_id'    => new sfValidatorPropelChoice(array('model' => 'Category', 'column' => 'id', 'required' => true)),
      'subcategory_id' => new sfValidatorPropelChoice(array('model' => 'SubCategory', 'column' => 'id', 'required' => false)),      
    ));


Let's say i want to pass the subcategory if the value of category is "2", otherwise not.. How can i achieve that?

thnx!
 Topic: Blank Screen del.icio.us
Blank Screen del.icio.us [message #59029] Tue, 19 August 2008 16:17
patrickespake  is currently offline patrickespake
Messages: 49
Registered: January 2008
Location: Brasil
Member

I have an application made in symfony 1.1.

Sometimes when i run symfony cache:clear the application displays only blank screen.

In the log of symfony does not appear anything, nor in the log of apache.

This problem also occurs on the site del.icio.us, it was rewritten using symfony, always occurs blank screen.

Is this is a bug in symfony?


Patrick Espake
patrickespake@gmail.com
http://patrickespake.wordpress.com
 Topic: exception 'sfRenderException' with message ...
exception 'sfRenderException' with message ... [message #59081] Wed, 20 August 2008 07:29
mike_sapiens  is currently offline mike_sapiens
Messages: 2
Registered: July 2008
Junior Member
Yesterday I've got the exception exception
'sfRenderException' with message 'The template "indexSuccess.txt.php" does not exist or is unreadable in "".' in /home/chefs/tips/cache/frontend/prod/config/config_core_compile.yml.php:2193


but somehow it solved itself.

Today I got this
'sfRenderException' with message 'The template "widgetSuccess.xml.php" does not exist or is unreadable in "".' in /home/chefs/tips/cache/frontend/prod/config/config_core_compile.yml.php:2193


The code was unmodified and I don;t know how these exceptions appears. I do have the indexSuccess.php and the widgetSuccess.php templates, but don't know how the renderer came with .txt.php or .xml.php extensions.

Any ideas of what could be?
 Topic: custom Validators
custom Validators [message #59237] Thu, 21 August 2008 20:53
onlydust  is currently offline onlydust
Messages: 47
Registered: May 2008
Member
In my form i have field which is personal id number of person in my country, it is possible to validate that value of this ID because each digit mean something for example if 6-th digit is 1 person is a woman, and last digit is control digit. In symfony 1.0 i had custom validator file with function which validate it perfectly. But how can I use custom Validator(and how to create) in symfony 1.1? Anybody had that problem too?
 Topic: not mergin arrays in settings.yml
not mergin arrays in settings.yml [message #59243] Fri, 22 August 2008 00:02
scriptdog  is currently offline scriptdog
Messages: 22
Registered: May 2007
Junior Member
Hello, im trying to set anything that represents an array inside settings.yml

if i change this...

standard_helpers: [Partial, Cache, Form]

into this...

standard_helpers: [Partial, Cache, Form, Text]

i get this...

sf_standard_helpers:
- Partial
- Cache
- Form
sf_standard_helpers_0: Partial
sf_standard_helpers_1: Cache
sf_standard_helpers_2: Form
sf_standard_helpers_3: Text




but i think it suppose to be something like this...

sf_standard_helpers:
- Partial
- Cache
- Form
- Text


Any suggestion, i cant figure out whats the problem
 Topic: Using I18N features in helper function
Using I18N features in helper function [message #59255] Fri, 22 August 2008 09:02
cschnell  is currently offline cschnell
Messages: 29
Registered: August 2008
Junior Member
Hello all,

currently I am developing my first project with symfony and I am really confident with the whole framework. Great work. As it is always with first projects, I stumble across some problems, that might be quite easy to more experienced people.

My first question here is: Is it possible to work with the I18N features within helper functions? I wrote a 'stupid' helper that translates boolean values from the DB into words like 'Yes' or 'No'. Now I would like to use this helper with translation, so that the lingual representation of the String will automatically be translated according to the users culture.

I tried with
return(__('Yes'));
and the value gets collected into the translation XML, but is never displayed in a translated version. Now I am wondering, if I also have to pass the users culture to that helper, every time I call it?

Any other ideas?

Thanks and regards,
Christopher
 Topic: Customizing after the CRUD Generator
Customizing after the CRUD Generator [message #59266] Fri, 22 August 2008 10:35
zielos  is currently offline zielos
Messages: 10
Registered: November 2007
Junior Member
Hello,
in my project I have a problem with the form. I have a table sobis_klient and this is fragment of my schema.yml:
sobis_klient:
    _attributes:       { phpName: Klient, idMethod: native }
    id:                { type: integer, required: true, primaryKey: true, autoIncrement: true }
    nazwa:             { type: varchar(50), required: true, index: true }
    stripped_nazwa:    { type: varchar(80), index: true , unique: true }

After reading the two documents: Symfony Forms in Action(v1.1) and The Askeet Tutorial (v1.0) I tried to create
in the field 'stripped_nazwa' an alternate version of the nazwa field, just like in askeet aplication (stripped_title).
I did a new class myTools.class.php under the application/lib/ directory:

<?php
 
class myTools
{
  public static function 
stripText($text)
  {
    
$text strtolower($text);
 
    
// strip all non word chars
    
$text preg_replace('/\W/'' '$text);
 
    
// replace all white space sections with a dash
    
$text preg_replace('/\ +/''-'$text);
 
    
// trim dashes
    
$text preg_replace('/\-$/'''$text);
    
$text preg_replace('/^\-/'''$text);
 
    return 
$text;
  }
}
?>


and new function in application/lib/model/Klient.php:

<?php
public function setNazwa($v)
{
  
parent::setNazwa($v);
 
  
$this->setStrippedNazwa(myTools::stripText($v));
}
?>


everything is working okay when I use the command:
$ ./symfony propel:data-load frontend (from /data/fixtures/dane.yml),

but when i use CRUD Generator command:
$ ./symfony propel:build-forms
$ ./symfony propel:generate-crud frontend klient Klient 

and write/save data with the form it doesn't upadate my field stripped_nazwa Sad
Thank you for any answers!
 Topic: Link to a directory in /web
Link to a directory in /web [message #59268] Fri, 22 August 2008 11:23
klhoste  is currently offline klhoste
Messages: 10
Registered: August 2008
Location: Aix en Provence
Junior Member
Hello,

I created the /web/video directory in which I put videos and I want to make a link to a video from a template.

Currently I use this code :
var so = new SWFObject("/../videos/<?=$fonction->getFctUrlvideo() ?>", "csSWF", "640", "498");


It works fine for a local use, but not on a server (OVH).
I think this issue is due to the URL to access my website : http://start1g.ovh.net/~something so it must call the URL http://start1g.ovh.net/videos/urlToMyVideo... when I want to call http://start1g.ovh.net/~something/videos/urlToMyVideo...

Have I to use a method like url_for ? Do you have an idea ?

I think it is possible as the images, css or js directories are defined somewhere...

Thanks by advance,

Kévin

[Updated on: Fri, 22 August 2008 11:24]

 Topic: sfWidgetFormInput value - Database
sfWidgetFormInput value - Database [message #59277] Fri, 22 August 2008 13:01
Shawnstein  is currently offline Shawnstein
Messages: 61
Registered: April 2008
Member
hello,

i have a form with some Userdata's like:

'first_name' => new sfWidgetFormInput(array(), array(
				   'class' => 'text',
                                ))


now i want to fill this field with the first_name saved in my Database. Like this:

'first_name' => new sfWidgetFormInput(array(), array(
				   'class' => 'text',
                                   'value' => $this->getUser()->getGuardUser()->getProfile()->getFirstName()
                                ))


but this solution doesn't work. How i can realise this?
 Topic: Display all the fields plus the partial fields
Display all the fields plus the partial fields [message #59303] Fri, 22 August 2008 22:57
kurosaki  is currently offline kurosaki
Messages: 67
Registered: August 2008
Member
Howdy,

Let's suppose that I have this generator.yml

generator:
  class:              sfPropelAdminGenerator
  param:
    model_class:      Usuario
    theme:            default
    list:
        display: [ **I want all my fields here**, _partial]


As you see I have many fields, and some partials. because I have many fields I don't want to write them always, so how can I tell symfony that display all the fields (as the default way) AND then I can write my partials.

Thanks in advance.
 Topic: Multiple post-validators and error messages
icon4.gif  Multiple post-validators and error messages [message #59332] Sat, 23 August 2008 18:16
camason  is currently offline camason
Messages: 18
Registered: January 2008
Location: Plymouth, UK
Junior Member
Hello,

I have created 4 validators that I need to execute on my form. (They're all needed for a reason). However, I would only like to execute them in a precise order, and only if the previous one is successful.

For example:

Validate phone number with database... success
Validate another value with 3rd party service... FAIL
Validate another value with 3rd party service... FAIL
Validate another value with 3rd party service... FAIL


So, in this case, the second validator failed. I would like to display that error message, but none of the error messages after that failure (as they actually all depend on the previous validator). At the moment, if all 4 post-validators fail, all 4 errors are displayed, which is not what I would like.

Also, each validator needs a different 'invalid' message.

Thanks for the help!
 Topic: [Solved] Get application name in Filter?
[Solved] Get application name in Filter? [message #59339] Sat, 23 August 2008 23:22
hasch  is currently offline hasch
Messages: 12
Registered: August 2008
Junior Member
Does anyone know how to get the application name in a inherited sfFilter class?

Module and Action name can be used by the following method:
$this->getContext()->getModuleName();


but for the application name I haven't found something like this...

Solved:
$this->getContext()->getConfiguration()->getApplication();

[Updated on: Sun, 24 August 2008 20:11]

Pages (169): [ «  <  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  >  »]

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