나는 데이터베이스 (PHP 클래스)와 테이블을 가지고있다. where 절없이 find_many
을 시도하면 모든 데이터베이스 항목을 찾습니다. 그리고 각 데이터베이스 엔트리에 대한 모델을 생성합니다. 그러나이 모델은 비어 있으며 내 모델에 대한 자체 setter/getter가 있기 때문에 할당 된 데이터가 없습니다.Idiorm/Paris에서 자신의 setter/getter를 사용하는 방법은 무엇입니까?
<?php
class City extends Model {
private $id;
private $idOwm;
private $idBla;
private $name;
private $longitude;
private $latitude;
private $country;
public function data() {
return $this->has_many('Data', 'idCity');
}
public function getId() {
return $this->id;
}
public function setId($id) {
$this->id = $id;
}
public function getIdOwm() {
return $this->idOwm;
}
public function setIdOwm($idOwm) {
$this->idOwm = $idOwm;
}
public function getIdBla() {
return $this->idBla;
}
public function setIdBla($idBla) {
$this->idBla = $idBla;
}
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
}
public function getLongitude() {
return $this->longitude;
}
public function setLongitude($longitude) {
$this->longitude = $longitude;
}
public function getLatitude() {
return $this->latitude;
}
public function setLatitude($latitude) {
$this->latitude = $latitude;
}
public function getCountry() {
return $this->country;
}
public function setCountry($country) {
$this->country = $country;
}
}
$cities = Model::factory('City')->find_many();
$cities
형 City
많은 모델 배열이다.
City Object
(
[id:protected] =>
[idOwm:protected] =>
[idBla:protected] =>
[name:protected] =>
[longitude:protected] =>
[latitude:protected] =>
[country:protected] =>
[orm] => ORM Object
(
[_connection_name:protected] => default
[_table_name:protected] => city
[_table_alias:protected] =>
[_values:protected] => Array
(
)
[_result_columns:protected] => Array
(
[0] => *
)
[_using_default_result_columns:protected] => 1
[_join_sources:protected] => Array
(
)
[_distinct:protected] =>
[_is_raw_query:protected] =>
[_raw_query:protected] =>
[_raw_parameters:protected] => Array
(
)
[_where_conditions:protected] => Array
(
)
[_limit:protected] =>
[_offset:protected] =>
[_order_by:protected] => Array
(
)
[_group_by:protected] => Array
(
)
[_having_conditions:protected] => Array
(
)
[_data:protected] => Array
(
[id] => 1
[idOwm] => 2950159
[idBla] => 0
[name] => Berlin
[latitude] => 52.52
[longitude] => 13.41
[country] => DE
)
[_dirty_fields:protected] => Array
(
)
[_expr_fields:protected] => Array
(
)
[_is_new:protected] =>
[_instance_id_column:protected] => id
)
)
어떻게 Idiorm/파리 내 자신의 세터/게터를 사용할 수 있습니까? 이것이 가능합니까 아니면 다른 방식으로 일부 모델 논리를 수행해야합니까?