Development

#3508 ([sfDoctrinePlugin] - Directory separator mismatch with sfFinder causing model building to fail)

You must first sign up to be able to contribute.

Ticket #3508 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

[sfDoctrinePlugin] - Directory separator mismatch with sfFinder causing model building to fail

Reported by: mercilor Assigned to: chtito
Priority: minor Milestone:
Component: sfDoctrinePlugin Version: 1.1.0 DEV
Keywords: Cc:
Qualification: Unreviewed

Description

I recently ported an app over from SF1.0.13 and Propel to SF1.1 (svn), sfDoctrinePlugin (1.0-sf1.1 branch) and sfGuardDoctrinPlugin (trunk). My dev environment is WAMP. The app's schema is building a model fine and generating correct SQL (so long as I don't reference sfGuard), but sfGuardDoctrinePlugin's schema isn't building a model, accompanied by the following PHP Warnings:

PHP Warning:  file_put_contents(C:\www\webapps\syllabus\cache\tmp\C:/
www/webapps
/syllabus/plugins/sfGuardDoctrinePlugin/config/doctrine/schema.yml-
schema.yml):
failed to open stream: Invalid argument in C:\www\webapps\syllabus
\plugins\sfDoc
trinePlugin\lib\doctrine\Doctrine\Parser.php on line 144

Warning: file_put_contents(C:\www\webapps\syllabus\cache\tmp\C:/www/
webapps/syll
abus/plugins/sfGuardDoctrinePlugin/config/doctrine/schema.yml-
schema.yml): faile
d to open stream: Invalid argument in C:\www\webapps\syllabus\plugins
\sfDoctrine
Plugin\lib\doctrine\Doctrine\Parser.php on line 144

Change History

05/10/08 12:56:20 changed by thomas.s

Don't use the trunk, use http://svn.symfony-project.com/plugins/sfGuardDoctrinePlugin/branches/symfony-1.1 instead. The trunk has errors in the schema (see #3506), typos (see #3507), calls to the deprecated class sfDoctrine and some calls to propel related subjects. It is an initial port of the propel version and is at the moment not intended for use i guess (i tried it myself...).

Thomas

05/11/08 22:42:21 changed by mercilor

The problem still occurs with the symfony-1.1 branch. I'm guessing it's a problem with sfDoctrinePlugin or my configuration. I'll try to narrow it down later this week.

05/12/08 08:25:12 changed by mercilor

The problem is that sfFinder returns paths with / directory separators regardless of platform, so in sfDoctrineBuildModelTask.class.php:71, the str_replace isn't matching, and thus replace the entire path to the yml schema with a /-delimited one. Then, since DIRECTORY_SEPARATOR is \ on windows, when $plugin gets exploded it doesn't tokenize anything and the whole path gets thrown into $tmpPath.

Since I'm not familiar with the dev side of symfony, I don't know what the directory conventions are and thus whether sfFinder or sfDoctrine are "in the wrong" here, so I'll refrain from submitting a patch.

05/12/08 08:29:30 changed by mercilor

  • summary changed from Model not building for sfGuardDoctrinePlugin - path error in doctrine parser to [sfDoctrinePlugin] - Directory separator mismatch with sfFinder causing model building to fail.

Updated the ticket summary accordingly.

05/12/08 08:35:04 changed by mercilor

Sorry for the ticketspam, but I realized I should post my workaround for anyone else experiencing the problem:

sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php:69

   	foreach ($pluginSchemas as $schema)
   	{
   	  $schema = str_replace('/', DIRECTORY_SEPARATOR, $schema);
   	  $plugin = str_replace(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR, '', $schema);

05/13/08 03:43:45 changed by Jonathan.Wage

  • status changed from new to closed.
  • resolution set to fixed.

(In [8917]) fixes #3508