Archives by date

You are browsing the site archives by date.

【Symfony2.3】parameters.ymlに登録したパラメーターをコンテナから取得する。

parameters:
    hoge: fuga

あとはこう。

$this->container->getParameter('hoge');

 

【Symfony2.3】ファイルの操作を行う。

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

 

【AngularJS】フィルタリング済みの件数を取得する。

検索機能などの実装時、フィルタリング後の件数を取得したい場合。

<span>{{(data|filter:query).length}}</span>

queryで絞った後の配列のlengthを参照してやればOK。

下記のような方法もエレガント。

<div ng-repeat="person in filtered = (data | filter: query)">
</div>

で、こうする。

Showing {{filtered.length}} Persons

リピートの母体にそもそもフィルタリング後のデータを注入してやるのは斬新。

 

【AngularJS】コントローラーからフィルターを使う方法。

まずはコントローラーに「$filter」サービスを注入する。

function myCtrl($scope, $filter)
{
}

次に使いたいフィルターを呼び出す

$filter('filtername');

引数を渡してやれば完成。

function myCtrl($scope, $filter)
{
    $filter('filtername')(arg1,arg2);
}

arg1にng-repeatでも用いるリストを渡せばOK。

 

【Symfony2】エクセプションまとめ。

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