Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Arjen van Haren

Pages: [1]
1
Bugs and Issues / Re: PHP code generation bug?
« on: July 31, 2008, 01:07:34 am »
Yes, it worked for me. In the code template for PHP , section Import I changed the line:

$file = %importRelativeFilePath%

to

$file = %importFilePath%

The target directory for my generated code is: c:\codeg

Then I did a search and replace of the files with:
search on: 'c:\codeg
repplace:  $baseDir . '


I know there is probarly a nicer way to implement the basedir directly in the php codetemplate but EA is pretty new to me so I decided to go for the quick solution for now.



2
Bugs and Issues / Re: PHP code generation bug?
« on: July 30, 2008, 05:24:42 pm »
Well, normally I would say also that relative includes are better to use then absolute ones. If your root location changes you don't have to change all includes.

The relative path is always depended on the current working directory, so for example:

index.php     dir1/file1.php (current working directory)
  |
   dir1/file1.php     include "file2.php"  NOT POSSIBLE when called from index.php

   dir1/file1.php     include "dir1/file2.php"  works, we begin from the basepath , called from index.php

   dir1/file2.php    

So a single relative include will work, but the second one will go wrong if not started from the current working dir of the first parsed php file.

This can work fine when your sure if the php files are always included the same way, but this is not very likely in a big project.

The thing we do in our projects:
- get the project root directory and place it in a variable
- make all includes absolutes by using the root variable:

include ($rootDir . "\dir1\file1.php");


I adjusted the php code generation template, used the absolute path and after that did a search and replace of the root directory with the $rootDir .


Cheers



3
Bugs and Issues / PHP code generation bug?
« on: July 29, 2008, 10:08:27 pm »
Hi,

Not sure if it's a bug or I'm doing something wrong, but I am generating PHP source code of classes in different subdirectories referencing each others. In the PHP files require_once (includes) are being made. However the generated file paths are relative.

But when doing includes in PHP, then the second include in the next file will use as a base path the first include that was used. In another words, you cannot use relative includes!

4
Great! that's even better!

Thanks for the help

5
The import export to an xml file did the trick. I replaced all java codes to php and imported the xml, all classes files where set to PHP code generation :)

Thanks for your help!

6
I have a class diagram with > 40 packages and > 190 classes and want to generate the source code in PHP. However as a default everything is generated for Java.

I changed the default source generation to PHP and changed all packages to PHP, but I still need to change some classes to PHP in their properties setting.

Is there a faster way to select all classes and set their code generation to PHP?

Pages: [1]