我的 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);
结果是字符串(1)“0”
为什么这不返回整数,所以我可以比较 === 0