Skip to content

Commit 1720aab

Browse files
committed
namespace refactor
1 parent 094bdc7 commit 1720aab

21 files changed

+554
-221
lines changed

Api/Data/StudentInterface.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<?php
2-
3-
namespace Blackbird\TeacherStudents\Api\Data;
2+
/**
3+
* Blackbird Data Model Sample Module
4+
*
5+
* NOTICE OF LICENSE
6+
* If you did not receive a copy of the license and are unable to
7+
* obtain it through the world-wide-web, please send an email
8+
* to contact@bird.eu so we can send you a copy immediately.
9+
*
10+
* @category Blackbird
11+
* @package Blackbird_DataModelSample
12+
* @copyright Copyright (c) 2018 Blackbird (https://black.bird.eu)
13+
* @author Blackbird Team
14+
* @license MIT
15+
* @support help@bird.eu
16+
*/
17+
namespace Blackbird\DataModelSample\Api\Data;
418

519
/**
620
* Interface StudentInterface
@@ -15,7 +29,7 @@ interface StudentInterface
1529
/**
1630
* Get Student ID
1731
*
18-
* @return int mixed
32+
* @return int
1933
*/
2034
public function getId();
2135

@@ -37,23 +51,23 @@ public function getAge();
3751
* Set Student ID
3852
*
3953
* @param int $id
40-
* @return mixed
54+
* @return \Blackbird\DataModelSample\Api\Data\StudentInterface
4155
*/
4256
public function setId($id);
4357

4458
/**
4559
* Set Student Name
4660
*
4761
* @param string $name
48-
* @return mixed
62+
* @return \Blackbird\DataModelSample\Api\Data\StudentInterface
4963
*/
5064
public function setName($name);
5165

5266
/**
5367
* Set Student Age
5468
*
5569
* @param int $age
56-
* @return mixed
70+
* @return \Blackbird\DataModelSample\Api\Data\StudentInterface
5771
*/
5872
public function setAge($age);
59-
}
73+
}

Api/Data/TeacherInterface.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<?php
2-
3-
namespace Blackbird\TeacherStudents\Api\Data;
2+
/**
3+
* Blackbird Data Model Sample Module
4+
*
5+
* NOTICE OF LICENSE
6+
* If you did not receive a copy of the license and are unable to
7+
* obtain it through the world-wide-web, please send an email
8+
* to contact@bird.eu so we can send you a copy immediately.
9+
*
10+
* @category Blackbird
11+
* @package Blackbird_DataModelSample
12+
* @copyright Copyright (c) 2018 Blackbird (https://black.bird.eu)
13+
* @author Blackbird Team
14+
* @license MIT
15+
* @support help@bird.eu
16+
*/
17+
namespace Blackbird\DataModelSample\Api\Data;
418

519
/**
620
* Interface TeacherInterface
@@ -45,31 +59,31 @@ public function getClasses();
4559
* Set the Teacher Id
4660
*
4761
* @param int $id
48-
* @return mixed
62+
* @return \Blackbird\DataModelSample\Api\Data\TeacherInterface
4963
*/
5064
public function setId($id);
5165

5266
/**
5367
* Set the Teacher Name
5468
*
5569
* @param string $name
56-
* @return mixed
70+
* @return \Blackbird\DataModelSample\Api\Data\TeacherInterface
5771
*/
5872
public function setName($name);
5973

6074
/**
6175
* Set the Teacher Age
6276
*
6377
* @param int $age
64-
* @return mixed
78+
* @return \Blackbird\DataModelSample\Api\Data\TeacherInterface
6579
*/
6680
public function setAge($age);
6781

6882
/**
6983
* Set the Teacher Classes
7084
*
7185
* @param string $classes
72-
* @return mixed
86+
* @return \Blackbird\DataModelSample\Api\Data\TeacherInterface
7387
*/
7488
public function setClasses($classes);
75-
}
89+
}

Api/StudentRepositoryInterface.php

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,56 @@
11
<?php
2-
3-
namespace Blackbird\TeacherStudents\Api;
2+
/**
3+
* Blackbird Data Model Sample Module
4+
*
5+
* NOTICE OF LICENSE
6+
* If you did not receive a copy of the license and are unable to
7+
* obtain it through the world-wide-web, please send an email
8+
* to contact@bird.eu so we can send you a copy immediately.
9+
*
10+
* @category Blackbird
11+
* @package Blackbird_DataModelSample
12+
* @copyright Copyright (c) 2018 Blackbird (https://black.bird.eu)
13+
* @author Blackbird Team
14+
* @license MIT
15+
* @support help@bird.eu
16+
*/
17+
namespace Blackbird\DataModelSample\Api;
418

519
/**
620
* Interface StudentRepositoryInterface
7-
* @package Blackbird\TeacherStudents\Api
21+
* @package Blackbird\DataModelSample\Api
822
*/
923
interface StudentRepositoryInterface
1024
{
1125
/**
1226
* Save a Student
1327
*
14-
* @param Data\StudentInterface $student
15-
* @return mixed
28+
* @param \Blackbird\DataModelSample\Api\Data\StudentInterface $student
29+
* @return \Blackbird\DataModelSample\Api\Data\StudentInterface
1630
*/
1731
public function save(Data\StudentInterface $student);
1832

1933
/**
2034
* Get Student by an Id
2135
*
2236
* @param int $studentId
23-
* @return mixed
37+
* @return \Blackbird\DataModelSample\Api\Data\StudentInterface
2438
*/
2539
public function getById($studentId);
2640

2741
/**
2842
* Delete a Student
2943
*
30-
* @param Data\StudentInterface $student
31-
* @return mixed
44+
* @param \Blackbird\DataModelSample\Api\Data\StudentInterface $student
45+
* @return bool
3246
*/
3347
public function delete(Data\StudentInterface $student);
3448

3549
/**
3650
* Delete a Student by an Id
3751
*
38-
* @param $studentId
39-
* @return mixed
52+
* @param int $studentId
53+
* @return bool
4054
*/
4155
public function deleteById($studentId);
42-
}
56+
}

Api/TeacherRepositoryInterface.php

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,56 @@
11
<?php
2-
3-
namespace Blackbird\TeacherStudents\Api;
2+
/**
3+
* Blackbird Data Model Sample Module
4+
*
5+
* NOTICE OF LICENSE
6+
* If you did not receive a copy of the license and are unable to
7+
* obtain it through the world-wide-web, please send an email
8+
* to contact@bird.eu so we can send you a copy immediately.
9+
*
10+
* @category Blackbird
11+
* @package Blackbird_DataModelSample
12+
* @copyright Copyright (c) 2018 Blackbird (https://black.bird.eu)
13+
* @author Blackbird Team
14+
* @license MIT
15+
* @support help@bird.eu
16+
*/
17+
namespace Blackbird\DataModelSample\Api;
418

519
/**
620
* Interface TeacherRepositoryInterface
7-
* @package Blackbird\TeacherStudents\Api
21+
* @package Blackbird\DataModelSample\Api
822
*/
923
interface TeacherRepositoryInterface
1024
{
1125
/**
1226
* Save a Teacher
1327
*
14-
* @param Data\TeacherInterface $teacher
15-
* @return mixed
28+
* @param \Blackbird\DataModelSample\Api\Data\TeacherInterface $teacher
29+
* @return \Blackbird\DataModelSample\Api\Data\TeacherInterface
1630
*/
1731
public function save(Data\TeacherInterface $teacher);
1832

1933
/**
2034
* Get Teacher by an Id
2135
*
2236
* @param int $teacherId
23-
* @return mixed
37+
* @return \Blackbird\DataModelSample\Api\Data\TeacherInterface
2438
*/
2539
public function getById($teacherId);
2640

2741
/**
2842
* Delete a Teacher
2943
*
30-
* @param Data\TeacherInterface $teacher
31-
* @return mixed
44+
* @param \Blackbird\DataModelSample\Api\Data\TeacherInterface $teacher
45+
* @return bool
3246
*/
3347
public function delete(Data\TeacherInterface $teacher);
3448

3549
/**
3650
* Delete a Teacher by an Id
3751
*
38-
* @param $teacherId
39-
* @return mixed
52+
* @param int $teacherId
53+
* @return bool
4054
*/
4155
public function deleteById($teacherId);
42-
}
56+
}

Model/ResourceModel/Student.php

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,49 @@
11
<?php
2-
3-
namespace Blackbird\TeacherStudents\Model\ResourceModel;
2+
/**
3+
* Blackbird Data Model Sample Module
4+
*
5+
* NOTICE OF LICENSE
6+
* If you did not receive a copy of the license and are unable to
7+
* obtain it through the world-wide-web, please send an email
8+
* to contact@bird.eu so we can send you a copy immediately.
9+
*
10+
* @category Blackbird
11+
* @package Blackbird_DataModelSample
12+
* @copyright Copyright (c) 2018 Blackbird (https://black.bird.eu)
13+
* @author Blackbird Team
14+
* @license MIT
15+
* @support help@bird.eu
16+
*/
17+
namespace Blackbird\DataModelSample\Model\ResourceModel;
418

519
use Magento\Framework\EntityManager\EntityManager;
620
use Magento\Framework\EntityManager\MetadataPool;
721
use Magento\Framework\Model\AbstractModel;
822
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
923
use Magento\Framework\Model\ResourceModel\Db\Context;
10-
use Blackbird\TeacherStudents\Api\Data\StudentInterface;
24+
use Blackbird\DataModelSample\Api\Data\StudentInterface;
1125

1226
/**
1327
* Class Student
14-
* @package Blackbird\TeacherStudents\Model\ResourceModel
28+
* @package Blackbird\DataModelSample\Model\ResourceModel
1529
*/
1630
class Student extends AbstractDb
1731
{
1832
/**
19-
* @var MetadataPool
33+
* @var \Magento\Framework\EntityManager\MetadataPool
2034
*/
21-
protected $metadataPool;
35+
private $metadataPool;
2236

2337
/**
24-
* @var EntityManager
38+
* @var \Magento\Framework\EntityManager\EntityManager
2539
*/
26-
protected $entityManager;
40+
private $entityManager;
2741

2842
/**
29-
* Student constructor.
30-
* @param Context $context
31-
* @param MetadataPool $metadataPool
32-
* @param null $connectionName
43+
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
44+
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
45+
* @param \Magento\Framework\EntityManager\EntityManager $entityManager
46+
* @param string|null $connectionName
3347
*/
3448
public function __construct(
3549
Context $context,
@@ -43,7 +57,7 @@ public function __construct(
4357
}
4458

4559
/**
46-
* Set the table and the primary key
60+
* {@inheritdoc}
4761
*/
4862
protected function _construct()
4963
{
@@ -99,4 +113,4 @@ public function delete(\Magento\Framework\Model\AbstractModel $object)
99113
{
100114
$this->entityManager->delete($object);
101115
}
102-
}
116+
}
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
<?php
2-
3-
namespace Blackbird\TeacherStudents\Model\ResourceModel\Student;
2+
/**
3+
* Blackbird Data Model Sample Module
4+
*
5+
* NOTICE OF LICENSE
6+
* If you did not receive a copy of the license and are unable to
7+
* obtain it through the world-wide-web, please send an email
8+
* to contact@bird.eu so we can send you a copy immediately.
9+
*
10+
* @category Blackbird
11+
* @package Blackbird_DataModelSample
12+
* @copyright Copyright (c) 2018 Blackbird (https://black.bird.eu)
13+
* @author Blackbird Team
14+
* @license MIT
15+
* @support help@bird.eu
16+
*/
17+
namespace Blackbird\DataModelSample\Model\ResourceModel\Student;
418

519
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
6-
use Blackbird\TeacherStudents\Model;
20+
use Blackbird\DataModelSample\Model;
721

822
/**
923
* Class Collection
10-
* @package Blackbird\TeacherStudents\Model\ResourceModel\Student
24+
* @package Blackbird\DataModelSample\Model\ResourceModel\Student
1125
*/
1226
class Collection extends AbstractCollection
1327
{
1428
/**
15-
* Link student model to student resource model
29+
* {@inheritdoc}
1630
*/
1731
protected function _construct()
1832
{
1933
$this->_init(Model\Student::class, Model\ResourceModel\Student::class);
2034
}
21-
}
35+
}

0 commit comments

Comments
 (0)