Skip to content
Browse files

[PropelParamConverter] add comment

  • Loading branch information...
1 parent 6117614 commit e1f18fbdf249135e50663a8e48865b332cbb2f11 @jaugustin jaugustin committed with willdurand
Showing with 25 additions and 0 deletions.
  1. +25 −0 Request/ParamConverter/PropelParamConverter.php
View
25 Request/ParamConverter/PropelParamConverter.php
@@ -122,6 +122,12 @@ public function supports(ConfigurationInterface $configuration)
return false;
}
+ /**
+ * Try to find the object with the id
+ *
+ * @param string $classQuery the query class
+ * @param Request $request
+ */
protected function findPk($classQuery, Request $request)
{
if (in_array($this->pk, $this->exclude) || !$request->attributes->has($this->pk)) {
@@ -131,6 +137,13 @@ protected function findPk($classQuery, Request $request)
return $this->getQuery($classQuery)->findPk($request->attributes->get($this->pk));
}
+ /**
+ * Try to find the object with all params from the $request
+ *
+ * @param string $classQuery
+ * @param Request $request the query class
+ * @param array $exclude an array of param to exclude from the filter
+ */
protected function findOneBy($classQuery, Request $request)
{
$query = $this->getQuery($classQuery);
@@ -151,6 +164,12 @@ protected function findOneBy($classQuery, Request $request)
return $query->findOne();
}
+ /**
+ * Init the query class with optional joinWith
+ *
+ * @param string $classQuery
+ * @throws \Exception
+ */
protected function getQuery($classQuery)
{
$query = $classQuery::create();
@@ -172,6 +191,12 @@ protected function getQuery($classQuery)
return $query;
}
+ /**
+ * Return the valid join Criteria base on the with parameter
+ *
+ * @param array $with
+ * @throws \Exception
+ */
protected function getValidJoin($with)
{
switch (str_replace(array('_', 'JOIN'),'', strtoupper($with[1]))) {

0 comments on commit e1f18fb

Please sign in to comment.
Something went wrong with that request. Please try again.