最終行の意味は調査中。
php app/console cache:clear --env=prod --no-debug php app/console assets:install web_directory php app/console assetic:dump web_directory
最終行の意味は調査中。
php app/console cache:clear --env=prod --no-debug php app/console assets:install web_directory php app/console assetic:dump web_directory
$path = '/path/to/file.ext' $response = new Response(); $response->headers->set('Content-type', 'application/octect-stream'); $response->headers->set('Content-Disposition', sprintf('attachment; filename="%s";', 'fileName')); $response->sendHeaders(); $response->setContent(readfile($path));
めも。
foreach($request->files as $uploadedFile) { $name = //... $file = $uploadedFile->move($directory, $name); }
ファイルアップロード周りの関数の詳細は下記URLを参照されたし。
http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/File/UploadedFile.html
$this->get('kernel')->getRootDir();
parameters: hoge: fuga
あとはこう。
$this->container->getParameter('hoge');
Symfony\Component\Filesystem\Filesystemを用いる。
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Exception\IOException; $fs = new Filesystem(); try { $fs->mkdir('/tmp/random/dir/' . mt_rand()); } catch (IOException $e) { echo "An error occurred while creating your directory"; }
これは便利。
メソッド一覧など詳細は下記URLを参照。
http://symfony.com/doc/2.3/components/filesystem.html
2.1時代のものだけど参考にはなりそう。
Symfony/Component/OptionsResolver/Exception/MissingOptionsException.php Symfony/Component/OptionsResolver/Exception/OptionDefinitionException.php Symfony/Component/OptionsResolver/Exception/InvalidOptionsException.php Symfony/Component/Serializer/Exception/InvalidArgumentException.php Symfony/Component/Serializer/Exception/UnsupportedException.php Symfony/Component/Serializer/Exception/UnexpectedValueException.php Symfony/Component/Serializer/Exception/LogicException.php Symfony/Component/Serializer/Exception/Exception.php Symfony/Component/Serializer/Exception/RuntimeException.php Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php Symfony/Component/HttpKernel/Exception/HttpException.php Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php Symfony/Component/HttpKernel/Exception/FlattenException.php Symfony/Component/Form/Exception/InvalidConfigurationException.php Symfony/Component/Form/Exception/TransformationFailedException.php Symfony/Component/Form/Exception/PropertyAccessDeniedException.php Symfony/Component/Form/Exception/TypeLoaderException.php Symfony/Component/Form/Exception/NotInitializedException.php Symfony/Component/Form/Exception/NotValidException.php Symfony/Component/Form/Exception/AlreadyBoundException.php Symfony/Component/Form/Exception/InvalidPropertyPathException.php Symfony/Component/Form/Exception/CreationException.php Symfony/Component/Form/Exception/StringCastException.php Symfony/Component/Form/Exception/FormException.php Symfony/Component/Form/Exception/TypeDefinitionException.php Symfony/Component/Form/Exception/UnexpectedTypeException.php Symfony/Component/Form/Exception/ErrorMappingException.php Symfony/Component/Form/Exception/InvalidPropertyException.php Symfony/Component/Process/Exception/ProcessFailedException.php Symfony/Component/Process/Exception/RuntimeException.php Symfony/Component/Yaml/Exception/DumpException.php Symfony/Component/Yaml/Exception/ParseException.php Symfony/Component/Filesystem/Exception/IOException.php Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php Symfony/Component/HttpFoundation/File/Exception/UploadException.php Symfony/Component/HttpFoundation/File/Exception/FileException.php Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php Symfony/Component/DependencyInjection/Exception/LogicException.php Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php Symfony/Component/DependencyInjection/Exception/RuntimeException.php Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php Symfony/Component/Config/Exception/FileLoaderLoadException.php Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php Symfony/Component/Config/Definition/Exception/ForbiddenOverwriteException.php Symfony/Component/Config/Definition/Exception/UnsetKeyException.php Symfony/Component/Config/Definition/Exception/Exception.php Symfony/Component/Config/Definition/Exception/InvalidDefinitionException.php Symfony/Component/Config/Definition/Exception/InvalidTypeException.php Symfony/Component/Config/Definition/Exception/DuplicateKeyException.php Symfony/Component/Routing/Exception/InvalidParameterException.php Symfony/Component/Routing/Exception/ResourceNotFoundException.php Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php Symfony/Component/Routing/Exception/RouteNotFoundException.php Symfony/Component/Routing/Exception/MethodNotAllowedException.php Symfony/Component/Validator/Exception/MappingException.php Symfony/Component/Validator/Exception/MissingOptionsException.php Symfony/Component/Validator/Exception/GroupDefinitionException.php Symfony/Component/Validator/Exception/ConstraintDefinitionException.php Symfony/Component/Validator/Exception/UnexpectedTypeException.php Symfony/Component/Validator/Exception/InvalidOptionsException.php Symfony/Component/Validator/Exception/ValidatorException.php Symfony/Component/Locale/Exception/MethodArgumentValueNotImplementedException.php Symfony/Component/Locale/Exception/MethodArgumentNotImplementedException.php Symfony/Component/Locale/Exception/MethodNotImplementedException.php Symfony/Component/Locale/Exception/NotImplementedException.php Symfony/Component/CssSelector/Exception/ParseException.php Symfony/Component/Security/Core/Exception/SessionUnavailableException.php Symfony/Component/Security/Core/Exception/AuthenticationException.php Symfony/Component/Security/Core/Exception/UnsupportedUserException.php Symfony/Component/Security/Core/Exception/AccessDeniedException.php Symfony/Component/Security/Core/Exception/CredentialsExpiredException.php Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php Symfony/Component/Security/Core/Exception/LogoutException.php Symfony/Component/Security/Core/Exception/CookieTheftException.php Symfony/Component/Security/Core/Exception/InsufficientAuthenticationException.php Symfony/Component/Security/Core/Exception/DisabledException.php Symfony/Component/Security/Core/Exception/InvalidCsrfTokenException.php Symfony/Component/Security/Core/Exception/LockedException.php Symfony/Component/Security/Core/Exception/AuthenticationServiceException.php Symfony/Component/Security/Core/Exception/AuthenticationCredentialsNotFoundException.php Symfony/Component/Security/Core/Exception/TokenNotFoundException.php Symfony/Component/Security/Core/Exception/AccountExpiredException.php Symfony/Component/Security/Core/Exception/NonceExpiredException.php Symfony/Component/Security/Core/Exception/AccountStatusException.php Symfony/Component/Security/Core/Exception/ProviderNotFoundException.php Symfony/Component/Security/Core/Exception/BadCredentialsException.php Symfony/Component/Security/Acl/Exception/SidNotLoadedException.php Symfony/Component/Security/Acl/Exception/AclNotFoundException.php Symfony/Component/Security/Acl/Exception/NotAllAclsFoundException.php Symfony/Component/Security/Acl/Exception/InvalidDomainObjectException.php Symfony/Component/Security/Acl/Exception/NoAceFoundException.php Symfony/Component/Security/Acl/Exception/Exception.php Symfony/Component/Security/Acl/Exception/ConcurrentModificationException.php Symfony/Component/Security/Acl/Exception/AclAlreadyExistsException.php Doctrine/Common/DataFixtures/Exception/CircularReferenceException.php Doctrine/Common/Annotations/AnnotationException.php Doctrine/Common/CommonException.php Doctrine/Common/Persistence/Mapping/MappingException.php Doctrine/ORM/TransactionRequiredException.php Doctrine/ORM/Query/QueryException.php Doctrine/ORM/Query/AST/ASTException.php Doctrine/ORM/Mapping/MappingException.php Doctrine/ORM/UnexpectedResultException.php Doctrine/ORM/PessimisticLockException.php Doctrine/ORM/OptimisticLockException.php Doctrine/ORM/Internal/Hydration/HydrationException.php Doctrine/ORM/ORMException.php Doctrine/ORM/NonUniqueResultException.php Doctrine/ORM/EntityNotFoundException.php Doctrine/ORM/Tools/ToolsException.php Doctrine/ORM/Tools/Export/ExportException.php Doctrine/ORM/Proxy/ProxyException.php Doctrine/ORM/NoResultException.php Doctrine/ORM/ORMInvalidArgumentException.php Doctrine/DBAL/Query/QueryException.php Doctrine/DBAL/Types/ConversionException.php Doctrine/DBAL/Schema/SchemaException.php Doctrine/DBAL/Sharding/ShardingException.php Doctrine/DBAL/ConnectionException.php Doctrine/DBAL/Cache/CacheException.php Doctrine/DBAL/Driver/OCI8/OCI8Exception.php Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php Doctrine/DBAL/Driver/Mysqli/MysqliException.php Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php Doctrine/DBAL/DBALException.php
エンティティ内のジョインしているフィールドでシリアライズしたくない項目がある場合に便利。
use JMS\Serializer\Annotation as JMS; class Report { /** * @JMS\Exclude */ protected $categories; }
無視したい変数のアノテーションで「@JMS\Exclude」と指定してやればOK。
その他グルーピングなども指定出来る模様。詳細は下記。
http://jmsyst.com/libs/serializer/master/cookbook/exclusion_strategies