Skip to content
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

move document to model #112

Merged
merged 7 commits into from Jul 19, 2013
Merged

move document to model #112

merged 7 commits into from Jul 19, 2013

Conversation

dbu
Copy link
Member

@dbu dbu commented Jun 14, 2013

Q A
Bug fix? yes
New feature? yes
BC breaks? yes
Deprecations? yes
Tests pass? yes
Fixed tickets
License MIT
Doc PR TODO (small adjustments due to deprecation)

This turned out quite a big change in terms of code. in terms of deprecation, the only change for the user is he should now use Doctrine\Phpcr\Route instead of Document\Route.

SimpleCmsBundle will need adjustments as i did not do BC classes for the route and content providers.

Note that i did not yet change the configuration in a way that lets us chose the storage layer - that will be the next step when porting the things from #95 to this new concept.

@@ -48,7 +48,7 @@ protected function updateId(LifecycleEventArgs $args)

// only update route objects and only if the prefix can match, to allow
// for more than one listener and more than one route root
if ($doc instanceof Route
if (($doc instanceof Route || $doc instanceof RedirectRoute)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is one of the drawbacks of not having multiple inheritance/traits to build the document classes...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand, why can't they at least implement an interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well then we would define a PhpcrPathPrefixInterface or something, just sounds weird as its just an implementation detail. if this was a Trait, we could check the class for having the trait. (but until php 5.3 can be dropped, i guess we are at least in Symfony3...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Why would such an interface be a bad idea? Although, the only problem I can see here is if/when the user wants another type of Routing object à la "RedirectRoute". They would have to override this class - creating a little interface in the Doctrine/PHPCR namespace seems like a painless solution?

If we were to implement the interface I guess we would also have to determine the ID from either the DM or the metadata also.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, convinced. i added the interface

@dbu
Copy link
Member Author

dbu commented Jun 20, 2013

just pushed a fix for the configuration that will solve #105 . now this should be ready, and ready for adding the orm routing.

*
* @param SymfonyRoute $document the redirection target route
*/
public function setRouteTarget(SymfonyRoute $document)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Route and not SymfonyRoute? What would be the point of assigning a non-persisted route object?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this is on purpose. it needs to be something extending SymfonyRoute but not necessarily extending our model class. if its not mapped, phpcr-odm will complain when flushing.

@dantleech
Copy link
Member

We should implement the testing component on this bundle after this merge I think.

@dbu
Copy link
Member Author

dbu commented Jun 23, 2013

we do have quite some functional tests and the phpcr-odm bootstrap in this bundle already. but yeah, the testing component would clean up things and make it consistent with the other bundles.

@dbu
Copy link
Member Author

dbu commented Jun 24, 2013

@erichard @matteocaberlotto would be awesome if you could review this PR. the idea is to make supporting ORM simple with no code duplication. there is also a preliminary ORM PR #116 - that would be the place the ORM specific code that the original PR by matteocaberlotto contained.

@matteocaberlotto
Copy link
Contributor

hi, i will try to do it asap. i'm sorry, i am on time shortage lately.

@@ -0,0 +1,16 @@
<doctrine-mapping
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this RedirectRoute.phpcr.xml? Should this not be in the doctrine-phpcr directory and not in doctrine-model?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, we map the RedirectRoute model for the phpcr doctrine. doctrine-phpcr is for the classes in Doctrine/Phpcr that extend those in Model

@matteocaberlotto
Copy link
Contributor

the configuration part is working fine: now it only requires the specific provider to add orm routing.
i dont fully get how the inheritance mapping for entities should be implemented.

dbu added 3 commits June 30, 2013 22:53
Conflicts:
	CHANGELOG.md
	DependencyInjection/CmfRoutingExtension.php
	Tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php
	Tests/Functional/Doctrine/Phpcr/RouteTest.php
dbu added a commit that referenced this pull request Jul 19, 2013
@dbu dbu merged commit 1f79119 into master Jul 19, 2013
@dbu dbu deleted the create-models branch July 19, 2013 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants