@@ -36,24 +36,10 @@ public function __construct($dm, ClassMetadata $class)
36
36
$ this ->resolver = $ this ->setDefaultOptions (new OptionsResolver ());
37
37
}
38
38
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
-
53
39
/**
54
40
* Search for posts by an array of options:
55
41
* - blogId: string (required)
56
- * - isPublishable: boolean (optional, default true)
42
+ * - isPublishable: boolean (optional, default true) // TODO: https://github.com/symfony-cmf/CoreBundle/issues/126
57
43
* - title: string (optional)
58
44
* - limit: integer (optional)
59
45
* - orderBy: array of arrays('field' => $field, 'order' => 'ASC or DESC') (optional)
@@ -146,30 +132,6 @@ protected function setDefaultOptions(OptionsResolver $resolver)
146
132
'orderBy ' => 'array ' ,
147
133
));
148
134
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
-
173
135
return $ resolver ;
174
136
}
175
137
}
0 commit comments