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: image admin help
image admin help [message #72501] Sun, 15 February 2009 14:45
guadix  is currently offline guadix
Messages: 5
Registered: November 2008
Location: Buenos Aires, Argentina
Junior Member
Hello, i'm struggling with an product catalog i have to do, i'm quite lost with it. The problem is with the admin, each product can have several images.
I made a table for the products and a table for the images, the laters with a product foreign id. Then i thought about using the admin generator to this, it creates an admin for the images and one for the produts, but i need to have in the products edit page a way to add a new images and show the full catalog of that product.
So, can this be done with the admin generator? Any help/thoughts on this. Should i use a custom CRUD?
I will really appreciate any help with this!
 Topic: Textarea trouble
Textarea trouble [message #72585] Mon, 16 February 2009 16:43
ronni  is currently offline ronni
Messages: 9
Registered: November 2008
Junior Member
Hi!

I found strange error.
When I put in textarea big text (a few paragraphs, more 500 symbols) and submit form - I will get just clean white page (nothing else, even symphony debug bar in dev mode).

What is it? Crying or Very Sad
 Topic: blob field in data fixtures
blob field in data fixtures [message #72827] Wed, 18 February 2009 13:50
neuquino
Messages: 3
Registered: January 2009
Junior Member
Hi, How can I add an image to a fixture in order to populate the database with propel:data-load?

Example:

Author:
name: 'John Smith'
photo: ???????????

Thanks for your time.
Regards
 Topic: how to use wsdl plugins with record set return value.
icon5.gif  how to use wsdl plugins with record set return value. [message #72881] Thu, 19 February 2009 05:20
sarimoon  is currently offline sarimoon
Messages: 1
Registered: November 2008
Junior Member
I had try to use the symfony wsdl plugins tutorial with array, it's success. But now i want to get return value with a result set from a database.
How to do it ?
Thanks before. Smile
 Topic: i18n problem in form
i18n problem in form [message #72995] Fri, 20 February 2009 12:21
jefferson  is currently offline jefferson
Messages: 27
Registered: November 2007
Junior Member
i have an error message with a parameter value, i've read this tutorial http://www.symfony-project.org/book/forms/1_1/en/08-Internat ionalisation-and-Localisation#chapter_08_sub_error_messages_ internationalization

my problem is if i have a value in array the internalization doesn't work
throw new sfValidatorError($validator, 'Too many nicknames (more than %max%)', array('max' => $max)); 

i get the english text and not the localized, the value is set properly
if i delete the value
throw new sfValidatorError($validator, 'Too many nicknames (more than %max%)'/*, array('max' => $max)*/); 

i get the localized text with %max% and not the value
 Topic: Embedded Form Validation Group
icon13.gif  Embedded Form Validation Group [message #73030] Fri, 20 February 2009 19:56
nei_rauni  is currently offline nei_rauni
Messages: 5
Registered: July 2008
Location: Curitiba, Paraná, Brazil
Junior Member
hey, i need a help with form.

HOW Can I implement a postValidation of Group of embeddeds form??

by example:

I have a bookForm and bookRoomForm.

bookRoomForm is embbeded any times on bookForm, bookRoomForm has fields (name, qty_adults, room_id). I need to validate the total of qty_adults, about all room.

Do you have any idea to do it?

I didn't find nothing about it on internet


sf1.1
 Topic: How do I set a default time for sfWidgetFormDateTime?
How do I set a default time for sfWidgetFormDateTime? [message #73357] Wed, 25 February 2009 00:29
lkrubner  is currently offline lkrubner
Messages: 297
Registered: July 2008
Location: Virginia, USA
Faithful Member

I am looking here:

http://www.symfony-project.org/api/1_1/sfWidgetFormDateTime

How do I set the current moment as the default value?





Symfony Experts offers answers: http://www.symfonyexperts.com/
 Topic: upload a file to a DB
upload a file to a DB [message #73371] Wed, 25 February 2009 04:51
neuquino
Messages: 3
Registered: January 2009
Junior Member
I'm trying to upload an image to a blob field following this cookbook http://www.symfony-project.org/cookbook/1_0/en/upload.
Everything in this cookbook is great, My problem is that I'm using admin generator to do it, and I don't know how to save it to the DB instead of a file.
Here is the config I'm using and I want to modify:

generator.yml
    edit:
      display: [=imagen]
      fields:
        imagen:
          help: Tamaño máximo 1MB
          type: admin_input_file_tag
          upload_dir: imagenes
          params: include_remove=true


This code uploads the file to uploads dir and the path to the blob field. I want to save the image content in the blob field.
Thanks for your time.
 Topic: admin_input_file_tag and validation
admin_input_file_tag and validation [message #74136] Thu, 05 March 2009 17:04
whalexis  is currently offline whalexis
Messages: 207
Registered: July 2008
Faithful Member
Hi all,

I have trouble to validate my form.
My form is admin generated and contain an admin_input_file_tag.

Actually, if I validate my form with a jpeg or png image with a small size, I have no problem.
If I validate with a small text file, still no problem.
But when I tryed with a huge mp3 file, I have an error but not the one I am expected. My form is reseted and I have an error on the name field (picture in attachement).

Here is my generator.yml file conten:
generator:
  class:                     sfPropelAdminGenerator
  param:
    model_class:             Product
    theme:                   default
    css:                     reset
    
    fields:
      description:           { name: product_description_label }
      name:                  { name: product_name_label }
      price:                 { name: product_price_label }
      product_family:        { name: product_family_label }
      product_family_id:     { name: product_family_label }
    
    list:
      display:               [productFamily,name,price]
      max_per_page:          20
      object_actions:
        _edit:               ~
        _delete:             ~
      title:                 product_list_title

    edit:
      actions:
        _list:               ~
        _save_and_list:      ~
      display:
        "NONE":              [productFamilyId,name,description,price]
        "product_picture":   [picture]
        "product_site_list": [site_list]
      fields:
        description:         { type: textarea_tag }
        picture:             { name: nolabel, type: admin_input_file_tag,params: include_link=products include_remove=product_remove_picture_label include_text=product_display_picture_label}
        site_list:           { name: nolabel, type: admin_double_list, help: product_site_help, params: {through_class: LinkSiteProduct, unassociated_label: product_site_unassociated_label, associated_label: product_site_associated_label}}
      title:                 product_edit_title %%name%%


And my edit.yml file content:
fillin:
  enabled:              true
fields:
  product{name}:
    required:
      msg:              product_name_required
    sfStringValidator:
      max:              50
      max_error:        product_name_max_error
      min:              2
      min_error:        product_name_min_error
  product{description}:
    sfStringValidator:
      max:              255
      max_error:        product_description_max_error
      min:              2
      min_error:        product_description_min_error
  product{price}:
    sfNumberValidator:
      min:              0
      min_error:        product_price_min_error
      nan_error:        product_price_nan_error
  product{picture}:
    file:               true
    sfFileValidator:
      max_size:         512000
      max_size_error:   product_image_max_size_error
      mime_types:
        - 'image/png'
        - 'image/jpeg'
        - 'image/x-png'
        - 'image/pjpeg'
      mime_types_error: product_image_type_error


Did I miss something?

I am currently running symfony 1.1.6

 Topic: URL Routing width Get Parameters
URL Routing width Get Parameters [message #74252] Sat, 07 March 2009 14:38
Shawnstein  is currently offline Shawnstein
Messages: 61
Registered: April 2008
Member
Hello,

i want to change the routing method from post to get for some routes:

like this:
.../shop/page/1

to
/shop?page=1

i have testet:
testn:
  url:   /shop/*
  param: { module: shop, action: index }
  requirements: { sf_method: GET }

but when i generate a link like this:
<?php echo link_to('Click Here', '@testn?page=1');?>

i only get: .../shop/page/1


 Topic: large forms
large forms [message #74275] Sat, 07 March 2009 18:26
xfloyd  is currently offline xfloyd
Messages: 1
Registered: March 2009
Junior Member
I just built a form in symfony over 200 fields of all kinds and all works great, saved me bunch of hours if I wanted to built it php alone, never mind verification and sanitation, but my question is what would be a best approach if I want to present that form to the user in stages, let’s say 20 fields at a time, so it saves it to the DB in fragments.

I guess my really question is, can symfony auto generate something like that, or does it have to be written by hand. The reason I used symfony here for the firs time is, that it only took 2 commands to make all that 200 fields to work:
php symfony propel:build-all
php symfony propel:generate-module --non-verbose-templates --with-show frontend post ApplicationData
outside of schema.yml
 Topic: Best solution for credentials
Best solution for credentials [message #74394] Mon, 09 March 2009 14:43
DARX  is currently offline DARX
Messages: 17
Registered: November 2008
Junior Member
I have three permissions: admin, user and subuser.
And the subuser is in the user credential.

I use Admin Generator.

I know how to define AND and OR logic in generator.yml, but how to define "NOT"?

For example, I want to display a field only for "subuser" users.
It means "user but not subuser"...

How to do it?

Any help will be appreciated.
 Topic: Multiple Embedded Forms Problem
Multiple Embedded Forms Problem [message #74702] Fri, 13 March 2009 13:27
design2host  is currently offline design2host
Messages: 35
Registered: February 2009
Location: United Kingdom
Member
I apologise, this should have been posted in the Symfony 1.2 forum. I've opened another topic in the Symfony 1.2 forum which can be found here: http://forum.symfony-project.org/index.php/m/74703/#msg_7470 3

---------------------------------------


The project I'm working on has got a multiple embedded forms in the following manner

Referral -> embeds Client -> embeds Client Version

In the referral module the _form.php has client version elements included as

      <tr>
        <th><?php echo $form['client_id']["client_version"]["first_name"]->renderLabel() ?></th>
        <td>
          <?php echo $form['client_id']["client_version"]["first_name"]->renderError() ?>
          <?php echo $form['client_id']["client_version"]["first_name"] ?>
        </td>
      </tr>


When I fill out the details for a new Referral I've got it saving the referral, client and version details properly (in ReferralForm.class.php the following code was added to save the appropriate details

public function saveEmbeddedForms($con = null, $forms = null)
{   
	// SET THE FOREIGN KEY FOR THE CLIENT VERSION TO THE CLIENT ID OF THE CLIENT OBJECT 
	foreach($this->getEmbeddedForms() as $client)
	{
		$client->getObject()->save();
	    	
	    	foreach($client->getEmbeddedForms() as $client_version)
	      	{
		      	if(!$client_version->getObject()->getOrganisationId())
		      	{
		      		$client_version->getObject()->setOrganisationId($this->getObject()->getReferringOrganisationId());
		      	}
		      	
		      	if (!$client_version->getObject()->getClientId())
	      		{
	      			$client_version->getObject()->setClientId($client->getObject()->getId());
	      		}
	      		$client_version->getObject()->setStatus(sfConfig::get("app_status_ad_enable"));
	      		
	      	}
	      	$this->getObject()->setClientId($client->getObject()->getId());
	      	$this->getObject()->setStatus(sfConfig::get("app_status_ad_enable"));
	      	
	}
	
	$this->getObject()->save();	    
	parent::saveEmbeddedForms();
}


My problem is that when I come to edit the Referral the data for the embedded forms isn't loaded.

In ReferralForm.class.php I embed the client via

  public function configure()
  {
  	
  	if(!$this->isNew())
	{
		$this->embedForm('client_id', new ClientForm($this->getObject()->getClient()));
	}
	else
	{
		// OTHERWISE DISPLAY A BLANK CLIENT VERSION FORM
		$this->embedForm('client_id', new ClientForm());	
	}
  }


now as this in turn embeds the client_version I have added the following code to ClientForm.class.php

  	public function configure()
  	{
		if(!$this->isNew())
  		{
  			$this->embedForm('client_version', new ClientVersionForm($this->getObject()->getLatestClientVersion()));
  		}
  		else
  		{
  			// OTHERWISE DISPLAY A BLANK CLIENT VERSION FORM
  			$this->embedForm('client_version', new ClientVersionForm());	
  		}
  	}


In another part of the system I have just the client and client_version of the above setup and this works fine for both saving and editing but there seems to be something wrong with the way I'm piecing it all together for adding this 3rd level.

Does anyone have any ideas what I'm missing. Please let me know if you require anything else.

Many Thanks.

Chris.

[Updated on: Fri, 13 March 2009 13:34]


Chris Shennan
http://www.chrisshennan.com
 Topic: Wierd sfContext::switchTo error
Wierd sfContext::switchTo error [message #74772] Sat, 14 March 2009 20:43
cause85  is currently offline cause85
Messages: 1
Registered: March 2009
Junior Member
Hi there,

I'm using symfony 1.1.7, and I need to switch application context in one app to another (I need to call and send somewhere template from other application), but I get very weird error:

Fatal error: Class 'BlabrUser' not found in /home/cause/workspace/eclipse-php/blabr.us_trunk/cache/frontend/dev/config/config_factories.yml.php on line 106


It look like autoloading of user class didn't worked??
I'm using plaind old simple:
sfContext::switchTo('frontend');


Is something very wrong with my application? Or is there any other way to reuse action template from other application??
 Topic: pear upgrade from 1.1.6 to 1.1.7
pear upgrade from 1.1.6 to 1.1.7 [message #75376] Sun, 22 March 2009 01:27
pubear  is currently offline pubear
Messages: 7
Registered: September 2008
Junior Member
Hi,

I am having a strange issue in that I cannot get Symfony to upgrade on my production server to 1.1.7. I have it running fine on a test server, but not my production server. I am running Red Hat, and I have recently upgraded php to 5.2.8. Pear just tells me that there is nothing to upgrade.

Any ideas?

Thanks,

Jim


Life is a lot like monkeys throwing poo and candy.
You have to know when to duck and when to catch.
 Topic: generator.yml upload rename file
generator.yml upload rename file [message #75544] Tue, 24 March 2009 22:55
olivier  is currently offline olivier
Messages: 1
Registered: June 2007
Location: Vigneux sur seine
Junior Member
Hey,

I use the admin generator to create a form. But for the upload there is a trouble, the file are renamed each time.
exemple photo.jpg -> 324234234243.jpg it's a real problem.

generator:
  class:              sfPropelAdminGenerator
  param:
    model_class:      Formule
    theme:            default
    fields:
      photo:
        help: dépôt de fichier (jpg ou png)
        type: admin_input_file_tag
        upload_dir: formule
        params: include_link=formule include_remove=true
    list:
      actions:
        _create: { name: création }
    edit:
      title: Ajout d'un nouvelle formule
      display: [nom,description,photo,formuletype,prix]
      fields:
        formuletype: {name: Type de plat,type: admin_check_list, params:through_class=Formuletype }
        description: {params:rich=true size=150x30}
        help: sélection multiple possible
      actions:
        _save: { name: enregistrer }
        _list: { name: lister, params: include_custom=lister les formules }
        _save_and_add: { name : enregistrer et ajouter }

thanks, if you have any idea ...

olivier
 Topic: Routing problem after sever change
Routing problem after sever change [message #76310] Mon, 06 April 2009 01:28
foxx  is currently offline foxx
Messages: 8
Registered: April 2009
Junior Member
Hi all, I have problem with routing after moving my application to another server.

no_script_name option is not working on the new server.
domain.pl/ displays main page - that's ok but when i click on any link on the main page I get 404 error.

Let's say I'm clicking "Contact". URL is changing to domain.pl/contact.html which is correct but 404 appears.
If I add script name (domain.pl/index.php/contact.html) - than it is OK.
With script name it is OK also when I ommit routing rules and use module and action name.

On previous server everything was OK (without script name).
I have no_script_name of course set to "on".

.htaccess (mod_rewrite) on the new serwer is working, that's what an admin said.

I have done test and created .htaccess like this:
Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^contact$ index.php?module=contact [L]
</IfModule>


and then:
domain.pl/index.php/contact - works
domain.pl/contact - don't work (but maybe it's normal?)
domain.pl/ - works, I get index.php with that

So it seems, that htaccess works only when there is script name, otherwise don't. That is exactly what Symfony is doing, with script name everything is working but without - only main page.

And it seems that mod_rewrite on new serwer works, otherwise i wouldn't get: "domain.pl/index.php/contact - works" and whole routing wouldn't work even with script name. Or maybe I'm wrong with that and should check mod_rewrite in some other way?

In Symfony's .htaccess there is a part:
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /

but uncommenting this line doesn't help.

Thanks for ANY help.
Cheers.


EDIT:
Sth was wrong with new server configuration - administrator changed something (but I don't know what) and everything's fine.

[Updated on: Mon, 06 April 2009 14:49]

 Topic: Waiting Actions (or concurrent action calls)
Waiting Actions (or concurrent action calls) [message #76421] Tue, 07 April 2009 13:45
alper  is currently offline alper
Messages: 1
Registered: April 2009
Junior Member
Hi
I have several "link_to_remote" calls to a specific action in the page. each ajax-call(link_to_remote) calls the action with different ID's(parameter).Each action runs for 8 to 10 seconds.
When I click on the links that call these actions each call waits each other. for example if I have 5 "link_to_remote" calls and click them I wait for 5*8 = 40 seconds. Aren't these actions supposed to run concurrently

[Updated on: Tue, 14 April 2009 10:56]

 Topic: File Upload Progress
File Upload Progress [message #76443] Tue, 07 April 2009 15:56
dkurman  is currently offline dkurman
Messages: 10
Registered: October 2008
Location: Beccar - Buenos Aires - A...
Junior Member
Hi. I need to implement a file upload progress bar in a symfony development. I tried this sample http://trac.symfony-project.org/wiki/UploadProgress with no success. The progress bar was never showed. Could anyone implement some like this?

Thanks
 Topic: User culture always reset
icon5.gif  User culture always reset [message #77475] Tue, 28 April 2009 09:45
ublo  is currently offline ublo
Messages: 27
Registered: April 2009
Location: France
Junior Member
[EDIT] : sorry, this question is for Symfony 1.2
Please, go to : http://forum.symfony-project.org/index.php/t/20500/

[Updated on: Tue, 28 April 2009 09:47]


--
SLC
 Topic: doctrine schema generation field capitalization
doctrine schema generation field capitalization [message #78153] Tue, 12 May 2009 06:44
smnirven  is currently offline smnirven
Messages: 8
Registered: November 2008
Junior Member
Hey all,

I'm using symfony 1.1 with the doctrine plugin, and I am running into a problem with schema generation. The problem is that I've got legacy code running alongside symfony that is accessing the same database as symfony/doctrine. Some of the fields in my database are camelcase, and I've noticed that whenever I generate the schema file with the command "doctrine:build-schema frontend" the file that gets generated does not respect these field capitalizations. This in turn causes all kinds of problems down the line when I try to recreate the database or use migrations, as inevitably when the database is rebuilt, the fields are recreated without the capitalization (which breaks legacy code). Is there any way to make doctrine's schema generation respect the field capitalizations?

Thanks!
 Topic: JabberJaxl plugin for Symfony 1.1
JabberJaxl plugin for Symfony 1.1 [message #78415] Fri, 15 May 2009 09:01
rajeevr
Messages: 91
Registered: April 2008
Member
Hi,

Actually I am using symfony 1.1 . I found a jabber client plugin sfJabberJaxlPlugin - 1.0.0 which is working only in Symfony 1.2.

Is there any other symfony jabber client plugin available for Symfony 1.1? Or can I use this Plugin with any modifications for Symfony 1.1 ?

 Topic: Problem with sfValidatorRegex->execute
Problem with sfValidatorRegex->execute [message #78842] Fri, 22 May 2009 07:30
mstdmstd  is currently offline mstdmstd
Messages: 40
Registered: September 2008
Location: Donetsk, Ukraine
Member
Hi, All!
I tried to run sfValidatorRegex->execute and got error
Call to undefined method sfValidatorRegex::Execute() in...

I made it so :
$myValidator = new sfValidatorRegex(
array('pattern' => sfConfig::get('app_regex_text')),
array ('invalid' => "City should be title case string.")
);
$error='';
Util::deb($myValidator); // Here I output object and see : object(sfValidatorRegex)[63]...

if (!$myValidator->Execute( $CityName, $error))
{

I use symfony 1.1.1.
What is the problem? In docs I read $myValidator->Execute()...
 Topic: Creole
Creole [message #79237] Mon, 01 June 2009 14:55
sirmajk  is currently offline sirmajk
Messages: 2
Registered: December 2008
Junior Member
Hi

I have a problem with execute stored procedure in mssql

I try

$conn = Propel::getConnection();
$stmt = $conn->prepareCall("TestDodaj");

$stmt->setInt("@NrRodzaju", '', true);
$stmt->setString("@Nazwa", 'dedew', false);
$stmt->setInt("@R", '', true);
$stmt->setString("@RS", '', true);
$stmt->setString("@RSrc", '', true);

$stmt->registerOutParameter("RETVAL", CreoleTypes::INTEGER);

$result = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);

and I get error:

unable to execute callable statement [Native Error: Changed database context to 'mydatabase'.]

Could You help me ?
 Topic: File Structure
File Structure [message #79281] Tue, 02 June 2009 11:46
acticed  is currently offline acticed
Messages: 1
Registered: June 2009
Junior Member
Hello all,

I need some help to change the file structure for a client.

This is what it is required :

[biblio]
..[apps]
..[data]
..[lib]
..[plugins]

[config] (project)

[cache]

[log]

[site]
..content of symfony web (css, js, index ..)


So, to begin, i made two folders, site and biblio.
[biblio]
.. all project folders except web
[site]
.. content of web

and in projectConfiguration i added $this->setWebDir($this->getRootDir().'/../site');
and in index.php the path to the projecConfiguration ( dirname(__FILE__).'/../biblio/config/ ....)

This works well.

So i made [cache] and [log] dirs and setCacheDir / setLogDir in the ProjectConfiguration. It's OK too.

then .. i have to extract the config folder.
so i moved it, then i changed the path in index.php.
i add sfConfig::set('sf_config_dir', $this->getRootDir().'/../config');

.. it doesnt find the application 'application doesnt exist'.

I found that in fact RootDir is no more [biblio] but the parent folder.
I'll try to do this in the index.php :
ProjectConfiguration::getApplicationConfiguration('myapp', 'dev', true,dirname(__FILE__).'/../biblio');

But now it says me that config/database.yml is not readable, but it is.

and sf_config_dir: /XXXX/biblio/../config

Any ideas ?

May be i can consider change sf_apps_dir or others ?

Thanks.
 Topic: i18n, HTML tags after extract update
i18n, HTML tags after extract update [message #79373] Wed, 03 June 2009 16:25
Snark  is currently offline Snark
Messages: 8
Registered: June 2009
Location: France
Junior Member
Hi,

I try to update the translation of my site, but, after a new extract with
symfony i18n:extract frontend fr --auto-save

all UTF-8 character are transform in HTML entities.

Before:
      <trans-unit>
        <source>Logging out</source>
        <target>Se déconnecter</target>
      </trans-unit>             
      <trans-unit>
        <source>Create user</source>
        <target>Créer un utilisateur</target>
      </trans-unit>             


After update:
      <trans-unit>
        <source>Logging out</source>
        <target>Se d&#xE9;connecter</target>
      </trans-unit>
      <trans-unit>
        <source>Create user</source>
        <target>Cr&#xE9;er un utilisateur</target>
      </trans-unit>


How a can be keep the default UTF-8 character ?

Thank,

Snark.


(sorry for my poor english)
 Topic: Custom validator problem
Custom validator problem [message #79407] Thu, 04 June 2009 11:54
Mr-Clean  is currently offline Mr-Clean
Messages: 3
Registered: February 2009
Junior Member
Hello,

I've made a custom validator (/apps/backoffice/lib/sfDateValidator.php) which works well when I use it with with a form :

fillin:
  enabled: true
  param:
    name: edit_form

fields:
  disponibilite:
    sfDateValidator:
      msg: La date doit etre du format jj/mm/aaaa


But it doesn't work with an another form :

methods:
  post: [reference, description, loyer, disponibilite]

fillin:
  enabled: true
  param:
    name: edit_form

names:
  reference:
    required:     True
    required_msg: Veuillez saisir la reference du bien
  description:
    required:     True
    required_msg: Veuillez saisir une description
  loyer:
    required:     True
    required_msg: Veuillez saisir le montant du loyer
  disponibilite:
    required:     False
    required_msg: Veuillez saisir la date de disponibilite
    sfDateValidator:
      msg: La date doit etre au format jj/mm/aaaa


In the second case, the "disponibilite" field isn't checked Sad


Is the syntax wrong ?
 Topic: scripts outside of web folder for cron
scripts outside of web folder for cron [message #79425] Thu, 04 June 2009 20:25
dwight
Messages: 5
Registered: October 2008
Junior Member
hello. i'm trying to set up a script to run outside of the /web folder via a cron job. i'd like to have propel support, as well as some of the other symfony libraries, but i'd also like it to not be publicly accessible nor fit into the normal templates.

basically i'm trying to do this:
http://www.lampjunkie.com/2008/04/how-to-use-symfony-and-cro n/

but i'm not sure what version the author is using (i've commented asking) or if it's the best solution.

this is the code i've got so far (located in /batch):


<?php

define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
define('SF_APP', 'intranet');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', false);


require_once(SF_ROOT_DIR.'/config/ProjectConfiguration.class.php');
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'intranetConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration(SF_APP, SF_ENVIRONMENT, SF_DEBUG);
sfContext::createInstance($configuration)->dispatch();



echo 'done';





and this is the output:
[root@168138-web1 ~]# php /var/www/vhosts/testsite.com/httpdocs/batch/cron_QBSyncHourly.php
PHP Notice:  Undefined index:  REQUEST_URI in /var/www/vhosts/testsite.com/httpdocs/cache/intranet/prod/config/config_core_compile.yml.php on line 2768
PHP Notice:  Undefined index:  HTTP_HOST in /var/www/vhosts/testsite.com/httpdocs/cache/intranet/prod/config/config_core_compile.yml.php on line 2783
PHP Notice:  Undefined index:  SERVER_PORT in /var/www/vhosts/testsite.com/httpdocs/cache/intranet/prod/config/config_core_compile.yml.php on line 2786
PHP Notice:  Undefined index:  REQUEST_URI in /var/www/vhosts/testsite.com/httpdocs/cache/intranet/prod/config/config_core_compile.yml.php on line 2768
PHP Notice:  Undefined index:  HTTP_HOST in /var/www/vhosts/testsite.com/httpdocs/cache/intranet/prod/config/config_core_compile.yml.php on line 2783
PHP Notice:  Undefined index:  SERVER_PORT in /var/www/vhosts/testsite.com/httpdocs/cache/intranet/prod/config/config_core_compile.yml.php on line 2786
<html><head><meta http-equiv="refresh" content="0;url=https://"/></head></html>[root@168138-web1 ~]# 



The PHP Notices seem harmless but i'm still seeing HTML outputted and the rest of my script isn't executing.

Any ideas?


Thanks
 Topic: [SOLVED] Using backend.php on shared hosting
[SOLVED] Using backend.php on shared hosting [message #81056] Thu, 02 July 2009 00:19
dustin10  is currently offline dustin10
Messages: 7
Registered: January 2009
Junior Member
I am using GoDaddy hosting to host my application. I followed the following tutorials:

http://gfaraj.wordpress.com/2008/04/25/deploying-a-symfony-p roject-on-godaddy-shared-hosting/

http://www.codemassacre.com/2008/07/24/problems-hosting-symf ony-sites-on-godaddy/

Everything is working fine for my frontend application. Now I am trying to get my backend application working. When i go to mydomain.com/backend.php it redirects me to the login module which is perfect. As soon as I login it breaks down. My default module for the backend is named schedule so in my login action code I have this line:

$this->redirect( 'schedule/index' );

This leads me to a 404 error. So I printed out the result of url_for( 'schedule/index' ) on the login page and it came back with this:

/backend.php/

This is obviously wrong. I thought I would try routing to a module that is in the frontend application named register just to see what that would output. So I tried printing out the value of url_for( 'register/index' ) and it printed out this:

/backend.php/register

From what I can tell the routing that is being used is the routing for the frontend controller, but in the url it has backend.php. I think it may have something to do with my .htaccess file. Here is what my .htaccess file looks like:

addhandler x-httpd-php5 .php

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
RewriteEngine On

# uncomment the following line, if you are having trouble
# getting no_script_name to work
RewriteBase /

# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

I cant figure out how to get it to use the backend controller for the routing when I am using backend.php. Anyone know what is going on? I can't figure it out. Thanks.

[SOLVED] I had to add the path_info_key to the settings.yml file and give it a value of REDIRECT_URL

[Updated on: Thu, 02 July 2009 16:47]

 Topic: autocomplete with changeble parameter
autocomplete with changeble parameter [message #81204] Mon, 06 July 2009 14:38
mstdmstd  is currently offline mstdmstd
Messages: 40
Registered: September 2008
Location: Donetsk, Ukraine
Member
Hi, all.
I need autocomplete like input_auto_complete_tag( but it's request is with 1 more parameter
which actually is editable field on form, this parameter is changeble.
I use sf1.1.1, prototype, propel. Can I do this? If yes, please, referance to example.
 Topic: Upgrade now
icon4.gif  Upgrade now [message #81224] Mon, 06 July 2009 21:09
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

Symfony 1.1 support has been officially withdrawn, meaning only serious security fixes will be addressed.

If you are still developing with this version of symfony, you should consider upgrading to 1.2 as soon as possible, as eventually support in this forum section will also dry up, especially as we get closer to release 1.3.

Take a look at the upgrading from 1.1 to 1.2 page of the documentation and feel free to use this forum if you need help.


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
 Topic: autocomplete in indexsuccess.php
autocomplete in indexsuccess.php [message #83741] Thu, 13 August 2009 23:46
lefajardo  is currently offline lefajardo
Messages: 11
Registered: August 2009
Junior Member

Hi.
I am new to php and to symfony.

Looking in the autocomplete samples, that are defined for forms like Customer that are CRUD forms, but i want to put the autocomplete widget in a indexSuccess.php page where i need to give ajax capability to the input texts that i use to gather criteria filters before fill the grid/table.

so i need to tie a autocomplete to something like:

<input type="text" value="CustomerName" />

so later i can send back to the controller and fill the grid based on the letters the user type there.


<table>
<th> Customer id </th>
.
.
.
.
.

 Topic: Help with sfThumbnailPlugin
Help with sfThumbnailPlugin [message #83870] Mon, 17 August 2009 15:45
kluch  is currently offline kluch
Messages: 6
Registered: July 2009
Junior Member
Hey

Im like realy new to symfony, im required to make a imageupload plugin, i want to use sfThumbnailPlugin to display thumbnails, i read through the readme etc but i dont understand how it works. Can someone please help with a explanation and/or examples of usage
 Topic: Relationships (Doctrine)
icon5.gif  Relationships (Doctrine) [message #84022] Wed, 19 August 2009 19:25
pipa  is currently offline pipa
Messages: 1
Registered: August 2009
Junior Member
Hi.

Im trying to get the following relationship structure (doctrine):

an user could have n addressbooks (therefore every addressbook belongs to ONE user),
an addressbook could have n vcards,
an user could have 1 vcard.

although:
- if a user is deleted his own vcard should be deleted
- the users vcard should be deleted in all addressbooks, too
- the users addressbooks should be deleted as well
(when a users vcard is delete, the user should not be deleted - only vice versa).

What I get so far is the following:

schma.yml
---

User:
  columns:
    name:
      type: string(32)
      unique: true
      notnull: true
    pass:
      type: string(64)
      notnull: true
    active:
      type: integer(1)
      default: '1'
      notnull: true
    vcard_id:
      type: integer(8)
      unique: true
  actAs:
    Sluggable:
      name: url
      type: string
      length: 32
      unique: true
      fields: [name]
    Timestampable:
  relations:
    VCard:
      local: vcard_id
      foreign: id



  

Addressbook:
  columns:
    name:
      type: string(32)
    user_id:
      type: integer(8)
  actAs:
    Timestampable:
  relations:
    User:
      local: user_id
      foreign: id
  relations:
    VCard:
      foreignAlias: Addressbooks
      class: VCard
      refClass: AddressbookVCard







VCard:
  #tableName: vcard
  columns:
    test:
      type: clob
    addressbook_id:
      type: integer(8)
  actAs:
    Timestampable:







AddressbookVCard:
  #tableName: addressbook_vcard
  columns:
    addressbook_id:
      type: integer
      primary: true
    vcard_id:
      type: integer
      primary: true
  relations:
    Addressbook:
      foreignAlias: AddressbookVCard
    VCard:
      foreignAlias: AddressbookVCard



key column 'v_card_id' doesnt exist in table. failing query: create addressbook_v_card .....



Any hints of how to set it up right?

greetz pipa

[Updated on: Thu, 20 August 2009 03:21]

 Topic: sfValidatorSchemaCompare and date format problema
sfValidatorSchemaCompare and date format problema [message #85399] Wed, 16 September 2009 18:28
rodrigobb  is currently offline rodrigobb
Messages: 36
Registered: October 2008
Member
Hi all,

I'm having a problem trying to use together sfValidatorSchemaCompare and two date fields. Let's see some code


public function configure()
  {
[...]
    $this->widgetSchema['date_start']  = new hDatePickerWidget();
    $this->widgetSchema['date_end']    = new hDatePickerWidget();

    $this->validatorSchema['date_start']  = new sfValidatorDate( array('date_format' => '@(?P<day>\d{2}).(?P<month>\d{2}).(?P<year>\d{4})@'));
    $this->validatorSchema['date_end']    = new sfValidatorDate( array('date_format' => '@(?P<day>\d{2}).(?P<month>\d{2}).(?P<year>\d{4})@'));

    $this->mergePostValidator (new sfValidatorSchemaCompare('date_start', sfValidatorSchemaCompare::LESS_THAN_EQUAL, 'date_end', array(), $comparerStrings));
[...]
  }



hDatePickerWidget is basically (as far as I understand) an input_date_tag.

The date fields works with spanish date format (dd/MM/yyyy). All works fine, but when there is an error the date fields are filled with english format (yyyy/MM/dd) resulting in a mess

Example:

Input: Start => 23/11/2009 End=> 21/11/2009
Output: 'Invalid' (Error Message) Start => 2009/11/2023 End => 2009/11/2021

If tried to fix it passing 'format' and 'culture' as options to the fields but with no success.

Can anyone help me?
Thanks in advance
 Topic: suffix and routing problem
suffix and routing problem [message #85716] Thu, 24 September 2009 11:31
maxcyrek  is currently offline maxcyrek
Messages: 4
Registered: February 2009
Junior Member
factories.yml:
all:
   routing:
      class: sfPatternRouting
      param:
        load_configuration: true
        suffix:             .
        variable_prefixes:  [':']
        segment_separators: ['/', ',']
        debug:              %SF_DEBUG%
        logging:            %SF_LOGGING_ENABLED%
        cache:
          class: sfFileCache
          param:
            automatic_cleaning_factor: 0
            prefix:                    %SF_APP_DIR%
            cache_dir:                 %SF_CONFIG_CACHE_DIR%/routing
            lifetime:                  31556926
            prefix:                    %SF_APP_DIR%


Then if I would like to have in routing.yml such a rule:
category:
  url:   /:category_name,1,:category_id.html
  param: { module: product, action: index }


I get

[InvalidArgumentException]
Unable to parse ":category_name,1,:category_id.html" route near ".html".


I can not have suffix defined in factories.yml while i have some modules in my app where I would like not to have the .html suffix.

Can anybody help me?
 Topic: get list of columns from object
get list of columns from object [message #86307] Wed, 07 October 2009 11:18
mstdmstd  is currently offline mstdmstd
Messages: 40
Registered: September 2008
Location: Donetsk, Ukraine
Member
Hi, all.

I have valid object $Client which I retrieved from database.
From ClientPeer::getTableMap()->getColumns() I can get list of all fields in client;
And I want to get all values from $Client object without writing:
$name= $Client->getName();
$last_name= $Client->getLastName();
...
How Can I do this if can?
 Topic: Functional Testing from script
Functional Testing from script [message #86318] Wed, 07 October 2009 14:50
mstdmstd  is currently offline mstdmstd
Messages: 40
Registered: September 2008
Location: Donetsk, Ukraine
Member
Hi, all!
I use Functional Testing as written in
http://mail.rambler.ru/mail/redirect.cgi?url=http%3A%2F%2Fww w.symfony-project.org%2Fbook%2F1_0%2F15-Unit-and-Functional- Testing;href=1
Queston is if I can to use this function not only from command line, but also from script
and get results of this function work as output ? If yes, how?

 Topic: In sfTestBrowser() error with forms
In sfTestBrowser() error with forms [message #86348] Thu, 08 October 2009 08:00
mstdmstd  is currently offline mstdmstd
Messages: 40
Registered: September 2008
Location: Donetsk, Ukraine
Member
Hi All.
I use sfTestBrowser() for testing of my scripts, but encounetered problem if there is form object
for this action and template. I make so, action:
Quote:

public function executeContracts($request)
{
$this->form = new ContractForm();
$response = $this->context->getResponse();
$response->addJavascript('/js/jquery/ui.core.js');
return sfView::SUCCESS;
...
}


and running command symfony test:functional backend mainActions
I see error last request threw an uncaught exception InvalidArgumentException: Widget contract.START_DATE does not exist.
# Failed test (.\lib\symfony\vendor\lime\lime.php at line 199)
on first $form referance in my template

What is the reason ?
In test decription http://mail.rambler.ru/mail/redirect.cgi?url=http%3A%2F%2Fww w.symfony-project.org%2Fbook%2F1_0%2F15-Unit-and-Functional- Testing I did not see any especial descriptions about form
 Topic: Empty module and/or action after parsing the URL
Empty module and/or action after parsing the URL [message #88342] Fri, 13 November 2009 13:41
mstdmstd  is currently offline mstdmstd
Messages: 40
Registered: September 2008
Location: Donetsk, Ukraine
Member
Hi, All.

I need to run url like
http://localhost:88/index.php/main/get_autocomplete?q=text

And I get error "Empty module and/or action after parsing the URL"
How could I solve this? is it some configuration parameters?

I use php: 5.2.10 under Windows XP
Symfony version: 1.1.1

.htaccess :
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^$ info.php [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{THE_REQUEST} !^(.*)phpinfo.php(.+)$
RewriteRule ^(.*)$ index.php [QSA,L]



Pages (169): [ «  <  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  >  »]

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