Skip to content

Commit 9132390

Browse files
Briandbu
authored andcommitted
Update bundle to current cmf
1 parent 3c27de2 commit 9132390

23 files changed

+111
-187
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Tests/Resources/app/cache
22
Tests/Resources/app/logs
3-
Tests/Resources/test_db.sqlite
43
bin/
54
composer.lock
65
vendor/

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ php:
77

88
env:
99
- SYMFONY_VERSION=2.5.*
10-
10+
1111
matrix:
1212
allow_failures:
1313
- env: SYMFONY_VERSION=dev-master
@@ -18,8 +18,6 @@ matrix:
1818
env: SYMFONY_VERSION=2.4.*
1919
- php: 5.5
2020
env: SYMFONY_VERSION=dev-master
21-
22-
2321

2422
before_script:
2523
- composer self-update

Controller/PostController.php

Lines changed: 0 additions & 64 deletions
This file was deleted.

DependencyInjection/Configuration.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,13 @@ public function getConfigTreeBuilder()
3939
// admin
4040
->arrayNode('sonata_admin')
4141
->canBeEnabled()
42-
->addDefaultsIfNotSet()
43-
->children()
44-
->booleanNode('enabled')->defaultTrue()->end()
45-
->end()
4642
->end()
4743

4844
// menu
4945
->arrayNode('integrate_menu')
5046
->addDefaultsIfNotSet()
5147
->canBeEnabled()
5248
->children()
53-
->booleanNode('enabled')->defaultTrue()->end()
5449
->scalarNode('content_key')->defaultNull()->end()
5550
->end()
5651
->end()
@@ -60,7 +55,6 @@ public function getConfigTreeBuilder()
6055
->addDefaultsIfNotSet()
6156
->canBeEnabled()
6257
->children()
63-
->booleanNode('enabled')->defaultTrue()->end()
6458
->scalarNode('posts_per_page')->defaultValue(5)->end()
6559
->end()
6660
->end()

Repository/BlogRepository.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@ public function setBasepath($basepath)
4646
$this->basepath = $basepath;
4747
}
4848

49-
/**
50-
* Find blog by name
51-
*
52-
* @param string $name
53-
* @return null|Blog
54-
*/
55-
public function findByName($name)
56-
{
57-
return $this->search(array(
58-
'name' => $name,
59-
'limit' => 1,
60-
));
61-
}
62-
6349
/**
6450
* Search for blogs by an array of options
6551
*
@@ -116,12 +102,6 @@ protected function setDefaultOptions(OptionsResolver $resolver)
116102
'limit' => 'int',
117103
));
118104

119-
$resolver->setAllowedValues(array(
120-
'limit' => function($value) {
121-
return $value > 0;
122-
},
123-
));
124-
125105
return $resolver;
126106
}
127107

Repository/PostRepository.php

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,10 @@ public function __construct($dm, ClassMetadata $class)
3636
$this->resolver = $this->setDefaultOptions(new OptionsResolver());
3737
}
3838

39-
/**
40-
* Find post by title
41-
*
42-
* @param string $title
43-
* @return Post|null
44-
*/
45-
public function findByTitle($title)
46-
{
47-
return $this->search(array(
48-
'title' => $title,
49-
'limit' => 1,
50-
));
51-
}
52-
5339
/**
5440
* Search for posts by an array of options:
5541
* - blogId: string (required)
56-
* - isPublishable: boolean (optional, default true)
42+
* - isPublishable: boolean (optional, default true) // TODO: https://github.com/symfony-cmf/CoreBundle/issues/126
5743
* - title: string (optional)
5844
* - limit: integer (optional)
5945
* - orderBy: array of arrays('field' => $field, 'order' => 'ASC or DESC') (optional)
@@ -146,30 +132,6 @@ protected function setDefaultOptions(OptionsResolver $resolver)
146132
'orderBy' => 'array',
147133
));
148134

149-
$resolver->setAllowedValues(array(
150-
'limit' => function($value) {
151-
return $value > 0;
152-
},
153-
'orderBy' => function(array $orderBys) {
154-
$validOrderBys = array();
155-
foreach ($orderBys as $orderBy) {
156-
157-
if ($orderByValid = isset($orderBy['order'])) {
158-
if(!in_array(strtolower($orderBy['order']), array('asc', 'desc'), true)) {
159-
throw new \InvalidArgumentException(sprintf(
160-
'Unrecognized orderBy order value "%s". order must be one of ASC or DESC.',
161-
$orderBy['order']
162-
));
163-
}
164-
}
165-
166-
$validOrderBys[] = isset($orderBy['field']) && $orderByValid;
167-
}
168-
169-
return count(array_filter($validOrderBys)) == count($orderBys);
170-
},
171-
));
172-
173135
return $resolver;
174136
}
175137
}

Resources/config/cmf_routing_auto.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" ?>
2+
<auto-mapping xmlns="http://cmf.symfony.com/schema/routing_auto">
3+
4+
<mapping class="Symfony\Cmf\Bundle\BlogBundle\Doctrine\Phpcr\Blog" uri-schema="/blogs/{blog}">
5+
6+
<token-provider token="blog" name="content_method">
7+
<option name="method">getName</option>
8+
</token-provider>
9+
10+
</mapping>
11+
12+
<mapping class="Symfony\Cmf\Bundle\BlogBundle\Doctrine\Phpcr\Post" uri-schema="/blogs/{blog}/{date}/{title}">
13+
14+
<token-provider token="blog" name="content_method">
15+
<option name="method">getBlog</option>
16+
</token-provider>
17+
18+
<token-provider token="date" name="content_datetime">
19+
<option name="method">getDate</option>
20+
</token-provider>
21+
22+
<token-provider token="title" name="content_method">
23+
<option name="method">getTitle</option>
24+
</token-provider>
25+
26+
</mapping>
27+
28+
</auto-mapping>

Resources/config/cmf_routing_auto.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

Resources/doc/building-a-blog.rst

Lines changed: 0 additions & 20 deletions
This file was deleted.

Resources/views/Blog/detail.html.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{# CmfBlogBundle:Blog:detail.html.twig #}
2-
31
{% extends "CmfBlogBundle::layout.html.twig" %}
42

53
{% block content %}

0 commit comments

Comments
 (0)