• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

michalsn / codeigniter-nested-model / 12859781527

20 Jan 2025 02:26AM UTC coverage: 95.904%. Remained the same
12859781527

Pull #6

github

web-flow
Merge ae41a198c into 0762fb0f9
Pull Request #6: Bump codeigniter4/framework from 4.5.7 to 4.6.0

398 of 415 relevant lines covered (95.9%)

11.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Common.php
1
<?php
2

3
use CodeIgniter\Model;
4

5
if (! function_exists('get_foreign_key')) {
6
    /**
7
     * Get foreign key based on model info.
8
     */
9
    function get_foreign_key(Model $model): string
10
    {
11
        $refObj = new ReflectionObject($model);
35✔
12

13
        $refProp = $refObj->getProperty('table');
35✔
14
        $table   = $refProp->getValue($model);
35✔
15

16
        $refProp    = $refObj->getProperty('primaryKey');
35✔
17
        $primaryKey = $refProp->getValue($model);
35✔
18

19
        return singular($table) . '_' . $primaryKey;
35✔
20
    }
21
}
22

23
if (! function_exists('get_primary_key')) {
24
    /**
25
     * Get primary key based on model info.
26
     */
27
    function get_primary_key(Model $model): string
28
    {
29
        $refObj = new ReflectionObject($model);
35✔
30

31
        $refProp = $refObj->getProperty('primaryKey');
35✔
32

33
        return $refProp->getValue($model);
35✔
34
    }
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc