Take a look at this PHP code, using PHP Slim.
*CONTROLLER*
$app->post("/courses", function () use ($app, $dao, $improvementDao,
$postGraduationDao) { $json = $app->request->getBody(); $data =
json_decode($json, true); $course = new Course();
$course->setName($data); $course->setIntroduction($data);
$course->setObjetive($data); $course->setTargetPublicForm($data);
$course->setWorkload($data); $course->setEarlyForecastForm($data);
$course->setPeriodicity($data); $course->setSchedule($data);
$course->setCoordination($data); $course->setInstructor($data);
$course->setInformationAddForm($data); $course->setStatus($data);
$course->setActive($data); $course->setFaculty($data);
$course->setSeal($data); $course->setCreatedBy($data); $idCourse
= $dao->insert($app, $course); responseJson($app, 201, "");});
*MODEL*
<?phpclass Course{ public $id; public $name; public
$introduction; public $objetive; public $targetPublic; public
$workload; public $earlyForecast; public $periodicity; public
$schedule; public $coordination; public $instructor; public
$informationAdd; public $status; public $active; public
$createdBy; public $changed; public $changedBy; public $type;
public $dates; public $faculty; public $seal; public
function setId($course) { $this->id = $course["id"]; }
public function setName($course) { $this->name =
$course["name"]; } public function setIntroduction($course) {
if (isset($course["introduction"])) {
$this->introduction = $course["introduction"]; } } public
function setObjetive($course) { if
(isset($course["objetive"])) { $this->objetive =
$course["objetive"]; } } public function
setTargetPublicBD($course) { $this->targetPublic =
$course["target_public"]; } public function
setTargetPublicForm($course) { if
(isset($course["targetPublic"])) { $this->targetPublic =
$course["targetPublic"]; } } public function
setWorkload($course) { if (isset($course["workload"])) {
$this->workload = $course["workload"]; } } public
function setEarlyForecastBD($course) { $this->earlyForecast
= $course["early_forecast"]; } public function
setEarlyForecastForm($course) { if
(isset($course["earlyForecast"])) { $this->earlyForecast =
$course["earlyForecast"]; } } public function
setPeriodicity($course) { if (isset($course["periodicity"]))
{ $this->periodicity = $course["periodicity"]; }
} public function setSchedule($course) { if
(isset($course["schedule"])) { $this->schedule =
$course["schedule"]; } } public function
setCoordination($course) { if
(isset($course["coordination"])) { $this->coordination =
$course["coordination"]; } } public function
setInstructor($course) { if (isset($course["instructor"])) {
$this->instructor = $course["instructor"]; } }
public function setInformationAddBD($course) {
$this->informationAdd = $course["information_add"]; } public
function setInformationAddForm($course) { if
(isset($course["informationAdd"])) { $this->informationAdd
= $course["informationAdd"]; } } public function
setStatus($course) { if (isset($course["status"])) {
$this->status = $course["status"]; } } public function
setActive($course) { $this->active = $course["active"]; }
public function setCreatedBy($course) { $this->createdBy
= $course["createdBy"]; } public function setChanged() {
$this->changed = (new \DateTime())->format('Y-m-d H:i:s'); }
public function setChangedBy($course) { $this->changedBy =
$course["changeBy"]; } public function setType($type) {
$this->type = $type; } public function setDates($improvement)
{ $this->dates = $improvement[0]["dates"]; } public
function setFaculty($postGraduation) { if
(isset($postGraduation["faculty"])) { $this->faculty =
$postGraduation["faculty"]; } } public function
setSeal($postGraduation) { if
(isset($postGraduation["seal"])) { $this->seal =
$postGraduation["seal"]; } }}
2015-07-07 11:00 GMT-03:00 beastar 457 <[email protected]>:
> my method that is in my service is like this
>
> tutorial.createtutorial = function(tutorial){
> var defer = $q.defer();
>
> $http.post($rootScope.endPoint + '/api/v1/follower', tutorial)
> .success(function(res){
> defer.resolve(res);
> })
> .error(function(err, status){
> defer.reject(err);
> })
>
> return defer.promise;
> }
>
>
> and how can i get the passed object into php script so that i can insert
> it into database
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Att
Armando Couto
CSM - LKU
www.armandocouto.com.br
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.