-
Notifications
You must be signed in to change notification settings - Fork 31
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
Version upgrades and cleanups #58
Version upgrades and cleanups #58
Conversation
group="dashboard.group_blog" | ||
label_catalogue="CmfBlogBundle" | ||
label="dashboard.label_blog" | ||
<service id="cmf_blog.blog_admin" class="%cmf_blog.blog_admin_class%"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter name BC break
awesome that you are working on this! in general I would say that you should not concern yourself with BC too much as this was never stable. |
)) | ||
->add('body', 'textarea') | ||
->add('blog', 'phpcr_document', array( | ||
'class' => 'Symfony\Cmf\Bundle\BlogBundle\Document\Blog', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not hard-code this
c2816bf
to
0dd64f5
Compare
) | ||
); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code smells, but I'm not sure how best to improve it.
$allowedFields should not be hard-coded, and $throwIfNotFound isn't testable/reusable (eg if somebody wanted to add 'groupBy' support)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you even need to validate this here? The PHPCR-ODM will throw an exception if you try and order by an invalid field. Given that, do you even need an option resolver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just limit the type and let the PHPCR-ODM validate the value.
|
||
return $this->renderResponse($contentTemplate, compact('post')); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line
Looking really nice :) Tagging was an issue for me here -- i.e. I started by writing Tag functionality in the bundle, but it shouldn't be the responsiblity of this bundle at all. i.e. it should be a CMF component which handles tags (or if possible something from another vendor, e.g. Sylius etc). For my blog I wrote a tagging bundle specifically for PHPCR-ODM, but I won't vouch for its quality/methodology and don't want to maintain it :P |
for tagging, i looked into SyliusTaxonomy but never found time to wrap it up: Sylius/Sylius#647 i suggest to leave tags out completely of this PR for now and instead check the sylius option again and then integrate here. |
It would also be neat to add functional tests to this bundle as we have done for the others. We have a testing component which lets you easily build a test application. The idea is that we have almost a "demo" application which you can run as follows: $ ./vendor/symfony-cmf/testing/bin/server Functional tests can then be added like in this example from the MenuBundle. I can help you out here and it needn't be merged with this PR. |
@dantleech Thanks for taking the time to review this PR! I went ahead and removed all of the tagging-related code for now. I also added a functional test for the BlogAdmin create action. After reviewing the functional test example in the MenuBundle, I wasn't entirely clear on the precise difference between an integration test and more of a web test. I went with the latter, as this is how we've been handling functional testing internally at VDW. Any feedback you have on methodology in that regard would be appreciated! |
@@ -1,4 +1,7 @@ | |||
Tests/Resources/app/cache | |||
Tests/Resources/app/logs | |||
Tests/Resources/test_db.sqlite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also put this in app/cache
The web tests test are HTTP tests, integration tests would be things that test services from the container The idea of the web test is that we should be able to test an implentation of the BlogBundle, i.e. the For example, in addition to the admin, we should test viewing a post via the |
use Symfony\Cmf\Bundle\BlogBundle\Document\Post; | ||
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Cmf\Bundle\BlogBundle\Doctrine\Phpcr\Post; | ||
|
||
class PostRepository extends DocumentRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dantleech how do you feel about the repositories. it seems correct to do this, but half of this is not blog specific - and afaik we did not do it in other bundles. i wonder if we should provide the base for most of this in the ContentBundle?
i am a bit unsure about the options resolver things we do. in the end, we wrap the query builder some more...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The search
method seems only to be called to find the posts which belong to a particular blog.
In which case I would recommend removing it and replacing it with a findForBlog
method if required -- and I am not sure it is as we could switch to the PageFanta paginator and its native PHPCR-ODM "driver".
So basically .. I think we could remove this, what do you think @briancappello ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be fine with removing this repository class and switching to PagerFanta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe lets do this in another PR after this one is merged?
didn't review this PR .. but I wonder if we shouldn't just merge at some point. then we can more easily collaborate on the details to tweak. |
* @param string $title | ||
* @return Post|null | ||
*/ | ||
public function findByTitle($title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this get called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's used - no objections on my end to removing it
"symfony-cmf/routing-auto-bundle": "1.0.*", | ||
"doctrine/phpcr-bundle": "1.0.*", | ||
"doctrine/phpcr-odm": "1.0.*" | ||
"sonata-project/doctrine-extensions": "~1.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be ~1.0.2|1.1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or ~1.0,>=1.0.2
?
ping |
any update on this? In oct. 2014 briancappello asked for updated deps, in december he did all the work, in march 2015 still nothing was merged. Why is this bundle even here if nobody maintains it and any help gets ignored. im trying out symfony cmf but this is really discouraging |
@connxnl keep in mind that this bundle is one of the showcase bundles of the CMF. It's goal is not so much of providing functionality, but more of providing examples of how to combine multiple CMF bundles. Seems like this PR is ready to be merged, but we didn't get a notice of the update (maintainers only get a notice about comments). So thanks for your head up! |
composer.lock | ||
vendor | ||
vendor/ | ||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the responsibility of the global git configuration of the developer, it is not specific to the project but to specific development environments. please remove this line.
@dantleech can you check if you see any blockers in here? i can do some minimal cleanup, squash the commits and merge. |
/** | ||
* Base Controller | ||
* | ||
* @author Daniel Leech <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write this :)
cleaned up and created a new branch in this repo |
This PR aims to bring the BlogBundle more in line with the CMF Bundle Standards.
General Changes
CMF 1.2.*
RoutingAutoBundle 1.0.*
Persistence
Blog
andPost
have been refactored into the Model and Doctrine/Phpcr namespaces.DoctrinePhpcrMappingsPass
, if the class is foundGenericInitializer
service to create thecmf_blog.blog_basepath
if it's not foundPostRepository
to support searching by an array input-verified with the OptionsResolverFront End
BlogController
intoBlogController
andPostController
New Features
KnpPaginatorBundle
Known Issues
Addresses issues #53 and #57