|
$this->getDoctrine()->getManager();
|
Get default entity manager
|
|
$this->getDoctrine()->getManagerForClass(MyEntity::class)
|
Get entity specific manager
|
|
$this->getDoctrine()->getRepository(MyEntity::class);
|
|
getResult($hydrationMode = self::HYDRATE_OBJECT)
|
Retrieve a collection
|
|
getSingleResult($hydrationMode = null)
|
Retrieve a single result or exception
|
|
getOneOrNullResult($hydrationMode = null)
|
Retrieve a result or NULL
|
|
getArrayResult()
|
Retrieve an array
|
|
getScalarResult()
|
Retrieves a flat/rectangular result set of scalar values
|
|
getSingleScalarResult()
|
Retrieves a single scalar value or exception
|
|
AbstractQuery::HYDRATE_OBJECT
|
Object graph default
|
|
AbstractQuery::HYDRATE_ARRAY
|
Array graph
|
|
AbstractQuery::HYDRATE_SCALAR
|
Flat rectangular result with scalars
|
|
AbstractQuery::HYDRATE_SINGLE_SCALAR
|
Single scalar value
|
|
AbstractQuery::HYDRATE_SIMPLEOBJECT
|
Very simple object fast
|
|
setCacheMode($cacheMode)
|
|
|
Cache::MODE_GET
|
may read, not write
|
|
Cache::MODE_PUT
|
no read, write all
|
|
Cache::MODE_NORMAL
|
read and write
|
|
Cache::MODE_REFRESH
|
no read, only refresh
|
|
setCacheable($trueFalse)
|
Enable/disable result caching
|
|
find($id)
|
Returns one entity
|
|
findOneBy($criteria, $orderBy)
|
Returns one entity
|
|
findBy($criteria, $orderBy, $limit, $offset)
|
Returns collection
|
|
$criteria = ['field' => 'value']
|
Single field / value
|
|
$criteria = ['field' => ['value1', 'value2']]
|
Single where-in
|
|
$criteria = ['field1' => 'value', 'field2' => 'value2']
|
multiple fields / values
|
|
where($Expression)
|
Replaces previous statement
|
|
[and/or]Where($Expression)
|
Adds AND /OR where statement
|
|
orderBy($array)
|
Sets OrderBy
|
|
setFirstResult($firstResult)
|
Sets first result
|
|
setMaxResult($max)
|
Sets Maximum results
|
|
andX($arg1, $arg2, ...)
|
Multiple arguments AND
|
|
orX($arg1, $arg2, ...)
|
Multiple arguments OR
|
|
[n]eq($field, $value)
|
[Not] Equal
|
|
gte
|
Greater than [or equal]
|
|
lte
|
Less than [or equal]
|
|
isNull($field)
|
Is Null
|
|
[not]in($field, array $values)
|
[not] In
|
|
memberOf($field, $value)
|
ExpressionBuilder only Member of
|
|
isMemberOf($field, $value)
|
Expr only Member of
|
|
isNotNull($field)
|
Expr only Is not Null
|
|
between($field, $x, $y)
|
Expr only Between $x and $y
|
|
trim($field)
|
Expr only Trim
|
|
concat($x, $y)
|
Expr only Concat
|
|
literal($string)
|
Expr only Literal
|
|
lower($field)
|
Expr only Lower case
|
|
upper($field)
|
Expr only Upper case
|
|
count($field)
|
Expr only count
|
|
setParameter($parameter, $value)
|
|
addCriteria(Criteria $criteria)
|
|
[get/set]MaxResults($maxResults)
|
|
[get/set]FirstResult($firstResult)
|
|
getQuery()
|
|
add($dqlPartName, $dqlPart, $append = false)
|
|
$dqlPartName: select, from, join, set, where, groupBy, having, orderBy
|
|
Wrappers for add():
|
|
[add]select($select= null)
|
|
delete($delete = null, $alias = null)
|
|
update($update = null, $alias = null)
|
|
set($key, $value)
|
|
from($from, $alias, $indexBy = null)
|
|
[inner/left]join($join, $alias, $conditionType = null, $condition = null, $indexBy = null)
|
|
[and/or]where($where)
|
|
[add]groupBy($groupBy)
|
|
[and/or]having($having)
|
|
[add]orderBy($field, $order = null)
|
|
$Connection= $EntityManager->getConnection(): Connection;
|
Get connection
|
|
$Statement = $Connection->prepare(string $sql): Statement;
|
Prepare statement from string
|
|
$Statement->bindValue(string|int $param, $value, $type = null): bool
|
Bind a value to a corresponding name
|
|
$Statement->execute(?array $params = null): bool
|
Execute the statement
|
|
$Statement->fetchAll(int $fetchStyle = PDO::FETCH_BOTH): array
|
Fetch all results
|
|
$Statement->fetchOne(int $fetchStyle = PDO::FETCH_BOTH): array
|
Fetch single result
|
|
$Statement->rowCount(): int
|
Return the number of rows
|
|
$Statement->free(): void
|
Free stored result memory
|
|
IS_AUTHENTICATED_FULLY
|
User has successfully authenticated, not via 'remember me cookie'
|
|
IS_AUTHENTICATED_REMEMBERED
|
All logged in users
|
|
IS_REMEMBERED
|
Only users authenticated using the remember me functionality
|
|
IS_IMPERSONATOR
|
When the current user is impersonating another user in this session
|
|
'action' => ''
|
Where to send the form's data on submission (usually a URI)
|
|
'allow_extra_fields' => false
|
Allow additional fields to be submitted
|
|
'error_mapping' => array('matchingCityAndZipCode' => 'city')
|
Modify the target of a validation error
|
|
'extra_fields_message' => 'This form should not contain extra fields.'
|
Validation error message if additional fields are submitted
|
|
'inherit_data' => false
|
Inhered data from parent form or not
|
|
'method' => 'POST'
|
HTTP method used to submit the form
|
|
'post_max_size_message' => 'The uploaded file was too large.'
|
Validation message for size of post form data
|
|
'validation_groups' => false
|
Disable the Validation of Submitted Data
|
|
emergency()
|
System is unusable.
|
||
|
alert()
|
Action must be taken immediately.
|
||
|
critical()
|
Critical conditions.
|
||
|
error()
|
Runtime errors that do not require immediate action but should typically be logged and monitored.
|
VERBOSITY_QUIET (-1)
|
-q / stderr
|
|
warning()
|
Exceptional occurrences that are not errors.
|
VERBOSITY_NORMAL (0)
|
(non) / stdout
|
|
notice()
|
Normal but significant events.
|
VERBOSITY_VERBOSE (1)
|
-v
|
|
info()
|
Interesting events.
|
VERBOSITY_VERY_VERBOSE (2)
|
-vv
|
|
debug()
|
Detailed debug information.
|
VERBOSITY_DEBUG (3)
|
-vvv
|
|
bin\console
|
List available commands and show the Symfony version
|
|
server:run
|
Run the built-in web server
|
|
assets:install --symlink
|
Install bundle assets as a symlink or hardcopy
|
|
debug:autowire
|
Lists classes/interfaces you can use for autowiring
|
|
debug:config
|
Dumps the current configuration for an extension
|
|
debug:container
|
Displays current services for an application
|
|
debug:form
|
Lists classes/interfaces you can use for autowiring
|
|
debug:route
|
Displays current routes for an application
|
|
{{ form(view, variables) }}
|
Render whole form
|
|
{{ form_start(view, variables) }}
|
Render start tag
|
|
{{ form_errors(view) }}
|
Render global errors
|
|
{{ form_row(view, variables) }}
|
Render all the fields
|
|
{{ form_rest(view, variables) }}
|
Render all other fields
|
|
{{ form_end(view, variables) }}
|
Render end tag +
all other fields |
|
{{ form_row(view.field) }}
|
Render field label, error
and widget |
|
{{ form_label(view.field, label, variables) }}
|
Render field label
|
|
{{ form_errors(view.field) }}
|
Render field error
|
|
{{ form_widget(view.field, variables) }}
|
Render field widget
|
|
render($view, $parameters, $response = null)
|
Render the template and return a Response
|
|
json($data, $status = 200, $headers = array(), $context = array())
|
Encode data and return a Json response
|
|
file($file, $fileName = null, $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT)
|
Return a file response
|
|
redirectToRoute($route, $parameters = array(), $status = 302)
|
Redirect to route
|
|
redirect($url, $status = 302)
|
Redirect to external URL
|
|
forward($controller, $path = array(), $query = array())
|
Forwards the request to another controller
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.