[PropelParamConverter] add comment

This commit is contained in:
jaugustin 2012-05-08 21:37:57 +02:00 committed by William DURAND
parent 6117614bec
commit e1f18fbdf2

View file

@ -122,6 +122,12 @@ class PropelParamConverter implements ParamConverterInterface
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 @@ class PropelParamConverter implements ParamConverterInterface
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 @@ class PropelParamConverter implements ParamConverterInterface
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 @@ class PropelParamConverter implements ParamConverterInterface
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]))) {