예제 #1
0
파일: ForeignKey.php 프로젝트: phpwax/model
 public function setup()
 {
     if (!$this->target_model) {
         $this->target_model = Inflections::camelize($this->field, true);
     }
     // Overrides naming of field to model_id if col_name is not explicitly set
     if (!$this->col_name) {
         $this->col_name = Inflections::underscore($this->target_model) . "_id";
     }
 }
예제 #2
0
 public function setup()
 {
     $this->col_name = false;
     $class_name = get_class($this->model);
     if (!$this->target_model) {
         $this->target_model = Inflections::camelize($this->field, true);
     }
     if (!$this->join_field) {
         $this->join_field = Inflections::underscore($class_name) . "_" . $this->model->primary_key;
     }
 }