ブログ

  • 自転車が見つかりました!?

    今日はエープリルフールだったので、新しい自転車を取りに行って、写真を撮りまくって、盗まれた自転車が出てきたと、嘘をつく予定だった。
    出てきた自転車には、サスが付いてただの、ブレーキがディスクになってただの、ピッカピカになってただの。
    でも、昼前に出て帰ってきたら日が暮れていた。
    あぁ、嬉しくも悲しい父親稼業。

  • Symfony(?)は難しい

    この2,3日、Symfonyを勉強している。
    入り口のHelloControllerを作って表示しようとしても、

    Class “AcmeHelloBundleControllerHelloController” does not exist.
    何回やっても、何回見なおしても、、、ダメ。
    Webを検索しても、”拡張子が間違ってる?”
    そんなこたぁねえよ。と思いつつ、再度確認。
    あった。

    う~~ん。。。と、ファイルを眺める。

    HdelloController.php
    ちゃんと、Hdelloってなってるな~。
    ?Hdello?

    解決!!

  • symfonyでバンドル作成

    Symfonyでバンドルとかいうのを作る。一つのアプリって感じ?
    で、PHPを使って作るらしい。
    Symfony/app/console generate:bundle [–namespace=”…”] [–dir=”…”] [–bundle-name=”…”] [–format=”…”] [–structure

    ということで、
    X:xamppphpphp X:xampphtdocsSymfonyappconsole generate:bundle –namespace=Acme/HelloBundle –format=yml
    と実行して、リターン&リターン&リターン!!
      Welcome to the Symfony2 bundle generator

    Your application code must be written in bundles. This command helps you generate them easily.

    Each bundle is hosted under a namespace (like Acme/Bundle/BlogBundle).
    The namespace should begin with a “vendor” name like your company name, your project name, or your client name, followed by one or more optional category sub-namespaces, and it should end with the bundle name itself (which must have Bundle as a suffix).

    See http://symfony.com/doc/current/cookbook/bundles/best_practices.html#index-1
    for more details on bundle naming conventions.
    Use / instead of for the namespace delimiter to avoid any problem.

    Bundle namespace [Acme/HelloBundle]:Acme/HelloBundle

    In your code, a bundle is often referenced by its name. It can be the concatenation of all namespace parts but it’s really up to you to come up with a unique name (a good practice is to start with the vendor name).
    Based on the namespace, we suggest AcmeHelloBundle.

    Bundle name [AcmeHelloBundle]:AcmeHelloBundle

    The bundle can be generated anywhere. The suggested default directory uses the standard conventions.

    Target directory [X:xampphtdocsSymfony/src]:X:/xampp/htdocs/Symfony/src

    Determine the format to use for the generated configuration.

    Configuration format (yml, xml, php, or annotation) [yml]:yml

    To help you getting started faster, the command can generate some code snippets for you.

    Do you want to generate the whole directory structure [no]? yes

      Summary before generation

    You are going to generate a “AcmeHelloBundleAcmeHelloBundle” bundle
    in “X:xampphtdocsSymfony/src/” using the “yml” format.

    Do you confirm generation [yes]?yes

      Bundle generation

    Generating the bundle code: OK
    Checking that the bundle is autoloaded: OK
    Confirm automatic update of your Kernel [yes]? yes
    Enabling the bundle inside the Kernel: OK
    Confirm automatic update of the Routing [yes]? yes
    Importing the bundle routing resource: OK

      You can now start using the generated code!

    と、何か勝手にフォルダが作成されて、
    Symfony/app/src/Acme/HelloBundle
    ファイルが編集された。
    Symfony/app/config/routing.yml
    AcmeHelloBundle:
      resource: “@AcmeHelloBundle/Resources/config/routing.yml”
      prefix: /
    Symfony/app/AppKernel.php
    new AcmeHelloBundleAcmeHelloBundle(),

    $bundles[] = new AcmeDemoBundleAcmeDemoBundle();
    さてと、理解するか。。。

  • HTTPメソッド

    HTTPメソッドってのがあって、GET,POSTはよく使ってたんだが、それ以外にも結構あるのね。

    GET
    HEAD
    POST
    PUT
    DELETE
    OPTIONS
    TRACE
    CONNECT
    PATCH
    LINK
    UNLINK

    さらに、データベース用に

    PROPFIND
    PROPPATCH
    MKCOL
    COPY
    MOVE
    LOCK
    LINK
    UNLINK

    とか。
    そう言われてみたら、HEADとかも使ってたな。
  • SymfonyとXAMPPの共存

    Symfonyを試して”short_open_tag = Off”としたことで、XAMPPの表示がグダグダに。
    <? → <?php
    <?= → <?php echo
    と、置換する必要が。
    も~~~