-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Renaming 'Om' to 'Base' #35
Comments
Agreed. |
+1, but that's a big naming change ;) |
+1 |
I start the renaming in a om-rename branch. The Object are generated in the good folder 'Base' without prefix. Book : <?php
use Base\Book as BaseBook
class Book extends BaseBook {} There is still some issue with Base class that have use on child classe (conflic) I don't now if I should use self/static inenstead of using |
static is fine if it works. Otherwise ChildObject will be enough. William Le 25 nov. 2011 à 00:57, Jérémie Augustinreply@reply.github.com a écrit :
|
I think you should update the 2011/11/25 William DURAND <
|
Yes that's what I was thinking at 1am ;) I will refactor the method to handle alias and to trow exception when there is conflic (adding a classname that already exist or is the current class) |
Will we remove some properties? Envoyé de mon iPhone Le 25 nov. 2011 à 11:40, Jérémie Augustinreply@reply.github.com a écrit :
|
that's what I asked in the code the other way around ;) |
Who will rename these stuffs ? Le 25 nov. 2011 à 11:52, Jérémie Augustinreply@reply.github.com a écrit :
|
We should keep these things hardcoded and remove useless properties. Le 25 nov. 2011 à 11:52, Jérémie Augustinreply@reply.github.com a écrit :
|
I refactor But now I have a big Probleme with non prefixed base class, we will have to give alias to all child classes. if we have a Model\Base\Book like : <?php
namespace Model\Base;
use Model\Book as ChildBook;
use Model\Author;
class Book extends BaseObject implements Persistent
{
} This won't work and we have to do this : <?php
namespace Model\Base;
use Model\Book as ChildBook;
use Model\Author as ChildAuthor;
class Book extends BaseObject implements Persistent
{
} What do you think about this, should we continue on this way ? |
Why ? Envoyé de mon iPhone Le 26 nov. 2011 à 01:32, Jérémie Augustinreply@reply.github.com a écrit :
|
take a look at the fatal I got when running the test:
and the class look like this : <?php
namespace Propel\Tests\Bookstore\Behavior\Base;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Query\Criteria;
use Propel\Runtime\Query\ModelCriteria;
use Propel\Runtime\Query\ModelJoin;
use Propel\Tests\Bookstore\Behavior\AggregateComment;
use Propel\Tests\Bookstore\Behavior\AggregateCommentPeer;
use Propel\Tests\Bookstore\Behavior\AggregatePost;
use Propel\Tests\Bookstore\Behavior\AggregatePostQuery;
use Propel\Tests\Bookstore\Behavior\AggregateCommentQuery as ChildAggregateCommentQuery;
/**
* Base class that represents a query for the 'aggregate_comment' table.
*
*
* @package propel.generator.Propel.Tests.Bookstore.Behavior.Base
*/
abstract class AggregateCommentQuery extends ModelCriteria
{ My point of view is that we Cannot use Propel\Tests\Bookstore\Behavior\AggregateComment as AggregateComment because there is already a class in the Propel\Tests\Bookstore\Behavior\Base namespace that is named AggregateComment (the base object) |
I found this, that prouve the opposite, but in our case there is a conflict. http://www.php.net/manual/fr/language.namespaces.faq.php#language.namespaces.faq.conflict [french] I think it could be because of Symfony 2 autoload. I test to remove the Propel\Tests\Bookstore\Behavior\Base\AggrecateColumn, then it passed the first test and faill the next one for the same reason a conflict with a base class |
I made a new commit, But I still get lot's of issues :( first the qucikbuilder, and schema without namespace. I force the renaming of child class but this mess up generated phpdoc and some other things :( |
I guess we should be able to generate non-namespaced classes as PHP 5.3 doesn't force anyone to use namespaces. |
I am waiting answer in #82 to fix some issues with Classname / FQCN |
I push new commits. I still get 10 failures on Runtime tests (caused by Classname / FQCN keys issues #82) |
@willdurand has discuss, I will drop support for non-namespaced classes because child classes will be in conflict with base classes |
@jaugustin Can you explain us again why we have these conflicts? Seems like a good |
No problem Envoyé de mon iPhone Le 12 déc. 2011 à 13:42, Jérémie Augustinreply@reply.github.com a écrit :
|
@fzaninotto that work with namespaced model, my issue is with model without namespace:
where the second Book is the base class and <?php
use Book as BaseBook //this will throw a fatal exception
class Book extends BaseBook
{
} the other way to support non-namespaced model is to set |
Why don't you use |
ok, I will try that solution. <?php
use Base\Book as BaseBook
class Book extends BaseBook
{
} |
Work in progress : I fixed runtime tests Still lots of work's to do on builder, I will implements methods mentioned in #82, and use them in the right place in all builder file
I have done some work to automaticaly declare "use statement" but it's not realy good, to much hack needed to fix simple case. |
TODO:
|
Wow, that's a lot left to do. I suggest you rebase now, or you'll have more work afterwards. Le 22 déc. 2011 à 23:39, Jérémie Augustinreply@reply.github.com a écrit :
|
Rebased :) |
WIP only 266 errors left :( |
Tests that Fails:
|
Nice, keep going! |
@jaugustin I can see few failures due to the model name. What's the plan? Should we use the FQCN or just QCN here? Some tests expect the QCN ( |
Some news : Tests that Fails:
Tests Ok:
But some work need to be done on the use of FQCN / QCN / CN in the Query Object because it's not realy consistent |
@jaugustin can you ask few questions to decide what we have to do about FQCN/QCN/CN ? This refactoring is really important, and almost finished (the behaviors part is not a big deal), so we have to be sure we provide clean changes. |
Tests that still failling :
The end of this issue has never been so close ;) |
only one behavior failing :
|
Putting the champagne in the fridge |
…ce of QueryInheritance force Base when needed, the end of #35
Huge piece of work! Congratulations! |
issue closed |
The generated Model classes are currently stored in files under the 'Om' namespace (and subdirectory). 'om' used to mean 'Object Model' (although I'm not really sure), but the stub files are also part of the Object Model, so ot doesn't really make sense.
I suggest to rename the 'Om' folder to 'Base', and rename the generated classes from 'BaseBook' to 'Base\Book', which would make more sense.
The text was updated successfully, but these errors were encountered: