[PropelParamConverter] add comment
This commit is contained in:
parent
6117614bec
commit
e1f18fbdf2
|
@ -122,6 +122,12 @@ class PropelParamConverter implements ParamConverterInterface
|
||||||
return false;
|
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)
|
protected function findPk($classQuery, Request $request)
|
||||||
{
|
{
|
||||||
if (in_array($this->pk, $this->exclude) || !$request->attributes->has($this->pk)) {
|
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));
|
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)
|
protected function findOneBy($classQuery, Request $request)
|
||||||
{
|
{
|
||||||
$query = $this->getQuery($classQuery);
|
$query = $this->getQuery($classQuery);
|
||||||
|
@ -151,6 +164,12 @@ class PropelParamConverter implements ParamConverterInterface
|
||||||
return $query->findOne();
|
return $query->findOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the query class with optional joinWith
|
||||||
|
*
|
||||||
|
* @param string $classQuery
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
protected function getQuery($classQuery)
|
protected function getQuery($classQuery)
|
||||||
{
|
{
|
||||||
$query = $classQuery::create();
|
$query = $classQuery::create();
|
||||||
|
@ -172,6 +191,12 @@ class PropelParamConverter implements ParamConverterInterface
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the valid join Criteria base on the with parameter
|
||||||
|
*
|
||||||
|
* @param array $with
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
protected function getValidJoin($with)
|
protected function getValidJoin($with)
|
||||||
{
|
{
|
||||||
switch (str_replace(array('_', 'JOIN'),'', strtoupper($with[1]))) {
|
switch (str_replace(array('_', 'JOIN'),'', strtoupper($with[1]))) {
|
||||||
|
|
Loading…
Reference in a new issue