私のschema.yml
Organisation:
columns:
id: { type: integer(4), notnull: true, unique: true, primary: true, autoincrement: true }
name: { type: string(100), notnull: true, unique: true }
parent_organisation_id: { type: integer(4), notnull: false }
relations:
ParentOrganisation: { class: Organisation, local: parent_organisation_id, foreignAlias: ChildOrganisations }
一部の組織には整数値 0 が格納されており、そのような組織 ID はありません。このコードを実行すると驚いたことに
class organisationActions extends autoOrganisationActions{
public function executeEdit(sfWebRequest $request){
$this->organisation = $this->getRoute()->getObject();
$p = $this->organisation->getParentOrganisationId();
var_dump($p);
結果は string(1) "0" です
なぜこれは整数を返さないので、=== 0 を比較できますか?