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.3 and 1.4
 Topic: BETA1 : double queries in admin generator
BETA1 : double queries in admin generator [message #87538] Thu, 29 October 2009 10:32
groenewege  is currently offline groenewege
Messages: 3
Registered: August 2007
Junior Member
When using version 1.3 BETA1 of symfony I encounter the following problem :

If the escaping strategy is set to true the sfDoctrinePager class requests the same list query two times in the admin generator.

One time triggered by the sfOutputEscaperArrayDecorator and one time triggered by the sfDoctrinePager->getResults() call in the _list template.

best regards,
gunther
 Topic: Official Documentation for doctrine 1.2?
Official Documentation for doctrine 1.2? [message #87810] Wed, 04 November 2009 11:02
skyblaze  is currently offline skyblaze
Messages: 205
Registered: January 2008
Faithful Member
In the Doctrine official site i see that there isn't yet a doctrine book for version 1.2 of doctrine is that true? Which book version should i use 1.1 or 2.0 for doctrine 1.2?
 Topic: Doctrine SavePoints Trouble
Doctrine SavePoints Trouble [message #87923] Fri, 06 November 2009 13:41
kertz  is currently offline kertz
Messages: 3
Registered: January 2008
Junior Member
I'm trying to create a Doctrine Transaction with savepoint but I get this error.

Fatal error: Call to undefined method Doctrine_EventListener_Chain::preSavepointCreate() in /Users/kertz/Sites/project/lib/vendor/symfony/lib/plugins/sf DoctrinePlugin/lib/vendor/doctrine/Doctrine/Transaction.php on line 195

The transaction is working without savepoints but when I add savepoint I get this error. Any insights into this?

$conn = Doctrine_Manager::connection(); $conn->beginTransaction('mysavepoint');
 Topic: how to retrieve a list of modules in current app
icon5.gif  how to retrieve a list of modules in current app [message #87973] Sat, 07 November 2009 16:35
vinylboy  is currently offline vinylboy
Messages: 8
Registered: November 2009
Location: Poland
Junior Member
I was wondering how to retrieve a list of modules in current application for instance backend. It may be quite useful with creating flexible breadcrumbs but I have no idea about particular source of this informations.

[Updated on: Sat, 07 November 2009 18:35]

 Topic: Doctrine - Catch Error when trying to delete referenced entry in admin generator
Doctrine - Catch Error when trying to delete referenced entry in admin generator [message #87983] Sat, 07 November 2009 20:12
zevero  is currently offline zevero
Messages: 1
Registered: June 2008
Junior Member
WWhen deleting an entry which is referenced in the admin generator I just get a plain error.
I think in Propel there was a flash with a message that this entry can not be deleted.

Does somebody know how I can catch the mysql-error and generate a userfriendly message?

Thanks!
 Topic: Sluggable behavior
Sluggable behavior [message #88155] Tue, 10 November 2009 23:09
ShurikAg  is currently offline ShurikAg
Messages: 25
Registered: September 2009
Location: Canada
Junior Member
I've tried to use Sluggable behavior and it worked fine, And I have a question:

one of my entities is configured like this:
...
Sluggable:
      unique: true
      fields: [title]
      name: slug
      type: string
      length: 50
      uniqueIndex: true
      indexName: uniq_slug
...


In this case if the slug is exists, Doctrine will create the record anyway with a count appended to the slug. How can I configure this behavior in order to prevent creation of the record if it has the same slug?

And another question: can I chenge the format of slug generation? ('_' instead of '-').

Thanks.
 Topic: How to log from model classes?
icon5.gif  How to log from model classes? [message #88201] Wed, 11 November 2009 16:37
lathspell  is currently offline lathspell
Messages: 6
Registered: March 2008
Junior Member
Hello

How can I use sfLogger from inside the model or task classes?

From googling the mailing list I already understand that using sfContext is considered bad as it mixes layers. But I found no alternative. Any ideas?

bye,

-christian-

[Updated on: Wed, 11 November 2009 18:10]

 Topic: Hello, some questions about symfony
Hello, some questions about symfony [message #88354] Fri, 13 November 2009 16:26
edugonch  is currently offline edugonch
Messages: 6
Registered: November 2009
Junior Member
Hello, I'm the programmer of the site www.crcasasymas.com.

This site I did from 0 and now I will like to rebuild it in symfony, but I have never touch symfony and I have some questios.

1) How can I do the main menu of the page as a module an then insert it in the global layout?


2) How can I insert images (in the web/image path) to be insert in the default layout but not loosing them when for example I use the develop page, or when edit a value (I guess that the relative path change)

3) How can I do a home page, for example, when I enter to the develop site (for example www.crcasasymasdev.com ) I get to the symfony logo, so to see the index page I need to do something like this --> www.crcasasymasdev.com/home. How can avoid this?


Thanks for your help.

[Updated on: Fri, 13 November 2009 16:27]

 Topic: [Sf 1.4] sfPropelPlugin - error in generating *Peers.
[Sf 1.4] sfPropelPlugin - error in generating *Peers. [message #88679] Thu, 19 November 2009 01:13
marcink86  is currently offline marcink86
Messages: 51
Registered: August 2009
Location: Gdynia, Poland
Member
I tried to use sf1.4 with propel ORM, however I came across a little problem.

This is a piece of code generated in Base*Peer class in lib/model/om:

public static function doUpdate($values, PropelPDO $con = null)
{
  // symfony_behaviors behavior
  foreach (sfMixer::getCallables('BaseTestPeer:doUpdate:pre') as $sf_hook)
    {
      if (false !== $sf_hook_retval = call_user_func($sf_hook, 'BaseTestPeer', $values, $con))
      {
        return $sf_hook_retval;
      }
    }

    if ($con === null) {
      $con = Propel::getConnection(TestPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    }

    $selectCriteria = new Criteria(self::DATABASE_NAME);

    if($values instanceof Criteria) {
      $criteria = clone $values; // rename for clarity
      $comparison = $criteria->getComparison(TestPeer::ID);
      $selectCriteria->add(TestPeer::ID, $criteria->remove(TestPeer::ID), $comparison);
    } else { // $values is Test object
      $criteria = $values->buildCriteria(); // gets full criteria
      $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
    }
    // set the correct dbName
    $criteria->setDbName(self::DATABASE_NAME);

    $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
    // symfony_behaviors behavior
    foreach (sfMixer::getCallables('BaseTestPeer:doUpdate:post') as $sf_hook)
    {
      call_user_func($sf_hook, 'BaseTestPeer', $values, $con, $ret);
    }

    return $ret;
    


Look at "{" just before // symfony_behaviors behavior
In my opinion it should be after return $ret!

[Updated on: Thu, 19 November 2009 01:14]

 Topic: 1.3/1.4 roadmap and sfDoctrineGuardPlugin
icon5.gif  1.3/1.4 roadmap and sfDoctrineGuardPlugin [message #88776] Sat, 21 November 2009 01:48
rickb  is currently offline rickb
Messages: 61
Registered: July 2007
Location: Hampshire, UK
Member
I got 1.4.0rc1 working fine. I tried installing sfDoctrineGuard plugin but I got lots of errors I didn't understand when I tried to build it into my project.

Is it likely there will be a new version of sfDoctrineGuardPlugin that works with 1.3 or 1.4 sometime soon?

Rick


Rick
 Topic: i18n + sluggable doesn't work
i18n + sluggable doesn't work [message #88792] Sat, 21 November 2009 14:33
masteron  is currently offline masteron
Messages: 40
Registered: March 2009
Member
I created a model and backend page with admin generator.
A part of schema is :
  actAs:
    I18n:
      fields: [ title, meta_title, meta_description, meta_keywords ]   
      actAs:
        Sluggable: 
          fields:       [title]
          unique:       true      
          type:         string
          length:       63        
        Timestampable:      


However in Doctrine's Sluggable template ( in class Doctrine_Template_Listener_Sluggable ) in line 115
                $value .= $record->$field . ' ';

which in my case would be $record->title.
The value is null, $record has null in title field.

Everything else works fine. Just the proposal value for slug isn't created.

Any ideas?
Thanks..

[Updated on: Sat, 21 November 2009 14:35]


Just discovered symfony..
Facinated with it...
 Topic: ERR: "Positions must contains all field names." in Backend
ERR: "Positions must contains all field names." in Backend [message #88893] Mon, 23 November 2009 16:21
Chucky  is currently offline Chucky
Messages: 1
Registered: November 2009
Junior Member
Hello Community,

I have a problem with Symfony 1.3 - doctrine.
In my Symfony Project there are two Apps:
- frontend
- backend

In the frontend everything works fine. Now I have a problem with the Users. In the schema.yml I defined a User-table and there are some data by default. Everything is fine, a user can login, logout etc. But now I wanted to create a backend where new Users can be added. But it doesn't work at all. Only the administration of the 'User'-module is not working. Modules like 'Company', ... are working as expected.

When I create the backend with the 'doctrine:generate-admin ...' it creates the list of Users correct. But when I click on 'new' or 'edit' I got the following error-message: "500 | Internal Server Error | InvalidArgumentException - Positions must contains all field names.".

When I create the backend manuelly I got the following error in the terminal: "Positions must contains all field names.".

What is wrong or what did I forget to configure?

Hopefully someone knows the answer Smile

Thanks a lot,
Tom
 Topic: Adding tabindex to expanded multiple choice fields
Adding tabindex to expanded multiple choice fields [message #88950] Mon, 30 November 2009 09:19
gregoire_m  is currently offline gregoire_m
Messages: 50
Registered: May 2008
Location: France
Member
Hi,

I have a form that has several fields. One of these fields is a sfWidgetFormDoctrineChoice widget, with 'multiple' and 'expanded' options set to 'on'. So checkboxes are displayed.

I want to add a tabindex attribute to my field, so I tried this:

$my_widget->setAttribute('tabindex', 12);


But the result is quite unexpected:

<ul tabindex="12" class="checkbox_list">
  <li tabindex="12"><input tabindex="12" type="checkbox" ... />&nbsp;<label tabindex="12" for="...">Value</label></li>
  <li tabindex="12"><input tabindex="12" type="checkbox" ... />&nbsp;<label tabindex="12" for="...">Value</label></li>
</ul>


The tabindex attribute is added on each tag: ul, li, input, label. It generates a strange behavior on Firefox 3.5 when navigating with the TAB key.... (I haven't tested on other browsers)

Is there a way to fix this problem?

Thanks! Smile
 Topic: Problem with the new pager Iterator interface
Problem with the new pager Iterator interface [message #89051] Tue, 01 December 2009 13:54
gregoire_m  is currently offline gregoire_m
Messages: 50
Registered: May 2008
Location: France
Member
I use the sfDoctrinePager class to paginate results. I've seen in the 1.3/1.4 what's new article that the pagers now implement the Iterator and Countable interfaces. I say "cool, let's try it" so I did that:

<?php if (count($my_pager)): ?>
  ...
  <?php foreach ($my_pager as $object): ?>
    <?php var_dump($object) ?>
  <?php endforeach; ?>
  ...
<?php endif; ?>


The count() function works fine, but the foreach() doesn't. The $object that I expect to be a MyClass object is actually a sfOutputEscaperArrayDecorator object. It's an array of my objects, and not one of my objects, as I hoped...

Do I misunderstand the pager Iterator interface? Or is it a bug?
 Topic: Admin credentials on fields get ignored
Admin credentials on fields get ignored [message #89110] Wed, 02 December 2009 10:21
masteron  is currently offline masteron
Messages: 40
Registered: March 2009
Member
When I set credentials on fields in generator.yml file it gets ignored.
I found the issue patch:
http://trac.symfony-project.org/ticket/5832

Why hasn't it got fixed in 1.3 ?


Just discovered symfony..
Facinated with it...
 Topic: Segmentation fault error with Doctrine
Segmentation fault error with Doctrine [message #89218] Thu, 03 December 2009 19:55
ShurikAg  is currently offline ShurikAg
Messages: 25
Registered: September 2009
Location: Canada
Junior Member
What can potentially be a reason for "Segmentation fault" when trying to save a record into DB with Doctrine?

This is all I got: "Segmentation fault".

My unit test looks like this:
include (dirname(__FILE__) . '/../../bootstrap/Doctrine.php');

$t = new lime_test(3);
$t->diag("=== Token model test ===");

$t->info('Token creation =>');
$token = new Token();
$token->setEntityId(1);
$token->generateUniqueToken();

$t->info('Set valid token type...');
$token->setType(Token::TYPE_EMAIL_VERIFICATION);
try{
  $t->info('Saving the token...');
  $token->save();
  $t->pass('Token was saved successfully...');
}
catch(Exception $e){
  $t->is(($e instanceof Exception), true, $e->getMessage());
}

$t->isnt($token->getCreatedAt(), null, ' Creation datetime is set to '.$token->getCreatedAt().'...');

$t->info('Get this token from DB...');
$tokenFromDb = TokenTable::findOneByToken($token->getToken());

$t->info('Compare the two...');
$t->is($tokenFromDb->getEntityId(), $token->getEntityId(), 'Entity ID...');
$t->is($tokenFromDb->getToken(), $token->getToken(), 'Token string...');
$t->is($tokenFromDb->getType(), $token->getType(), 'Token string...');
$t->is($tokenFromDb->getCreatedAt(), $token->getCreatedAt(), 'Token creation date...');
$t->is($tokenFromDb->getExpiresAt(), $token->getExpiresAt(), 'Token expration date...');
$t->is($tokenFromDb->getExpiresAt(), null, 'Token expration date is null...');

$t->info('Delete token...');
$t->is($token->delete(), true, 'Successful deletion...');


And I'm getting this error on this line:
$tokenFromDb = TokenTable::findOneByToken($token->getToken());
 Topic: Running CLI tasks from browser
Running CLI tasks from browser [message #89219] Thu, 03 December 2009 20:14
Dr Fnord  is currently offline Dr Fnord
Messages: 16
Registered: April 2009
Location: Dublin, Ireland
Junior Member
I need to upload a project to a server for which I don't have CLI (SSH) access. How do I run clear cache, project:optimize and doctrine:data-load and other highly essential CLI commands in this case?

Is there any way to run them from the browser?

As per 1.3/1.4 recommendations, the Symfony libs are embedded in the project, not installed via PEAR.

[Updated on: Thu, 03 December 2009 20:15]

 Topic: Suggestion: sfValidatorBase::setDefaultMessage Implementation
Suggestion: sfValidatorBase::setDefaultMessage Implementation [message #89261] Fri, 04 December 2009 08:33
skyme  is currently offline skyme
Messages: 1
Registered: December 2009
Junior Member
Hi,

I am not sure this is the appropriate place to post this, but I don't know where I can bring this up.

I have been evaluating sysmfony 1.4 and I really like the feature that which allows me to customize the default error message of validators. This would help me to reduce a great deal of duplicated code. However, I feel that this feature can be improved further, which is described below:

Currently I can set the default error message of the base validator by calling:

sfValidatorBase::setDefaultMessage

Not only will it change the default error message of sfValidatorBase, but all validators inherit the base validator. This is sometimes not desired. For example, for sfValidatorChoice, I want to set the default invalid message to "Please select an option.", and for sfValidatorString I want the default message as "Please enter a value.". With current implementation to do such thing is not possible. So I suggest to make setDefaultMessage validator specific (in the next symfony release maybe?). This will make the form creation much easier. You are welcome to provide feedback. Regards.
 Topic: Symfony command line generators never finishing...
Symfony command line generators never finishing... [message #89297] Fri, 04 December 2009 18:26
evolve  is currently offline evolve
Messages: 1
Registered: December 2009
Location: New Jersey
Junior Member
Hello,

I'm starting a project with symfony 1.4 and when I created the project it created all the folders just fine but the command never finished within the command prompt. I used the following command:
php lib/vendor/symfony/data/bin/symfony generate:project PROJECT_NAME
ctrl+c didn't stop it, I ended up having to end the cmd.exe process.

I moved forward in setting up my database using:
php symfony configure:database "mysql:host=localhost;dbname=dbname" root mYsEcret
and the same thing happened, it never finished.

I of course changed the commands to match my setup.

Is there an issue with my environment?

I'm running Windows XP.

Thanks in advance for any help.
 Topic: sfAutoloadAgain slows down application
sfAutoloadAgain slows down application [message #89358] Sun, 06 December 2009 00:54
sfUser  is currently offline sfUser
Messages: 18
Registered: December 2006
Junior Member
I have two projects on one server. First one uses symfony 1.2, second uses new symfony 1.4

Projects almost identical, only symfony lib and config files related to symfony are different.

Main page render time in developer mode on symfony 1.2 is near 500-600 ms.
Main page render time in developer mode on symfony 1.4 is near 900-1000 ms.

I ask myself - Why?
I began to follow the recommendation. I removed all calls to deprecated classes and helpers, but result is just a little bit better. I started profiler and find a solution

Now see attachment. sfAutoloadAgain is called every request and tried to find one of the Doctrine record I18N classes. I remind you that Doctrine does not create I18N classes as a file.

I commented out two lines in sfAutoloadAgain class and render time has been amazingly small for my project: 300-400 ms

Modified class:
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Autoload again for dev environments.
 * 
 * @package    symfony
 * @subpackage autoload
 * @author     Kris Wallsmith <kris.wallsmith@symfony-project.com>
 * @version    SVN: $Id: sfAutoloadAgain.class.php 22248 2009-09-22 17:15:16Z fabien $
 */
class sfAutoloadAgain
{
  static protected
    $instance = null;

  protected
    $registered = false,
    $reloaded   = false;

  /**
   * Returns the singleton autoloader.
   * 
   * @return sfAutoloadAgain
   */
  static public function getInstance()
  {
    if (null === self::$instance)
    {
      self::$instance = new self();
    }

    return self::$instance;
  }

  /**
   * Constructor.
   */
  protected function __construct()
  {
  }

  /**
   * Reloads the autoloader.
   * 
   * @param  string $class
   * 
   * @return boolean
   */
  public function autoload($class)
  {
    // only reload once
    if ($this->reloaded)
    {
      return false;
    }

    $autoloads = spl_autoload_functions();

    // as of PHP 5.2.11, spl_autoload_functions() returns the object as the first element of the array instead of the class name
    if (version_compare(PHP_VERSION, '5.2.11', '>='))
    {
      foreach ($autoloads as $position => $autoload)
      {
        if ($this === $autoload[0])
        {
          break;
        }
      }
    }
    else
    {
      $position  = array_search(array(__CLASS__, 'autoload'), $autoloads, true);
    }

    if (isset($autoloads[$position + 1]))
    {
      $this->unregister();
      $this->register();

      // since we're rearranged things, call the chain again
      spl_autoload_call($class);

      return class_exists($class, false) || interface_exists($class, false);
    }

    $autoload = sfAutoload::getInstance();
    $autoload->reloadClasses(true);

    $this->reloaded = true;

    return $autoload->autoload($class);
  }

  /**
   * Returns true if the autoloader is registered.
   * 
   * @return boolean
   */
  public function isRegistered()
  {
    return $this->registered;
  }

  /**
   * Registers the autoloader function.
   */
  public function register()
  {
    if (!$this->isRegistered())
    {
      //spl_autoload_register(array($this, 'autoload'));
      $this->registered = true;
    }
  }

  /**
   * Unregisters the autoloader function.
   */
  public function unregister()
  {
    //spl_autoload_unregister(array($this, 'autoload'));
    $this->registered = false;
  }
}


Ticket?

[Updated on: Sun, 06 December 2009 01:13]

 Topic: something a bit strange in dynamic_javascript_include_tag
something a bit strange in dynamic_javascript_include_tag [message #89441] Mon, 07 December 2009 04:20
jacklkh  is currently offline jacklkh
Messages: 55
Registered: December 2009
Member
Dear all,

I am having problem with the dynamic_javascript_include_tag, i'm creating each page of js in module/action form and use dynamic_javascript_include_tag to call my js.

But what i finally get it is that the js will work under firefox but in ie there will be a object expected error return.

Is there any solution for them?
thanks

Jack
 Topic: upgrading from 1.2 to 1.3 [solved]
upgrading from 1.2 to 1.3 [solved] [message #89494] Mon, 07 December 2009 17:43
richard.scott  is currently offline richard.scott
Messages: 33
Registered: July 2008
Member
Hi,

I have a propel based setup running 1.2.10.

I have ran "pear upgrade symfony/symfony-1.3.0" and now I get this problem:

symfony project:upgrade1.3

Fatal error: Uncaught exception 'sfCommandException' with message 'The task named "configure:database" in "sfPropelConfigureDatabaseTask" task is already registered by the "sfDoctrineConfigureDatabaseTask" task.' in /usr/share/php/symfony/command/sfCommandApplication.class.php:142
Stack trace:
#0 /usr/share/php/symfony/command/sfCommandApplication.class.php(129): sfCommandApplication->registerTask(Object(sfPropelConfigureDatabaseTask))
#1 /usr/share/php/symfony/command/sfCommandApplication.class.php(63): sfCommandApplication->registerTasks()
#2 /usr/share/php/symfony/command/cli.php(19): sfCommandApplication->__construct(Object(sfEventDispatcher), NULL, Array)
#3 /usr/bin/symfony(37): include('/usr/share/php/...')
#4 {main}
  thrown in /usr/share/php/symfony/command/sfCommandApplication.class.php on line 142


How can I upgrade?

EDIT: ok, I'd not realised I have to enable the sfPropelPlugin Sad

Thanks,

Rich

[Updated on: Mon, 07 December 2009 17:55]

 Topic: Use both propel and doctrine together
Use both propel and doctrine together [message #89499] Mon, 07 December 2009 18:05
richard.scott  is currently offline richard.scott
Messages: 33
Registered: July 2008
Member
Hi,

I have a symfony project that i've upgraded to 1.3.0 and I would like to migrate to using Doctrine.

Is it possible to activate both the Propel and Doctrine plugins together?

Thanks,

Rich.
 Topic: propel:build-schema and special characters in column names
propel:build-schema and special characters in column names [message #89620] Wed, 09 December 2009 08:37
arnaldoj  is currently offline arnaldoj
Messages: 1
Registered: December 2009
Junior Member
I use symfony 1.4 in Linux and have a working application. I need to read a table with the following creation statement:

CREATE TABLE `ZTAHST0P` (
`rrn` int(10) unsigned NOT NULL default '0',
`HSMSGC` decimal(2,0) default NULL,
`HSMSGF` decimal(1,0) default NULL,
`HSMSGT` decimal(1,0) default NULL,
`HSTRTY` char(2) default NULL,
`HSTRFA` char(2) default NULL,
`HSTRTA` char(2) default NULL,
`HSRRFÑ` char(12) default NULL,
`HSACTN` char(1) default NULL,
`HSRSPC` char(2) default NULL,
`HSAQPT` char(3) default NULL,
`HSISPT` char(3) default NULL,
`HSNTID` char(3) default NULL,
`HSCRDÑ` char(19) default NULL,
`HSMBRÑ` char(1) default NULL,
`HSAPRÑ` char(6) default NULL,
`HSXMDT` decimal(7,0) default NULL,
`HSXMTM` decimal(6,0) default NULL,
`HSSTAN` decimal(12,0) default NULL,
`HSTDAT` decimal(7,0) default NULL,
`HSTTIM` decimal(6,0) default NULL,
`HSMCAT` decimal(4,0) default NULL,
`HSCASD` decimal(7,0) default NULL,
`HSCAID` char(15) default NULL,
`HSCATI` char(8) default NULL,
`HSCATA` char(40) default NULL,
`HSAQID` char(11) default NULL,
`HSAQCO` char(3) default NULL,
`HSASDT` decimal(7,0) default NULL,
`HSISID` char(11) default NULL,
`HSISDT` decimal(7,0) default NULL,
`HSDOC1` char(7) default NULL,
`HSDOC2` char(7) default NULL,
`HSRETF` char(1) default NULL,
`HSCZID` char(20) default NULL,
`HSUSER` char(10) default NULL,
`HSPPXD` decimal(7,0) default NULL,
`HSPPXT` decimal(6,0) default NULL,
`HSDBCR` char(1) default NULL,
`HSACCT` char(2) default NULL,
`HSACCÑ` char(19) default NULL,
`HSACCB` char(10) default NULL,
`HSTRCC` char(3) default NULL,
`HSTRN$` decimal(15,0) default NULL,
`HSATR$` decimal(15,0) default NULL,
`HSTRFE` decimal(15,0) default NULL,
`HSASCC` char(3) default NULL,
`HSASA$` decimal(15,0) default NULL,
`HSASF$` decimal(15,0) default NULL,
`HSASP$` decimal(15,0) default NULL,
`HSASCR` decimal(15,9) default NULL,
`HSISCC` char(3) default NULL,
`HSISA$` decimal(15,0) default NULL,
`HSISF$` decimal(15,0) default NULL,
`HSISP$` decimal(15,0) default NULL,
`HSISCR` decimal(15,9) default NULL,
`HSCBCC` char(3) default NULL,
`HSCBA$` decimal(15,0) default NULL,
`HSCBAF` decimal(15,0) default NULL,
`HSCBPF` decimal(15,0) default NULL,
`HSCBSF` decimal(15,0) default NULL,
`HSSCBR` decimal(15,9) default NULL,
`HSPNEM` decimal(2,0) default NULL,
`HSPNEC` decimal(1,0) default NULL,
`HSPNCC` decimal(2,0) default NULL,
`HSPCCD` decimal(2,0) default NULL,
`HSCVCD` char(5) default NULL,
`HSSVCD` char(3) default NULL,
`HSEXDT` decimal(4,0) default NULL,
`HSPROD` char(3) default NULL,
`HSVDEV` char(10) default NULL,
`HSREPC` char(1) default NULL,
`HSDSRN` char(23) default NULL,
`HSMOTO` char(4) default NULL,
`HSOBTC` char(10) default NULL,
`HSINSÑ` decimal(2,0) default NULL,
`HSMSGA` char(14) default NULL,
`HSCMSG` decimal(4,0) default NULL,
`HSACT2` char(1) default NULL,
`HSRSP2` char(2) default NULL,
`HSTRC2` char(3) default NULL,
`HSATR2` decimal(15,0) default NULL,
`HSTRF2` decimal(15,0) default NULL,
`HSASC2` char(3) default NULL,
`HSASA2` decimal(15,0) default NULL,
`HSASF2` decimal(15,0) default NULL,
`HSASP2` decimal(15,0) default NULL,
`HSASR2` decimal(15,9) default NULL,
`HSISC2` char(3) default NULL,
`HSISA2` decimal(15,0) default NULL,
`HSISF2` decimal(15,0) default NULL,
`HSISP2` decimal(15,0) default NULL,
`HSISR2` decimal(15,9) default NULL,
`HSCBC2` char(3) default NULL,
`HSCBA2` decimal(15,0) default NULL,
`HSCBF2` decimal(15,0) default NULL,
`HSCBP2` decimal(15,0) default NULL,
`HSCBS2` decimal(15,0) default NULL,
`HSCSR2` decimal(15,9) default NULL,
`HSTRT2` char(2) default NULL,
`HSXMD2` decimal(7,0) default NULL,
`HSXMT2` decimal(6,0) default NULL,
`HSRLNM` char(6) default NULL,
`HSRLDS` char(30) default NULL,
PRIMARY KEY (`rrn`),
KEY `ZTAHST0P1` (`HSISPT`,`HSCRDÑ`),
KEY `ZTAHST0P2` (`HSXMDT`,`HSXMTM`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

When I try to generate schema.yml using propel:build-schema, I get this error messages:

PHP Warning: simplexml_load_file(): encoder error/home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xm l:35: parser error : AttValue: ' expected in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): encoder error/home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xm l:35: parser error : AttValue: ' expected in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : attributes construct error in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : attributes construct error in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : Couldn't find end of Start Tag column line 35 in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : Couldn't find end of Start Tag column line 35 in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : Premature end of data in tag table line 4 in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : Premature end of data in tag table line 4 in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : Premature end of data in tag database line 3 in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): /home/ajimenez/data/pgm/sfprojects/fpr/config/schema.xml:35: parser error : Premature end of data in tag database line 3 in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): <column name="hsrrf in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969

Warning: simplexml_load_file(): ^ in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 969
PHP Fatal error: Call to a member function attributes() on a non-object in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 973

Fatal error: Call to a member function attributes() on a non-object in /home/ajimenez/data/pgm/sfprojects/fpr/lib/vendor/symfony/li b/plugins/sfPropelPlugin/lib/addon/sfPropelDatabaseSchema.cl ass.php on line 973


On the other hand, the config/schema.xml file is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--Autogenerated by PropelSchemaReverseTask class.-->
<database name="propel" package="lib.model" defaultIdMethod="native">
<table name="ALLREPORT" phpName="Allreport">
<column name="chsnam" phpName="Chsnam" type="CHAR" size="20" required="false">
<vendor type="mysql">
<parameter name="Field" value="chsnam"/>
<parameter name="Type" value="char(20)"/>
<parameter name="Null" value="YES"/>
<parameter name="Key" value=""/>
<parameter name="Default" value=""/>
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="TTLDSC" phpName="Ttldsc" type="CHAR" size="40" required="false">
<vendor type="mysql">
<parameter name="Field" value="TTLDSC"/>
<parameter name="Type" value="char(40)"/>
<parameter name="Null" value="YES"/>
<parameter name="Key" value=""/>
<parameter name="Default" value=""/>
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="hstrfa" phpName="Hstrfa" type="CHAR" size="2" required="false">
<vendor type="mysql">
<parameter name="Field" value="hstrfa"/>
<parameter name="Type" value="char(2)"/>
<parameter name="Null" value="YES"/>
<parameter name="Key" value=""/>
<parameter name="Default" value=""/>
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="hsrrf


As you can see, the problem starts in the "HSRRFÑ" column in the original table (ZTAHST0P). It seems that the "Ñ" character causes the process to end.

I can not change the original table definition since it comes from a working application.

What should I do in order to make propel:build-schema work ok?

Many thanks


 Topic: generate:project setting another directory
generate:project setting another directory [message #89638] Wed, 09 December 2009 12:38
c.b.  is currently offline c.b.
Messages: 1
Registered: December 2009
Junior Member
Hello, this is my first post, i hope i picked the right forum.
I successfully installed Symfony 1.4 on my Linux Webserver and now i want to go through the "first steps" and create a project using

$ php lib/vendor/symfony/data/bin/symfony generate:project PROJECT_NAME


If i execute this statement, symfony created a project in a folder which i dont want it in. How can i change this? Or can i just move those folders without getting in to trouble later?

[Updated on: Wed, 09 December 2009 12:38]

 Topic: AJAX Template
AJAX Template [message #89656] Wed, 09 December 2009 15:54
dwbee  is currently offline dwbee
Messages: 1
Registered: December 2009
Location: UK
Junior Member
Hi there,

How would I specify a template specifically for AJAX HTML-format requests, with the option to disable it per-request?

Thanks in advance
 Topic: Ignore schema files with doctrine:build-xxx
Ignore schema files with doctrine:build-xxx [message #89748] Thu, 10 December 2009 16:29
Nicolas400  is currently offline Nicolas400
Messages: 27
Registered: August 2009
Location: Necochea, Argentina
Junior Member

hi, I have created several fils inside config\doctrine\ to let me create an yml file for table, or a group of them.

But I can't figure out how to ingnore some files.

for example I create a file schema.txt with som snippets of code that let me remember how do i have to write the file.

But the commmand doctrine:build-sql creates the file schema.sql and I see the tables that is only on schema.txt.

is build-sql command taking the info from config\doctrine folder?

Best Regards
 Topic: Symfony 1.3.1 +Doctrine +actAs I18N high number of I18N fields - Doctrine_Connection_Mysql_Exception
icon4.gif  Symfony 1.3.1 +Doctrine +actAs I18N high number of I18N fields - Doctrine_Connection_Mysql_Exception [message #89820] Fri, 11 December 2009 13:41
micon  is currently offline micon
Messages: 8
Registered: December 2009
Junior Member
I think i found a serious bug in symfony/doctine!
For me this was repeatable (i tried it with several schemas and different symfony application)

Summary:
When you use more than a certain number of I18n fields within a schema / model (in my case 7 fields) doctrine
generates a Doctrine_Connection_Mysql_Exception.

Description of the error:

* I´m using symfony 1.3.1

* My schema:

options:
charset: utf8
collate: utf8_general_ci
type: InnoDB

Offer:
actAs:
I18n:
fields: [offervalue1, offervalue2, offervalue3, offervalue4, offervalue5, offervalue6, offervalue7, offervalue8, offervalue9]
columns:
offername: { type: string(255) }
offervalue1: { type: string(255) }
offervalue2: { type: string(255) }
offervalue3: { type: string(255) }
offervalue4: { type: string(255) }
offervalue5: { type: string(255) }
offervalue6: { type: string(255) }
offervalue7: { type: string(255) }
offervalue8: { type: string(255) }
offervalue9: { type: string(255) }
offervalue10: { type: string(255) }
offervalue11: { type: string(255) }
offervalue12: { type: string(255) }
offervalue13: { type: string(255) }
offervalue14: { type: string(255) }
offervalue15: { type: string(255) }
offervalue16: { type: string(255) }
offervalue17: { type: string(255) }
offervalue18: { type: string(255) }
offervalue19: { type: string(255) }
offervalue20: { type: string(255) }
offervalue21: { type: string(255) }
offervalue22: { type: string(255) }
offervalue23: { type: string(255) }
offervalue24: { type: string(255) }
offervalue25: { type: string(255) }
offervalue26: { type: string(255) }
offervalue27: { type: string(255) }
offervalue28: { type: string(255) }
offervalue29: { type: string(255) }
offervalue30: { type: string(255) }

* My form:
class OfferForm extends BaseOfferForm
{
public function configure()
{
$this-> embedI18n(array('de','en','fr','it','us','hu','pl','nl','da' ,'sv','es','ru','fi','cs','ja','ro','et','tr','ko'));

$this->widgetSchema->setLabel('de', 'German');
$this->widgetSchema->setLabel('en', 'English UK');
$this->widgetSchema->setLabel('fr', 'French');
$this->widgetSchema->setLabel('it', 'Italian');
$this->widgetSchema->setLabel('us', 'English US');
$this->widgetSchema->setLabel('hu', 'Hungarian');
$this->widgetSchema->setLabel('pl', 'Polish');
$this->widgetSchema->setLabel('nl', 'Dutch');
$this->widgetSchema->setLabel('da', 'Danish');
$this->widgetSchema->setLabel('sv', 'Swedish');
$this->widgetSchema->setLabel('es', 'Spanish');
$this->widgetSchema->setLabel('ru', 'Russian');
$this->widgetSchema->setLabel('fi', 'Finnish');
$this->widgetSchema->setLabel('cs', 'Czech');
$this->widgetSchema->setLabel('ja', 'Japanese');
$this->widgetSchema->setLabel('ro', 'Romanian');
$this->widgetSchema->setLabel('et', 'Estonian');
$this->widgetSchema->setLabel('tr', 'Turkish');
$this->widgetSchema->setLabel('ko', 'Korean');

}
}

* the error:
--> when you create a new Offer everthing is ok
--> when you try to update a Offer the following error message appears:

500 | Internal Server Error | Doctrine_Connection_Mysql_Exception

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`mytest/offer_translation`,CONSTRAINT `offer_translation_id_offer_id` FOREIGN KEY (`id`) REFERENCES `offer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)


If you reduce the number of i18n fields (here overvalue1 - overvalue7) everthing works fine!
as soon as you use more then 7 fields the error appears. (but strangely the data will be saved correctly!)

Please if there is anybody how can give me a hint how to solve this problem i would be really thankful (a large project depends on this and i have no clue how to solve this issue Sad( )

 Topic: removed function: removeArrayValueForPath()
removed function: removeArrayValueForPath() [message #89838] Fri, 11 December 2009 17:04
badkill  is currently offline badkill
Messages: 11
Registered: May 2008
Junior Member
Hi,

in symfony 1.4 this functions are removed: sfToolkit::removeArrayValueForPath()`,
`sfToolkit::hasArrayValueForPath()`, and `getArrayValueForPathByRef()`

Before symfony 1.4 i can get/remove an attribute from the sfParameterHolder object in this mode:

$request->getParameter('element[sub_element']);
or
$request->getParameterHolder()->remove('element[sub_element]');

for get a parameter there is no problem, now i should get the first element and next i get the subelement from the array, but for remove a sub_element how can i do??

thanks in advance.

 Topic: [solved] Ajax forms in admin generator, jq_link_to_remote
[solved] Ajax forms in admin generator, jq_link_to_remote [message #89850] Fri, 11 December 2009 18:57
scathlock  is currently offline scathlock
Messages: 14
Registered: December 2009
Junior Member
Hello,
I want to embed ajax forms in admin generator as it is in http://israelwebdev.wordpress.com/2009/05/04/how-to-embed-aj ax-forms-in-symfony-12-admin-generator/

but I have problem in following code:
                $label = 
                    "item $index ".jq_link_to_remote(image_tag('/sf/sf_admin/images/delete'), array(
                        'url'     =>  'mymodule/deleteItem?id='.$item->getId(),
                        'success' =>  "jQuery('.sf_admin_form_field_item".$item->getId()."').remove();",
                        'confirm' => 'Sure???',
                        'script' => true,
                    ));
                    
                $this->widgetSchema[$fieldName]->setLabel($label);


The action isn't executed (action code is 100% correct) and div isn't removed.
Generated javascript is below:
if (confirm('Sure???')) { 
jQuery.ajax({type:'POST',dataType:'html',
success:function(data, textStatus
{jQuery('.sf_admin_form_field_item30').remove();},
url:'/backend_dev.php/item/30/deleteItem'}); }; return false;


Could you help me?

----
edit:

Ok, I've found the problem... I not included use_javascripts in template...

[Updated on: Fri, 11 December 2009 19:23]

 Topic: The whole tree from NestedSet...
The whole tree from NestedSet... [message #89883] Sat, 12 December 2009 09:02
ShurikAg  is currently offline ShurikAg
Messages: 25
Registered: September 2009
Location: Canada
Junior Member
Hi all,

One of my model classes looks like this:
Page:
  tableName: Page
  columns:
    id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    lang:
      type: string(2)
      fixed: true
      unsigned: false
      primary: false
      default: en
      notnull: true
      autoincrement: false
    title:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    slug:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    html:
      type: text
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    created_at:
      type: timestamp
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    updated_at:
      type: timestamp
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    operator:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  actAs:
    Timestampable:
      created:
        name: created_at
        type: timestamp
        expression: NOW()
      update:
        onInsert: false
        options:
          notnull: false
    Sluggable:
      unique: false
      fields: [title]
      name: slug
      type: string
      length: 255
      uniqueIndex: true
      indexName: uniq_slug
    NestedSet:
      hasManyRoots: true
      rootColumnName: parent_id
  indexes:
    lang_indx:
      fields: [lang]
    slug_indx:
      fields: [slug]
      type: unique 


When I'm accessing the tree elements by the following:
$tree = Doctrine::getTable('Page')->getTree();


for each and every level lookup new SQL query is generated. Eventually, if I want to iterate through the whole tree (recurcivelly), the script is generating 3 queries with only 2 elements in the tree.

Is there a way to pull the whole entire tree without hydrating it into array?

Thanks.
 Topic: Advanced Doctrine Usage (part 1) performance
Advanced Doctrine Usage (part 1) performance [message #89923] Sun, 13 December 2009 11:45
Dr Fnord  is currently offline Dr Fnord
Messages: 16
Registered: April 2009
Location: Dublin, Ireland
Junior Member
Hello!

Today I implemented the strategy found in Advanced Doctrine Usage (part 1). I have a question about its performance.

Previously I've done similar strategies manually - simply updating a counter in the "ForumThread" class every time a "ForumPost" was added or removed. It generates overhead, but overall a thread is read more often than edited, so it's well worth it.

A spinoff effect was of course that I didn't have to load the relations of ForumThread in order to get the ForumPost count. As such it was quite efficient.

When I implemented the Doctrine behavior, I noticed that I can't get the new "num_posts" column of ForumThread unless I first load the "Posts" relation. And of course, looking in baseforumThread.class.php, I can see that there is no standard column called "num_posts".

Now, a page that lists a number of ForumThreads, and that previously made 16 database connections to be rendered, now needs 49 database queries to do the same thing. My question is this: is it possible to access num_posts without loading the relation it is related to?

For example, I currently have do this in order to check if there are any posts in a thread related to a certain record:
// Note that record_to_show has a one-to-one relationship to a ForumThread
$this->record_to_show->loadReference('ForumThread');
$this->record_to_show->ForumThread->loadReference('Posts');

$this->has_comments = $this->record_to_show->ForumThread->num_posts != 0;


Is this possible to optimize somehow? Doctrine doesn't seem to know that ForumThread has num_posts unless I preload the relations.
 Topic: Good practices for templates
Good practices for templates [message #90042] Tue, 15 December 2009 14:49
Lilo  is currently offline Lilo
Messages: 236
Registered: August 2006
Faithful Member
Hi,

I am new to Symfony 1.4 and need to learn new good practices for my new project.

A particular case will occur many times :

My main layout is the following :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head profile="http://gmpg.org/xfn/11">
        <?php include_javascripts() ?>
        <?php include_stylesheets() ?>
        <?php include_http_metas() ?>
        <?php include_metas() ?>
        <?php include_title(); ?>
    </head>

    <body>
        <div id="global">
            <!-- HEADER -->
            <?php include( "headerBar.php" ) ?>

            <!-- MENU PRINCIPAL -->
            <?php include( "headerMenu.php" ) ?>
            <div id="headerVide"></div><!-- /headerVide -->
            <!-- /HEADER -->

            <!-- MENU BARRE OBJET + ONGLETS -->
            <?php include( "titleBar.php" ) ?>


            <!-- CONTENT MAIN -->
            <div id="containerContent">
                <?php echo $sf_data->getRaw( "sf_content" ) ?>
            </div><!-- /containerContent -->
            <!-- /CONTENT MAIN -->
            <!-- CONTENT SAVE -->
            <div id="containerSaveBoutons">
            </div><!-- /containerSaveBoutons -->

            <div id="containerSaveDiagonale"></div><!-- /containerSaveDiagonale -->
            <!-- /CONTENT SAVE -->
        </div><!-- /global -->
    </body>
</html>


The div containerContent will display the action's template. The div containerSaveButtons will display the pagination buttons in the case of a list or the save button in the case of a form.

How to have, for each action, a specific content in the containerSaveButtons ? Should I use components ? slots ? What is the most elegant way with the minimum amount of repeating code ?

It is important to notice that the links for the pagination will contain querystring parameter for filtering data or ordering columns. Should I retrieve all these parameters in the action, gives them to the template with $this (for example this->sortField = $request-getParameter("sortField")) AND to the layout with setSlot (for example $this->getResponse()->setSlot("sortField", $this->sortField)) ?

Thank you for your help

[Updated on: Tue, 15 December 2009 14:54]

 Topic: Getting Field Values - Relations
Getting Field Values - Relations [message #90045] Tue, 15 December 2009 15:56
dmr99  is currently offline dmr99
Messages: 26
Registered: October 2008
Junior Member
I am trying to work out which fields have been modified in a table prior to the save.

I can get the original and new values using the models getModified() method.

This works fine expect for fields that are foreign keys. For these fields I would like to be able to get the actual object instead of the key value, so I can return a meaning full value using the __toString method for example.

I am using Doctrine with Symfony 1.4

Any help would be greatly appreciated.
 Topic: can't reach javascript in backend apps
can't reach javascript in backend apps [message #90047] Tue, 15 December 2009 16:04
dwchiang  is currently offline dwchiang
Messages: 1
Registered: December 2009
Location: Taipei
Junior Member
when i practice this: Practical symfony Day 12: The Admin Generator (
http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12 ),I found that my apps "backend" can't reach the javascript files in (/web)/js

(I'm using symfony 1.4 on Windows XP, with AppServ)

In the source code of browser, it renders these statements currently: <script type="text/javascript" src="/js/
xxx.js"></script>, but all related javascripts don't work. Do I need some more apps setup or routing setup for my second apps to reach the files in /js?

thanks!!


ernest,
 Topic: Upgrade from 1.2 to 1.3 Problem
Upgrade from 1.2 to 1.3 Problem [message #90049] Tue, 15 December 2009 16:40
Nicolas400  is currently offline Nicolas400
Messages: 27
Registered: August 2009
Location: Necochea, Argentina
Junior Member

Hi. I try to upgrade from 1.2 to 1.3 and my project blow up.

First, one step un updagrade readme is very confusing:

How to upgrade to symfony 1.3?

To upgrade a project:

* Check that all plugins used by your project are compatible with symfony 1.3

* If you don't use a SCM tool, please make a backup of your project.

* Upgrade symfony to 1.3


how to know how to upgrade ? witch command ? with a zip ? with cvn ??

when things goes wrong , I restore my backup....
and then i can't even use this command. (symfony -D)

So I suppouse to be in 1.2 again ... but nothing.

c:\sfdev\catango>symfony -D

Fatal error: Uncaught exception 'sfCommandException' with message 'The task name
d "configure:database" in "sfDoctrineConfigureDatabaseTask" task is already regi
stered by the "sfConfigureDatabaseTask" task.' in C:\sfdev\catango\lib\vendor\sy
mfony\lib\command\sfCommandApplication.class.php:120
Stack trace:
#0 C:\sfdev\catango\lib\vendor\symfony\lib\command\sfCommandApplication.class.ph
p(107): sfCommandApplication->registerTask(Object(sfDoctrineConfigureDatabaseTas
k))
#1 C:\sfdev\catango\lib\vendor\symfony\lib\command\sfCommandApplication.class.ph
p(52): sfCommandApplication->registerTasks()
#2 C:\sfdev\catango\lib\vendor\symfony\lib\command\cli.php(19): sfCommandApplica
tion->__construct(Object(sfEventDispatcher), Object(sfAnsiColorFormatter), Array
)
#3 C:\sfdev\catango\symfony(14): include('C:\sfdev\catang...')
#4 {main}
  thrown in C:\sfdev\catango\lib\vendor\symfony\lib\command\sfCommandApplication
.class.php on line 120


Any idea ?

Best regards
Nicolas
 Topic: I made two digrams for doctrine form
I made two digrams for doctrine form [message #90058] Tue, 15 December 2009 18:39
kendoctor  is currently offline kendoctor
Messages: 34
Registered: November 2009
Member
index.php/fa/1354/0/

index.php/fa/1355/0/
to show call and call relation of class's method

i hope, it will give you some help. Rolling Eyes

[Updated on: Tue, 15 December 2009 18:40]

 Topic: embedRelation for one to one relation form rendering
embedRelation for one to one relation form rendering [message #90060] Tue, 15 December 2009 19:59
kendoctor  is currently offline kendoctor
Messages: 34
Registered: November 2009
Member
i think if there is an option for two forms' fields rendering in flat mode, that's will be good.

just like echo $form, two forms will render in only one table. otherwise, i need to rander these fields seperately!(maybe change decorator also can be achived, but i have not tried, that's more tedious )

if also can be grouped, that will be great! useFields, seems not to group fields, only sort rendering order.

 Topic: Embeded forms
icon9.gif  Embeded forms [message #90087] Wed, 16 December 2009 12:08
rastaferraille  is currently offline rastaferraille
Messages: 38
Registered: December 2009
Member
Hi,

Imagine a database like this : One Declaration can have only one victim.

Well, I have a form to create a new declaration in which I include the form designed to create a new Victim.

How would you do to make the choice of a victim in the main form's victim list not to be required if a victim has been written in the sub Form ?

How would you do to make the fields in the subForm to be required if one of them (or more) has been filled ?

Is there a better way to do ?

Sorry for my poor english... (I'm french Confused)

Hope you understood...

Thanks !

[Updated on: Wed, 16 December 2009 12:19]

 Topic: Custom column type with Doctrine 1.2
Custom column type with Doctrine 1.2 [message #90102] Wed, 16 December 2009 16:33
Michal  is currently offline Michal
Messages: 4
Registered: May 2009
Junior Member
I'd like to make use of PostgreSQL arrays in my project. Therefore I need to add a custom column type to Doctrine. The Doctrine 2.0 documentation has a nice paragraph about custom column mapping, unortunately there is nothing about column mapping in Doctrine 1.2.

I guess I need to extend Doctrine_DataDict_Pgsql. Is there away to do it without editing the original class? I would be grateful for any hints and suggestions how to do it the most elegant way.

PS. Just in case: I'm well aware of Doctrine's ARRAY type which serializes PHP arrays to strings.
Pages (14): [1  2  3  4  5  6  7  8  9  10  11  12  13  14  >  »]

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