@@ -23,192 +23,192 @@ |
||
23 | 23 | |
24 | 24 | class Api |
25 | 25 | { |
26 | - /** |
|
27 | - * @var ContainerInterface |
|
28 | - */ |
|
29 | - private $container; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var EntityManagerInterface |
|
33 | - */ |
|
34 | - private $em; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var SessionInterface |
|
38 | - */ |
|
39 | - private $session; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var Account |
|
43 | - */ |
|
44 | - private $account; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var Request|null |
|
48 | - */ |
|
49 | - private $request; |
|
50 | - |
|
51 | - /** |
|
52 | - * Api constructor. |
|
53 | - * @param ContainerInterface $container |
|
54 | - * @param EntityManagerInterface $em |
|
55 | - * @param SessionInterface $session |
|
56 | - * @param RequestStack $request_stack |
|
57 | - */ |
|
58 | - public function __construct(ContainerInterface $container, EntityManagerInterface $em, SessionInterface $session, RequestStack $request_stack) |
|
59 | - { |
|
60 | - $this->container = $container; |
|
61 | - $this->em = $em; |
|
62 | - $this->session = $session; |
|
63 | - $this->request = $request_stack->getCurrentRequest(); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * this method is used to test jwt and if the account is ok else send false |
|
68 | - * @param string $infos_jwt |
|
69 | - * @param string $token |
|
70 | - * @return bool |
|
71 | - * @throws Exception |
|
72 | - */ |
|
73 | - public function userIslogged(string $infos_jwt, string $token): bool |
|
74 | - { |
|
75 | - $em = $this->em; |
|
76 | - $jwt = Jwt::decode($infos_jwt, $token); |
|
77 | - |
|
78 | - if ($jwt === false) { |
|
79 | - return false; |
|
80 | - } |
|
81 | - |
|
82 | - $account_token_search = [ |
|
83 | - "token" => $token, |
|
84 | - "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
|
85 | - "ip" => $this->request->server->get("REMOTE_ADDR") |
|
86 | - ]; |
|
87 | - if (preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$this->request->server->get("HTTP_USER_AGENT"))||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($this->request->server->get("HTTP_USER_AGENT"),0,4))) { |
|
88 | - $account_token_search = [ |
|
89 | - "token" => $token, |
|
90 | - "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
|
91 | - ]; |
|
92 | - } |
|
93 | - |
|
94 | - $account_token = $em->getRepository(AccountToken::class)->findOneBy($account_token_search); |
|
95 | - |
|
96 | - if (!$account_token) { |
|
97 | - return false; |
|
98 | - } |
|
99 | - |
|
100 | - $this->account = $em->getRepository(Account::class)->findOneBy([ |
|
101 | - "id" => $account_token->getAccount()->getId(), |
|
102 | - "isActive" => true, |
|
103 | - ]); |
|
104 | - |
|
105 | - if (!$this->account) { |
|
106 | - return false; |
|
107 | - } |
|
108 | - |
|
109 | - $this->account->setLastConnection(new \DateTime()); |
|
110 | - $em->persist($this->account); |
|
111 | - $em->flush(); |
|
112 | - |
|
113 | - $this->getToken($this->account); |
|
114 | - $this->session->set("jwt_infos", $jwt); |
|
115 | - $this->session->set("account", $this->account); |
|
116 | - $this->session->set("account_token", $account_token); |
|
117 | - |
|
118 | - return true; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * method that return the token for a account |
|
123 | - * @param Account $account |
|
124 | - * @return string |
|
125 | - * @throws Exception |
|
126 | - */ |
|
127 | - public function getToken(Account $account): string |
|
128 | - { |
|
129 | - $account_token = $this->em->getRepository(AccountToken::class)->findOneBy([ |
|
130 | - "account" => $account, |
|
131 | - "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
|
132 | - "ip" => $this->request->server->get("REMOTE_ADDR") |
|
133 | - ]); |
|
134 | - |
|
135 | - $token = $account_token ? $account_token->getToken() : null; |
|
136 | - $now = new \DateTime(); |
|
137 | - |
|
138 | - if ($token === null || $account_token->getEndToken() < $now) { |
|
139 | - return $this->setToken($account, $account_token); |
|
140 | - } |
|
141 | - |
|
142 | - return $token; |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * @param Account $account |
|
147 | - * @param $account_token |
|
148 | - * @return string |
|
149 | - * method that set a token for the account |
|
150 | - * @throws Exception |
|
151 | - */ |
|
152 | - public function setToken(Account $account, $account_token): string |
|
153 | - { |
|
154 | - $token = $this->generateToken(); |
|
155 | - $now = new \DateTime(); |
|
156 | - $end_token = $now->add(new \DateInterval("PT".$this->container->getParameter("ribs_admin")["api_token_duration"]."M")); |
|
157 | - |
|
158 | - if (!$account_token) { |
|
159 | - $account_token = new AccountToken(); |
|
160 | - } |
|
161 | - |
|
162 | - $account_token->setToken($token); |
|
163 | - $account_token->setUserAgent($this->request->server->get("HTTP_USER_AGENT")); |
|
164 | - $account_token->setIp($this->request->server->get("REMOTE_ADDR")); |
|
165 | - $account_token->setEndToken($end_token); |
|
166 | - $account_token->setAccount($account); |
|
167 | - $this->em->persist($account_token); |
|
168 | - $this->em->flush(); |
|
169 | - |
|
170 | - $this->account = $account; |
|
171 | - $this->session->set("account", $this->account); |
|
172 | - $this->session->set("account_token", $account_token); |
|
173 | - |
|
174 | - return $token; |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * generate a token for api |
|
179 | - * @param int $length |
|
180 | - * @return string |
|
181 | - */ |
|
182 | - public function generateToken(int $length = 200): string |
|
183 | - { |
|
184 | - $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789"; |
|
185 | - $token = ""; |
|
186 | - srand((double)microtime() * 1000000); |
|
187 | - for ($i = 0; $i < $length; $i++) { |
|
188 | - $token .= $string[rand() % strlen($string)]; |
|
189 | - } |
|
190 | - |
|
191 | - return $token; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * method that encode an object to a json |
|
196 | - * @param $object |
|
197 | - * @param string $type |
|
198 | - * @return mixed |
|
199 | - * @throws ExceptionInterface |
|
200 | - * @throws AnnotationException |
|
201 | - */ |
|
202 | - public function serializeObject($object, $type = "json") |
|
203 | - { |
|
204 | - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); |
|
205 | - $serializer = new Serializer([new DateTimeNormalizer(), new ObjectNormalizer($classMetadataFactory)], [new XmlEncoder(), new JsonEncoder()]); |
|
206 | - |
|
207 | - return $serializer->normalize($object, $type, [ |
|
208 | - 'circular_reference_handler' => function ($object) { |
|
209 | - return $object->getId(); |
|
210 | - }, |
|
211 | - 'groups' => 'main' |
|
212 | - ]); |
|
213 | - } |
|
26 | + /** |
|
27 | + * @var ContainerInterface |
|
28 | + */ |
|
29 | + private $container; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var EntityManagerInterface |
|
33 | + */ |
|
34 | + private $em; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var SessionInterface |
|
38 | + */ |
|
39 | + private $session; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var Account |
|
43 | + */ |
|
44 | + private $account; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var Request|null |
|
48 | + */ |
|
49 | + private $request; |
|
50 | + |
|
51 | + /** |
|
52 | + * Api constructor. |
|
53 | + * @param ContainerInterface $container |
|
54 | + * @param EntityManagerInterface $em |
|
55 | + * @param SessionInterface $session |
|
56 | + * @param RequestStack $request_stack |
|
57 | + */ |
|
58 | + public function __construct(ContainerInterface $container, EntityManagerInterface $em, SessionInterface $session, RequestStack $request_stack) |
|
59 | + { |
|
60 | + $this->container = $container; |
|
61 | + $this->em = $em; |
|
62 | + $this->session = $session; |
|
63 | + $this->request = $request_stack->getCurrentRequest(); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * this method is used to test jwt and if the account is ok else send false |
|
68 | + * @param string $infos_jwt |
|
69 | + * @param string $token |
|
70 | + * @return bool |
|
71 | + * @throws Exception |
|
72 | + */ |
|
73 | + public function userIslogged(string $infos_jwt, string $token): bool |
|
74 | + { |
|
75 | + $em = $this->em; |
|
76 | + $jwt = Jwt::decode($infos_jwt, $token); |
|
77 | + |
|
78 | + if ($jwt === false) { |
|
79 | + return false; |
|
80 | + } |
|
81 | + |
|
82 | + $account_token_search = [ |
|
83 | + "token" => $token, |
|
84 | + "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
|
85 | + "ip" => $this->request->server->get("REMOTE_ADDR") |
|
86 | + ]; |
|
87 | + if (preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$this->request->server->get("HTTP_USER_AGENT"))||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($this->request->server->get("HTTP_USER_AGENT"),0,4))) { |
|
88 | + $account_token_search = [ |
|
89 | + "token" => $token, |
|
90 | + "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
|
91 | + ]; |
|
92 | + } |
|
93 | + |
|
94 | + $account_token = $em->getRepository(AccountToken::class)->findOneBy($account_token_search); |
|
95 | + |
|
96 | + if (!$account_token) { |
|
97 | + return false; |
|
98 | + } |
|
99 | + |
|
100 | + $this->account = $em->getRepository(Account::class)->findOneBy([ |
|
101 | + "id" => $account_token->getAccount()->getId(), |
|
102 | + "isActive" => true, |
|
103 | + ]); |
|
104 | + |
|
105 | + if (!$this->account) { |
|
106 | + return false; |
|
107 | + } |
|
108 | + |
|
109 | + $this->account->setLastConnection(new \DateTime()); |
|
110 | + $em->persist($this->account); |
|
111 | + $em->flush(); |
|
112 | + |
|
113 | + $this->getToken($this->account); |
|
114 | + $this->session->set("jwt_infos", $jwt); |
|
115 | + $this->session->set("account", $this->account); |
|
116 | + $this->session->set("account_token", $account_token); |
|
117 | + |
|
118 | + return true; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * method that return the token for a account |
|
123 | + * @param Account $account |
|
124 | + * @return string |
|
125 | + * @throws Exception |
|
126 | + */ |
|
127 | + public function getToken(Account $account): string |
|
128 | + { |
|
129 | + $account_token = $this->em->getRepository(AccountToken::class)->findOneBy([ |
|
130 | + "account" => $account, |
|
131 | + "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
|
132 | + "ip" => $this->request->server->get("REMOTE_ADDR") |
|
133 | + ]); |
|
134 | + |
|
135 | + $token = $account_token ? $account_token->getToken() : null; |
|
136 | + $now = new \DateTime(); |
|
137 | + |
|
138 | + if ($token === null || $account_token->getEndToken() < $now) { |
|
139 | + return $this->setToken($account, $account_token); |
|
140 | + } |
|
141 | + |
|
142 | + return $token; |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * @param Account $account |
|
147 | + * @param $account_token |
|
148 | + * @return string |
|
149 | + * method that set a token for the account |
|
150 | + * @throws Exception |
|
151 | + */ |
|
152 | + public function setToken(Account $account, $account_token): string |
|
153 | + { |
|
154 | + $token = $this->generateToken(); |
|
155 | + $now = new \DateTime(); |
|
156 | + $end_token = $now->add(new \DateInterval("PT".$this->container->getParameter("ribs_admin")["api_token_duration"]."M")); |
|
157 | + |
|
158 | + if (!$account_token) { |
|
159 | + $account_token = new AccountToken(); |
|
160 | + } |
|
161 | + |
|
162 | + $account_token->setToken($token); |
|
163 | + $account_token->setUserAgent($this->request->server->get("HTTP_USER_AGENT")); |
|
164 | + $account_token->setIp($this->request->server->get("REMOTE_ADDR")); |
|
165 | + $account_token->setEndToken($end_token); |
|
166 | + $account_token->setAccount($account); |
|
167 | + $this->em->persist($account_token); |
|
168 | + $this->em->flush(); |
|
169 | + |
|
170 | + $this->account = $account; |
|
171 | + $this->session->set("account", $this->account); |
|
172 | + $this->session->set("account_token", $account_token); |
|
173 | + |
|
174 | + return $token; |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * generate a token for api |
|
179 | + * @param int $length |
|
180 | + * @return string |
|
181 | + */ |
|
182 | + public function generateToken(int $length = 200): string |
|
183 | + { |
|
184 | + $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789"; |
|
185 | + $token = ""; |
|
186 | + srand((double)microtime() * 1000000); |
|
187 | + for ($i = 0; $i < $length; $i++) { |
|
188 | + $token .= $string[rand() % strlen($string)]; |
|
189 | + } |
|
190 | + |
|
191 | + return $token; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * method that encode an object to a json |
|
196 | + * @param $object |
|
197 | + * @param string $type |
|
198 | + * @return mixed |
|
199 | + * @throws ExceptionInterface |
|
200 | + * @throws AnnotationException |
|
201 | + */ |
|
202 | + public function serializeObject($object, $type = "json") |
|
203 | + { |
|
204 | + $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); |
|
205 | + $serializer = new Serializer([new DateTimeNormalizer(), new ObjectNormalizer($classMetadataFactory)], [new XmlEncoder(), new JsonEncoder()]); |
|
206 | + |
|
207 | + return $serializer->normalize($object, $type, [ |
|
208 | + 'circular_reference_handler' => function ($object) { |
|
209 | + return $object->getId(); |
|
210 | + }, |
|
211 | + 'groups' => 'main' |
|
212 | + ]); |
|
213 | + } |
|
214 | 214 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
85 | 85 | "ip" => $this->request->server->get("REMOTE_ADDR") |
86 | 86 | ]; |
87 | - if (preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$this->request->server->get("HTTP_USER_AGENT"))||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($this->request->server->get("HTTP_USER_AGENT"),0,4))) { |
|
87 | + if (preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $this->request->server->get("HTTP_USER_AGENT")) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr($this->request->server->get("HTTP_USER_AGENT"), 0, 4))) { |
|
88 | 88 | $account_token_search = [ |
89 | 89 | "token" => $token, |
90 | 90 | "userAgent" => $this->request->server->get("HTTP_USER_AGENT"), |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | $token = $this->generateToken(); |
155 | 155 | $now = new \DateTime(); |
156 | - $end_token = $now->add(new \DateInterval("PT".$this->container->getParameter("ribs_admin")["api_token_duration"]."M")); |
|
156 | + $end_token = $now->add(new \DateInterval("PT" . $this->container->getParameter("ribs_admin")["api_token_duration"] . "M")); |
|
157 | 157 | |
158 | 158 | if (!$account_token) { |
159 | 159 | $account_token = new AccountToken(); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789"; |
185 | 185 | $token = ""; |
186 | - srand((double)microtime() * 1000000); |
|
186 | + srand((double) microtime() * 1000000); |
|
187 | 187 | for ($i = 0; $i < $length; $i++) { |
188 | 188 | $token .= $string[rand() % strlen($string)]; |
189 | 189 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $serializer = new Serializer([new DateTimeNormalizer(), new ObjectNormalizer($classMetadataFactory)], [new XmlEncoder(), new JsonEncoder()]); |
206 | 206 | |
207 | 207 | return $serializer->normalize($object, $type, [ |
208 | - 'circular_reference_handler' => function ($object) { |
|
208 | + 'circular_reference_handler' => function($object) { |
|
209 | 209 | return $object->getId(); |
210 | 210 | }, |
211 | 211 | 'groups' => 'main' |
@@ -6,91 +6,91 @@ |
||
6 | 6 | |
7 | 7 | trait CreatedUpdatedTrait |
8 | 8 | { |
9 | - /** |
|
10 | - * @ORM\Column(name="created_at", type="datetime", nullable=true) |
|
11 | - */ |
|
12 | - protected $created_at; |
|
9 | + /** |
|
10 | + * @ORM\Column(name="created_at", type="datetime", nullable=true) |
|
11 | + */ |
|
12 | + protected $created_at; |
|
13 | 13 | |
14 | - /** |
|
15 | - * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
16 | - * @ORM\JoinColumn(name="created_by", referencedColumnName="id", nullable=false) |
|
17 | - */ |
|
18 | - protected $created_by; |
|
14 | + /** |
|
15 | + * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
16 | + * @ORM\JoinColumn(name="created_by", referencedColumnName="id", nullable=false) |
|
17 | + */ |
|
18 | + protected $created_by; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @ORM\Column(name="updated_at", type="datetime", nullable=true) |
|
22 | - */ |
|
23 | - protected $updated_at; |
|
20 | + /** |
|
21 | + * @ORM\Column(name="updated_at", type="datetime", nullable=true) |
|
22 | + */ |
|
23 | + protected $updated_at; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
27 | - * @ORM\JoinColumn(name="updated_by", referencedColumnName="id", nullable=false) |
|
28 | - */ |
|
29 | - protected $updated_by; |
|
25 | + /** |
|
26 | + * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
27 | + * @ORM\JoinColumn(name="updated_by", referencedColumnName="id", nullable=false) |
|
28 | + */ |
|
29 | + protected $updated_by; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @return mixed |
|
33 | - */ |
|
34 | - public function getCreatedAt() |
|
35 | - { |
|
36 | - return $this->created_at; |
|
37 | - } |
|
31 | + /** |
|
32 | + * @return mixed |
|
33 | + */ |
|
34 | + public function getCreatedAt() |
|
35 | + { |
|
36 | + return $this->created_at; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param mixed $created_at |
|
41 | - */ |
|
42 | - public function setCreatedAt($created_at) |
|
43 | - { |
|
44 | - $this->created_at = $created_at; |
|
45 | - } |
|
39 | + /** |
|
40 | + * @param mixed $created_at |
|
41 | + */ |
|
42 | + public function setCreatedAt($created_at) |
|
43 | + { |
|
44 | + $this->created_at = $created_at; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return mixed |
|
49 | - */ |
|
50 | - public function getCreatedBy() |
|
51 | - { |
|
52 | - return $this->created_by; |
|
53 | - } |
|
47 | + /** |
|
48 | + * @return mixed |
|
49 | + */ |
|
50 | + public function getCreatedBy() |
|
51 | + { |
|
52 | + return $this->created_by; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @ORM\PrePersist |
|
57 | - * @param mixed $created_by |
|
58 | - */ |
|
59 | - public function setCreatedBy($created_by) |
|
60 | - { |
|
61 | - $this->created_by = $created_by; |
|
62 | - } |
|
55 | + /** |
|
56 | + * @ORM\PrePersist |
|
57 | + * @param mixed $created_by |
|
58 | + */ |
|
59 | + public function setCreatedBy($created_by) |
|
60 | + { |
|
61 | + $this->created_by = $created_by; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return mixed |
|
66 | - */ |
|
67 | - public function getUpdatedAt() |
|
68 | - { |
|
69 | - return $this->updated_at; |
|
70 | - } |
|
64 | + /** |
|
65 | + * @return mixed |
|
66 | + */ |
|
67 | + public function getUpdatedAt() |
|
68 | + { |
|
69 | + return $this->updated_at; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @param mixed $updated_at |
|
74 | - */ |
|
75 | - public function setUpdatedAt($updated_at) |
|
76 | - { |
|
77 | - $this->updated_at = $updated_at; |
|
78 | - } |
|
72 | + /** |
|
73 | + * @param mixed $updated_at |
|
74 | + */ |
|
75 | + public function setUpdatedAt($updated_at) |
|
76 | + { |
|
77 | + $this->updated_at = $updated_at; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return mixed |
|
82 | - */ |
|
83 | - public function getUpdatedBy() |
|
84 | - { |
|
85 | - return $this->updated_by; |
|
86 | - } |
|
80 | + /** |
|
81 | + * @return mixed |
|
82 | + */ |
|
83 | + public function getUpdatedBy() |
|
84 | + { |
|
85 | + return $this->updated_by; |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @ORM\PreUpdate |
|
90 | - * @param mixed $updated_by |
|
91 | - */ |
|
92 | - public function setUpdatedBy($updated_by) |
|
93 | - { |
|
94 | - $this->updated_by = $updated_by; |
|
95 | - } |
|
88 | + /** |
|
89 | + * @ORM\PreUpdate |
|
90 | + * @param mixed $updated_by |
|
91 | + */ |
|
92 | + public function setUpdatedBy($updated_by) |
|
93 | + { |
|
94 | + $this->updated_by = $updated_by; |
|
95 | + } |
|
96 | 96 | } |
@@ -12,38 +12,38 @@ |
||
12 | 12 | */ |
13 | 13 | private $user; |
14 | 14 | |
15 | - /** |
|
16 | - * CreateUpdateAwareListener constructor. |
|
17 | - * @param TokenStorage $tokenStorage |
|
18 | - */ |
|
19 | - public function __construct(TokenStorage $tokenStorage) |
|
15 | + /** |
|
16 | + * CreateUpdateAwareListener constructor. |
|
17 | + * @param TokenStorage $tokenStorage |
|
18 | + */ |
|
19 | + public function __construct(TokenStorage $tokenStorage) |
|
20 | 20 | { |
21 | - if ($tokenStorage->getToken() && is_object($tokenStorage->getToken()->getUser()) && $tokenStorage->getToken()->getUser()->getUser()) { |
|
22 | - $this->user = $tokenStorage->getToken()->getUser()->getUser(); |
|
23 | - } else { |
|
24 | - $this->user = null; |
|
25 | - } |
|
21 | + if ($tokenStorage->getToken() && is_object($tokenStorage->getToken()->getUser()) && $tokenStorage->getToken()->getUser()->getUser()) { |
|
22 | + $this->user = $tokenStorage->getToken()->getUser()->getUser(); |
|
23 | + } else { |
|
24 | + $this->user = null; |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function prePersist($entity) |
29 | 29 | { |
30 | - if ($this->user) { |
|
31 | - if ($entity->getCreatedBy() === null) { |
|
32 | - $entity->setCreatedAt(new \DateTime()); |
|
33 | - $entity->setCreatedBy($this->user); |
|
34 | - } |
|
35 | - if ($entity->getUpdatedBy() === null) { |
|
36 | - $entity->setUpdatedAt(new \DateTime()); |
|
37 | - $entity->setUpdatedBy($this->user); |
|
38 | - } |
|
39 | - } |
|
30 | + if ($this->user) { |
|
31 | + if ($entity->getCreatedBy() === null) { |
|
32 | + $entity->setCreatedAt(new \DateTime()); |
|
33 | + $entity->setCreatedBy($this->user); |
|
34 | + } |
|
35 | + if ($entity->getUpdatedBy() === null) { |
|
36 | + $entity->setUpdatedAt(new \DateTime()); |
|
37 | + $entity->setUpdatedBy($this->user); |
|
38 | + } |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | - public function preUpdate($entity) |
|
43 | - { |
|
44 | - if ($this->user) { |
|
45 | - $entity->setUpdatedAt(new \DateTime()); |
|
46 | - $entity->setUpdatedBy($this->user); |
|
47 | - } |
|
48 | - } |
|
42 | + public function preUpdate($entity) |
|
43 | + { |
|
44 | + if ($this->user) { |
|
45 | + $entity->setUpdatedAt(new \DateTime()); |
|
46 | + $entity->setUpdatedBy($this->user); |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
@@ -16,157 +16,157 @@ |
||
16 | 16 | */ |
17 | 17 | class AccountToken |
18 | 18 | { |
19 | - use GuidTrait; |
|
20 | - use CreatedUpdatedTrait; |
|
21 | - |
|
22 | - /** |
|
23 | - * @ORM\Id |
|
24 | - * @ORM\Column(type="integer") |
|
25 | - * @ORM\GeneratedValue(strategy="AUTO") |
|
26 | - */ |
|
27 | - protected $id; |
|
28 | - |
|
29 | - /** |
|
30 | - * @ORM\Column(type="string", length=200) |
|
31 | - */ |
|
32 | - protected $token; |
|
33 | - |
|
34 | - /** |
|
35 | - * @ORM\Column(type="datetime", nullable=true) |
|
36 | - */ |
|
37 | - protected $endToken; |
|
38 | - |
|
39 | - /** |
|
40 | - * @ORM\Column(type="string", length=200) |
|
41 | - */ |
|
42 | - protected $userAgent; |
|
43 | - |
|
44 | - /** |
|
45 | - * @ORM\Column(type="string", length=200) |
|
46 | - */ |
|
47 | - protected $ip; |
|
48 | - |
|
49 | - /** |
|
50 | - * @ORM\ManyToOne(targetEntity="Account", inversedBy="tokens") |
|
51 | - * @ORM\JoinColumn(name="account_id", referencedColumnName="id", nullable=false) |
|
52 | - */ |
|
53 | - protected $account; |
|
54 | - |
|
55 | - /** |
|
56 | - * @return mixed |
|
57 | - */ |
|
58 | - public function getId() |
|
59 | - { |
|
60 | - return $this->id; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * @param mixed $id |
|
65 | - * @return AccountToken |
|
66 | - */ |
|
67 | - public function setId($id) |
|
68 | - { |
|
69 | - $this->id = $id; |
|
70 | - |
|
71 | - return $this; |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * @return mixed |
|
76 | - */ |
|
77 | - public function getToken() |
|
78 | - { |
|
79 | - return $this->token; |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * @param mixed $token |
|
84 | - * @return AccountToken |
|
85 | - */ |
|
86 | - public function setToken($token) |
|
87 | - { |
|
88 | - $this->token = $token; |
|
89 | - |
|
90 | - return $this; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @return mixed |
|
95 | - */ |
|
96 | - public function getEndToken() |
|
97 | - { |
|
98 | - return $this->endToken; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @param mixed $endToken |
|
103 | - * @return AccountToken |
|
104 | - */ |
|
105 | - public function setEndToken($endToken) |
|
106 | - { |
|
107 | - $this->endToken = $endToken; |
|
108 | - |
|
109 | - return $this; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @return mixed |
|
114 | - */ |
|
115 | - public function getUserAgent() |
|
116 | - { |
|
117 | - return $this->userAgent; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * @param mixed $userAgent |
|
122 | - * @return AccountToken |
|
123 | - */ |
|
124 | - public function setUserAgent($userAgent) |
|
125 | - { |
|
126 | - $this->userAgent = $userAgent; |
|
127 | - |
|
128 | - return $this; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * @return mixed |
|
133 | - */ |
|
134 | - public function getIp() |
|
135 | - { |
|
136 | - return $this->ip; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @param mixed $ip |
|
141 | - * @return AccountToken |
|
142 | - */ |
|
143 | - public function setIp($ip) |
|
144 | - { |
|
145 | - $this->ip = $ip; |
|
146 | - |
|
147 | - return $this; |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * Set Account entity (many to one). |
|
152 | - * |
|
153 | - * @param Account $account |
|
154 | - * @return AccountToken |
|
155 | - */ |
|
156 | - public function setAccount(Account $account = null) |
|
157 | - { |
|
158 | - $this->account = $account; |
|
159 | - |
|
160 | - return $this; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Get Account entity (many to one). |
|
165 | - * |
|
166 | - * @return Account |
|
167 | - */ |
|
168 | - public function getAccount() |
|
169 | - { |
|
170 | - return $this->account; |
|
171 | - } |
|
19 | + use GuidTrait; |
|
20 | + use CreatedUpdatedTrait; |
|
21 | + |
|
22 | + /** |
|
23 | + * @ORM\Id |
|
24 | + * @ORM\Column(type="integer") |
|
25 | + * @ORM\GeneratedValue(strategy="AUTO") |
|
26 | + */ |
|
27 | + protected $id; |
|
28 | + |
|
29 | + /** |
|
30 | + * @ORM\Column(type="string", length=200) |
|
31 | + */ |
|
32 | + protected $token; |
|
33 | + |
|
34 | + /** |
|
35 | + * @ORM\Column(type="datetime", nullable=true) |
|
36 | + */ |
|
37 | + protected $endToken; |
|
38 | + |
|
39 | + /** |
|
40 | + * @ORM\Column(type="string", length=200) |
|
41 | + */ |
|
42 | + protected $userAgent; |
|
43 | + |
|
44 | + /** |
|
45 | + * @ORM\Column(type="string", length=200) |
|
46 | + */ |
|
47 | + protected $ip; |
|
48 | + |
|
49 | + /** |
|
50 | + * @ORM\ManyToOne(targetEntity="Account", inversedBy="tokens") |
|
51 | + * @ORM\JoinColumn(name="account_id", referencedColumnName="id", nullable=false) |
|
52 | + */ |
|
53 | + protected $account; |
|
54 | + |
|
55 | + /** |
|
56 | + * @return mixed |
|
57 | + */ |
|
58 | + public function getId() |
|
59 | + { |
|
60 | + return $this->id; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * @param mixed $id |
|
65 | + * @return AccountToken |
|
66 | + */ |
|
67 | + public function setId($id) |
|
68 | + { |
|
69 | + $this->id = $id; |
|
70 | + |
|
71 | + return $this; |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * @return mixed |
|
76 | + */ |
|
77 | + public function getToken() |
|
78 | + { |
|
79 | + return $this->token; |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * @param mixed $token |
|
84 | + * @return AccountToken |
|
85 | + */ |
|
86 | + public function setToken($token) |
|
87 | + { |
|
88 | + $this->token = $token; |
|
89 | + |
|
90 | + return $this; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @return mixed |
|
95 | + */ |
|
96 | + public function getEndToken() |
|
97 | + { |
|
98 | + return $this->endToken; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @param mixed $endToken |
|
103 | + * @return AccountToken |
|
104 | + */ |
|
105 | + public function setEndToken($endToken) |
|
106 | + { |
|
107 | + $this->endToken = $endToken; |
|
108 | + |
|
109 | + return $this; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @return mixed |
|
114 | + */ |
|
115 | + public function getUserAgent() |
|
116 | + { |
|
117 | + return $this->userAgent; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * @param mixed $userAgent |
|
122 | + * @return AccountToken |
|
123 | + */ |
|
124 | + public function setUserAgent($userAgent) |
|
125 | + { |
|
126 | + $this->userAgent = $userAgent; |
|
127 | + |
|
128 | + return $this; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * @return mixed |
|
133 | + */ |
|
134 | + public function getIp() |
|
135 | + { |
|
136 | + return $this->ip; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @param mixed $ip |
|
141 | + * @return AccountToken |
|
142 | + */ |
|
143 | + public function setIp($ip) |
|
144 | + { |
|
145 | + $this->ip = $ip; |
|
146 | + |
|
147 | + return $this; |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * Set Account entity (many to one). |
|
152 | + * |
|
153 | + * @param Account $account |
|
154 | + * @return AccountToken |
|
155 | + */ |
|
156 | + public function setAccount(Account $account = null) |
|
157 | + { |
|
158 | + $this->account = $account; |
|
159 | + |
|
160 | + return $this; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Get Account entity (many to one). |
|
165 | + * |
|
166 | + * @return Account |
|
167 | + */ |
|
168 | + public function getAccount() |
|
169 | + { |
|
170 | + return $this->account; |
|
171 | + } |
|
172 | 172 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Account implements UserInterface, \Serializable |
14 | 14 | { |
15 | - use GuidTrait; |
|
16 | - use CreatedUpdatedTrait; |
|
15 | + use GuidTrait; |
|
16 | + use CreatedUpdatedTrait; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @ORM\Id |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | */ |
48 | 48 | private $isActive; |
49 | 49 | |
50 | - /** |
|
51 | - * @ORM\Column(type="datetime", nullable=true) |
|
52 | - */ |
|
53 | - protected $last_connection; |
|
50 | + /** |
|
51 | + * @ORM\Column(type="datetime", nullable=true) |
|
52 | + */ |
|
53 | + protected $last_connection; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @ORM\OneToMany(targetEntity="AccountToken", mappedBy="account") |
|
57 | - * @ORM\JoinColumn(name="id", referencedColumnName="account_id", nullable=false) |
|
58 | - */ |
|
59 | - protected $tokens; |
|
55 | + /** |
|
56 | + * @ORM\OneToMany(targetEntity="AccountToken", mappedBy="account") |
|
57 | + * @ORM\JoinColumn(name="id", referencedColumnName="account_id", nullable=false) |
|
58 | + */ |
|
59 | + protected $tokens; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @var User |
@@ -187,43 +187,43 @@ discard block |
||
187 | 187 | $this->user = $user; |
188 | 188 | } |
189 | 189 | |
190 | - /** |
|
191 | - * @return mixed |
|
192 | - */ |
|
193 | - public function getLastConnection() |
|
194 | - { |
|
195 | - return $this->last_connection; |
|
196 | - } |
|
190 | + /** |
|
191 | + * @return mixed |
|
192 | + */ |
|
193 | + public function getLastConnection() |
|
194 | + { |
|
195 | + return $this->last_connection; |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * @param mixed $last_connection |
|
200 | - * @return Account |
|
201 | - */ |
|
202 | - public function setLastConnection($last_connection) |
|
203 | - { |
|
204 | - $this->last_connection = $last_connection; |
|
198 | + /** |
|
199 | + * @param mixed $last_connection |
|
200 | + * @return Account |
|
201 | + */ |
|
202 | + public function setLastConnection($last_connection) |
|
203 | + { |
|
204 | + $this->last_connection = $last_connection; |
|
205 | 205 | |
206 | - return $this; |
|
207 | - } |
|
206 | + return $this; |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * @return mixed |
|
211 | - */ |
|
212 | - public function getTokens() |
|
213 | - { |
|
214 | - return $this->tokens; |
|
215 | - } |
|
209 | + /** |
|
210 | + * @return mixed |
|
211 | + */ |
|
212 | + public function getTokens() |
|
213 | + { |
|
214 | + return $this->tokens; |
|
215 | + } |
|
216 | 216 | |
217 | - /** |
|
218 | - * @param mixed $tokens |
|
219 | - * @return Account |
|
220 | - */ |
|
221 | - public function setTokens($tokens) |
|
222 | - { |
|
223 | - $this->tokens = $tokens; |
|
217 | + /** |
|
218 | + * @param mixed $tokens |
|
219 | + * @return Account |
|
220 | + */ |
|
221 | + public function setTokens($tokens) |
|
222 | + { |
|
223 | + $this->tokens = $tokens; |
|
224 | 224 | |
225 | - return $this; |
|
226 | - } |
|
225 | + return $this; |
|
226 | + } |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Returns the roles granted to the user. |
@@ -14,297 +14,297 @@ |
||
14 | 14 | */ |
15 | 15 | class Module |
16 | 16 | { |
17 | - use GuidTrait; |
|
18 | - use CreatedUpdatedTrait; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var integer |
|
22 | - * |
|
23 | - * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
24 | - * @ORM\Id |
|
25 | - * @ORM\GeneratedValue(strategy="IDENTITY") |
|
26 | - */ |
|
27 | - private $id; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string |
|
31 | - * |
|
32 | - * @ORM\Column(name="package_name", type="string", length=255, nullable=false) |
|
33 | - */ |
|
34 | - private $packageName; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string |
|
38 | - * |
|
39 | - * @ORM\Column(name="title_tag", type="string", length=70, nullable=true) |
|
40 | - */ |
|
41 | - private $titleTag; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var string |
|
45 | - * |
|
46 | - * @ORM\Column(name="description_tag", type="string", length=160, nullable=true) |
|
47 | - */ |
|
48 | - private $descriptionTag; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var string |
|
52 | - * |
|
53 | - * @ORM\Column(name="title", type="string", length=255, nullable=false) |
|
54 | - */ |
|
55 | - private $title; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var string |
|
59 | - * |
|
60 | - * @ORM\Column(name="template", type="string", length=255, nullable=true) |
|
61 | - */ |
|
62 | - private $template; |
|
63 | - |
|
64 | - /** |
|
65 | - * @var string |
|
66 | - * |
|
67 | - * @ORM\Column(name="url", type="string", length=255, nullable=true) |
|
68 | - */ |
|
69 | - private $url; |
|
70 | - |
|
71 | - /** |
|
72 | - * @var string |
|
73 | - * |
|
74 | - * @ORM\Column(name="url_admin", type="string", length=255, nullable=true) |
|
75 | - */ |
|
76 | - private $urlAdmin; |
|
77 | - |
|
78 | - /** |
|
79 | - * @var boolean |
|
80 | - * |
|
81 | - * @ORM\Column(name="active", type="boolean", nullable=false) |
|
82 | - */ |
|
83 | - private $active; |
|
84 | - |
|
85 | - /** |
|
86 | - * @var integer |
|
87 | - * |
|
88 | - * @ORM\Column(name="`order`", type="integer", nullable=true) |
|
89 | - */ |
|
90 | - private $order; |
|
91 | - |
|
92 | - /** |
|
93 | - * @var boolean |
|
94 | - * |
|
95 | - * @ORM\Column(name="displayed", type="boolean", nullable=false) |
|
96 | - */ |
|
97 | - private $displayed; |
|
98 | - |
|
99 | - /** |
|
100 | - * @var boolean |
|
101 | - * |
|
102 | - * @ORM\Column(name="dev_mode", type="boolean", nullable=false) |
|
103 | - */ |
|
104 | - private $devMode = false; |
|
105 | - |
|
106 | - /** |
|
107 | - * @return int |
|
108 | - */ |
|
109 | - public function getId(): int |
|
110 | - { |
|
111 | - return $this->id; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * @param int $id |
|
116 | - */ |
|
117 | - public function setId(int $id) |
|
118 | - { |
|
119 | - $this->id = $id; |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @return string |
|
124 | - */ |
|
125 | - public function getPackageName(): ?string |
|
126 | - { |
|
127 | - return $this->packageName; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @param string $package_name |
|
132 | - */ |
|
133 | - public function setPackageName(string $package_name) |
|
134 | - { |
|
135 | - $this->packageName = $package_name; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @return string |
|
140 | - */ |
|
141 | - public function getTitleTag(): ?string |
|
142 | - { |
|
143 | - return $this->titleTag; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @param string $titleTag |
|
148 | - */ |
|
149 | - public function setTitleTag(string $titleTag) |
|
150 | - { |
|
151 | - $this->titleTag = $titleTag; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * @return string |
|
156 | - */ |
|
157 | - public function getDescriptionTag(): ?string |
|
158 | - { |
|
159 | - return $this->descriptionTag; |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * @param string $descriptionTag |
|
164 | - */ |
|
165 | - public function setDescriptionTag(string $descriptionTag) |
|
166 | - { |
|
167 | - $this->descriptionTag = $descriptionTag; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function getTitle(): ?string |
|
174 | - { |
|
175 | - return $this->title; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @param string $title |
|
180 | - */ |
|
181 | - public function setTitle(string $title) |
|
182 | - { |
|
183 | - $this->title = $title; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * @return string |
|
188 | - */ |
|
189 | - public function getTemplate(): ?string |
|
190 | - { |
|
191 | - return $this->template; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * @param string $template |
|
196 | - */ |
|
197 | - public function setTemplate(string $template) |
|
198 | - { |
|
199 | - $this->template = $template; |
|
200 | - } |
|
201 | - |
|
202 | - /** |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - public function getUrl(): ?string |
|
206 | - { |
|
207 | - return $this->url; |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * @param string $url |
|
212 | - */ |
|
213 | - public function setUrl(string $url) |
|
214 | - { |
|
215 | - $this->url = $url; |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * @return string |
|
220 | - */ |
|
221 | - public function getUrlAdmin(): ?string |
|
222 | - { |
|
223 | - return $this->urlAdmin; |
|
224 | - } |
|
225 | - |
|
226 | - /** |
|
227 | - * @param string $urlAdmin |
|
228 | - */ |
|
229 | - public function setUrlAdmin(string $urlAdmin) |
|
230 | - { |
|
231 | - $this->urlAdmin = $urlAdmin; |
|
232 | - } |
|
233 | - |
|
234 | - /** |
|
235 | - * @return boolean |
|
236 | - */ |
|
237 | - public function getActive(): ?bool |
|
238 | - { |
|
239 | - return $this->active; |
|
240 | - } |
|
241 | - |
|
242 | - /** |
|
243 | - * @param bool $active |
|
244 | - */ |
|
245 | - public function setActive(bool $active) |
|
246 | - { |
|
247 | - $this->active = $active; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * @return int |
|
252 | - */ |
|
253 | - public function getOrder(): ?int |
|
254 | - { |
|
255 | - return $this->order; |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * @param int $order |
|
260 | - */ |
|
261 | - public function setOrder(int $order) |
|
262 | - { |
|
263 | - $this->order = $order; |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * @return bool |
|
268 | - */ |
|
269 | - public function getDisplayed(): ?bool |
|
270 | - { |
|
271 | - return $this->displayed; |
|
272 | - } |
|
273 | - |
|
274 | - /** |
|
275 | - * @param bool $displayed |
|
276 | - */ |
|
277 | - public function setDisplayed(bool $displayed) |
|
278 | - { |
|
279 | - $this->displayed = $displayed; |
|
280 | - } |
|
281 | - |
|
282 | - /** |
|
283 | - * @return bool |
|
284 | - */ |
|
285 | - public function getDevMode(): bool |
|
286 | - { |
|
287 | - return $this->devMode; |
|
288 | - } |
|
289 | - |
|
290 | - /** |
|
291 | - * @param bool $devMode |
|
292 | - * @return Module |
|
293 | - */ |
|
294 | - public function setDevMode(bool $devMode): Module |
|
295 | - { |
|
296 | - $this->devMode = $devMode; |
|
297 | - |
|
298 | - return $this; |
|
299 | - } |
|
300 | - |
|
301 | - public function getFormattedActive() |
|
302 | - { |
|
303 | - return $this->getActive() ? "Oui" : "Non"; |
|
304 | - } |
|
305 | - |
|
306 | - public function getFormattedDisplayed() |
|
307 | - { |
|
308 | - return $this->getDisplayed() ? "Oui" : "Non"; |
|
309 | - } |
|
17 | + use GuidTrait; |
|
18 | + use CreatedUpdatedTrait; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var integer |
|
22 | + * |
|
23 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
24 | + * @ORM\Id |
|
25 | + * @ORM\GeneratedValue(strategy="IDENTITY") |
|
26 | + */ |
|
27 | + private $id; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + * |
|
32 | + * @ORM\Column(name="package_name", type="string", length=255, nullable=false) |
|
33 | + */ |
|
34 | + private $packageName; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + * |
|
39 | + * @ORM\Column(name="title_tag", type="string", length=70, nullable=true) |
|
40 | + */ |
|
41 | + private $titleTag; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + * |
|
46 | + * @ORM\Column(name="description_tag", type="string", length=160, nullable=true) |
|
47 | + */ |
|
48 | + private $descriptionTag; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + * |
|
53 | + * @ORM\Column(name="title", type="string", length=255, nullable=false) |
|
54 | + */ |
|
55 | + private $title; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var string |
|
59 | + * |
|
60 | + * @ORM\Column(name="template", type="string", length=255, nullable=true) |
|
61 | + */ |
|
62 | + private $template; |
|
63 | + |
|
64 | + /** |
|
65 | + * @var string |
|
66 | + * |
|
67 | + * @ORM\Column(name="url", type="string", length=255, nullable=true) |
|
68 | + */ |
|
69 | + private $url; |
|
70 | + |
|
71 | + /** |
|
72 | + * @var string |
|
73 | + * |
|
74 | + * @ORM\Column(name="url_admin", type="string", length=255, nullable=true) |
|
75 | + */ |
|
76 | + private $urlAdmin; |
|
77 | + |
|
78 | + /** |
|
79 | + * @var boolean |
|
80 | + * |
|
81 | + * @ORM\Column(name="active", type="boolean", nullable=false) |
|
82 | + */ |
|
83 | + private $active; |
|
84 | + |
|
85 | + /** |
|
86 | + * @var integer |
|
87 | + * |
|
88 | + * @ORM\Column(name="`order`", type="integer", nullable=true) |
|
89 | + */ |
|
90 | + private $order; |
|
91 | + |
|
92 | + /** |
|
93 | + * @var boolean |
|
94 | + * |
|
95 | + * @ORM\Column(name="displayed", type="boolean", nullable=false) |
|
96 | + */ |
|
97 | + private $displayed; |
|
98 | + |
|
99 | + /** |
|
100 | + * @var boolean |
|
101 | + * |
|
102 | + * @ORM\Column(name="dev_mode", type="boolean", nullable=false) |
|
103 | + */ |
|
104 | + private $devMode = false; |
|
105 | + |
|
106 | + /** |
|
107 | + * @return int |
|
108 | + */ |
|
109 | + public function getId(): int |
|
110 | + { |
|
111 | + return $this->id; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * @param int $id |
|
116 | + */ |
|
117 | + public function setId(int $id) |
|
118 | + { |
|
119 | + $this->id = $id; |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @return string |
|
124 | + */ |
|
125 | + public function getPackageName(): ?string |
|
126 | + { |
|
127 | + return $this->packageName; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @param string $package_name |
|
132 | + */ |
|
133 | + public function setPackageName(string $package_name) |
|
134 | + { |
|
135 | + $this->packageName = $package_name; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @return string |
|
140 | + */ |
|
141 | + public function getTitleTag(): ?string |
|
142 | + { |
|
143 | + return $this->titleTag; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @param string $titleTag |
|
148 | + */ |
|
149 | + public function setTitleTag(string $titleTag) |
|
150 | + { |
|
151 | + $this->titleTag = $titleTag; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * @return string |
|
156 | + */ |
|
157 | + public function getDescriptionTag(): ?string |
|
158 | + { |
|
159 | + return $this->descriptionTag; |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * @param string $descriptionTag |
|
164 | + */ |
|
165 | + public function setDescriptionTag(string $descriptionTag) |
|
166 | + { |
|
167 | + $this->descriptionTag = $descriptionTag; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function getTitle(): ?string |
|
174 | + { |
|
175 | + return $this->title; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @param string $title |
|
180 | + */ |
|
181 | + public function setTitle(string $title) |
|
182 | + { |
|
183 | + $this->title = $title; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * @return string |
|
188 | + */ |
|
189 | + public function getTemplate(): ?string |
|
190 | + { |
|
191 | + return $this->template; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * @param string $template |
|
196 | + */ |
|
197 | + public function setTemplate(string $template) |
|
198 | + { |
|
199 | + $this->template = $template; |
|
200 | + } |
|
201 | + |
|
202 | + /** |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + public function getUrl(): ?string |
|
206 | + { |
|
207 | + return $this->url; |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * @param string $url |
|
212 | + */ |
|
213 | + public function setUrl(string $url) |
|
214 | + { |
|
215 | + $this->url = $url; |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * @return string |
|
220 | + */ |
|
221 | + public function getUrlAdmin(): ?string |
|
222 | + { |
|
223 | + return $this->urlAdmin; |
|
224 | + } |
|
225 | + |
|
226 | + /** |
|
227 | + * @param string $urlAdmin |
|
228 | + */ |
|
229 | + public function setUrlAdmin(string $urlAdmin) |
|
230 | + { |
|
231 | + $this->urlAdmin = $urlAdmin; |
|
232 | + } |
|
233 | + |
|
234 | + /** |
|
235 | + * @return boolean |
|
236 | + */ |
|
237 | + public function getActive(): ?bool |
|
238 | + { |
|
239 | + return $this->active; |
|
240 | + } |
|
241 | + |
|
242 | + /** |
|
243 | + * @param bool $active |
|
244 | + */ |
|
245 | + public function setActive(bool $active) |
|
246 | + { |
|
247 | + $this->active = $active; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * @return int |
|
252 | + */ |
|
253 | + public function getOrder(): ?int |
|
254 | + { |
|
255 | + return $this->order; |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * @param int $order |
|
260 | + */ |
|
261 | + public function setOrder(int $order) |
|
262 | + { |
|
263 | + $this->order = $order; |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * @return bool |
|
268 | + */ |
|
269 | + public function getDisplayed(): ?bool |
|
270 | + { |
|
271 | + return $this->displayed; |
|
272 | + } |
|
273 | + |
|
274 | + /** |
|
275 | + * @param bool $displayed |
|
276 | + */ |
|
277 | + public function setDisplayed(bool $displayed) |
|
278 | + { |
|
279 | + $this->displayed = $displayed; |
|
280 | + } |
|
281 | + |
|
282 | + /** |
|
283 | + * @return bool |
|
284 | + */ |
|
285 | + public function getDevMode(): bool |
|
286 | + { |
|
287 | + return $this->devMode; |
|
288 | + } |
|
289 | + |
|
290 | + /** |
|
291 | + * @param bool $devMode |
|
292 | + * @return Module |
|
293 | + */ |
|
294 | + public function setDevMode(bool $devMode): Module |
|
295 | + { |
|
296 | + $this->devMode = $devMode; |
|
297 | + |
|
298 | + return $this; |
|
299 | + } |
|
300 | + |
|
301 | + public function getFormattedActive() |
|
302 | + { |
|
303 | + return $this->getActive() ? "Oui" : "Non"; |
|
304 | + } |
|
305 | + |
|
306 | + public function getFormattedDisplayed() |
|
307 | + { |
|
308 | + return $this->getDisplayed() ? "Oui" : "Non"; |
|
309 | + } |
|
310 | 310 | } |
@@ -14,45 +14,45 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class Page |
16 | 16 | { |
17 | - use GuidTrait; |
|
18 | - use CreatedUpdatedTrait; |
|
17 | + use GuidTrait; |
|
18 | + use CreatedUpdatedTrait; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @var integer |
|
22 | - * |
|
23 | - * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
24 | - * @ORM\Id |
|
25 | - * @ORM\GeneratedValue(strategy="IDENTITY") |
|
26 | - */ |
|
27 | - private $id; |
|
20 | + /** |
|
21 | + * @var integer |
|
22 | + * |
|
23 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
24 | + * @ORM\Id |
|
25 | + * @ORM\GeneratedValue(strategy="IDENTITY") |
|
26 | + */ |
|
27 | + private $id; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - * |
|
32 | - * @ORM\Column(name="title_tag", type="string", length=70, nullable=true) |
|
33 | - */ |
|
34 | - private $titleTag; |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + * |
|
32 | + * @ORM\Column(name="title_tag", type="string", length=70, nullable=true) |
|
33 | + */ |
|
34 | + private $titleTag; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - * |
|
39 | - * @ORM\Column(name="description_tag", type="string", length=160, nullable=true) |
|
40 | - */ |
|
41 | - private $descriptionTag; |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + * |
|
39 | + * @ORM\Column(name="description_tag", type="string", length=160, nullable=true) |
|
40 | + */ |
|
41 | + private $descriptionTag; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var string |
|
45 | - * |
|
46 | - * @ORM\Column(name="title", type="string", length=255, nullable=false) |
|
47 | - */ |
|
48 | - private $title; |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + * |
|
46 | + * @ORM\Column(name="title", type="string", length=255, nullable=false) |
|
47 | + */ |
|
48 | + private $title; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @var string |
52 | 52 | * |
53 | 53 | * @ORM\Column(name="template", type="string", length=255, nullable=false) |
54 | 54 | */ |
55 | - private $template; |
|
55 | + private $template; |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @var string |
@@ -61,107 +61,107 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private $url; |
63 | 63 | |
64 | - /** |
|
65 | - * @var string |
|
66 | - * |
|
67 | - * @ORM\Column(name="content", type="text", nullable=true) |
|
68 | - */ |
|
69 | - private $content; |
|
64 | + /** |
|
65 | + * @var string |
|
66 | + * |
|
67 | + * @ORM\Column(name="content", type="text", nullable=true) |
|
68 | + */ |
|
69 | + private $content; |
|
70 | 70 | |
71 | - /** |
|
72 | - * @var integer |
|
73 | - * |
|
74 | - * @ORM\Column(name="active", type="integer", nullable=false) |
|
75 | - */ |
|
76 | - private $active; |
|
71 | + /** |
|
72 | + * @var integer |
|
73 | + * |
|
74 | + * @ORM\Column(name="active", type="integer", nullable=false) |
|
75 | + */ |
|
76 | + private $active; |
|
77 | 77 | |
78 | - /** |
|
79 | - * @var integer |
|
80 | - * |
|
81 | - * @ORM\Column(name="order", type="integer", nullable=false) |
|
82 | - */ |
|
83 | - private $order; |
|
78 | + /** |
|
79 | + * @var integer |
|
80 | + * |
|
81 | + * @ORM\Column(name="order", type="integer", nullable=false) |
|
82 | + */ |
|
83 | + private $order; |
|
84 | 84 | |
85 | - /** |
|
86 | - * @var integer |
|
87 | - * |
|
88 | - * @ORM\Column(name="displayed", type="integer", nullable=false) |
|
89 | - */ |
|
90 | - private $displayed; |
|
85 | + /** |
|
86 | + * @var integer |
|
87 | + * |
|
88 | + * @ORM\Column(name="displayed", type="integer", nullable=false) |
|
89 | + */ |
|
90 | + private $displayed; |
|
91 | 91 | |
92 | - /** |
|
93 | - * @var \Page |
|
94 | - * |
|
95 | - * @ORM\ManyToOne(targetEntity="Page") |
|
96 | - * @ORM\JoinColumns({ |
|
97 | - * @ORM\JoinColumn(name="parent", referencedColumnName="id") |
|
98 | - * }) |
|
99 | - */ |
|
100 | - private $parent; |
|
92 | + /** |
|
93 | + * @var \Page |
|
94 | + * |
|
95 | + * @ORM\ManyToOne(targetEntity="Page") |
|
96 | + * @ORM\JoinColumns({ |
|
97 | + * @ORM\JoinColumn(name="parent", referencedColumnName="id") |
|
98 | + * }) |
|
99 | + */ |
|
100 | + private $parent; |
|
101 | 101 | |
102 | - /** |
|
103 | - * @return int |
|
104 | - */ |
|
105 | - public function getId() |
|
106 | - { |
|
107 | - return $this->id; |
|
108 | - } |
|
102 | + /** |
|
103 | + * @return int |
|
104 | + */ |
|
105 | + public function getId() |
|
106 | + { |
|
107 | + return $this->id; |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * @param int $id |
|
112 | - */ |
|
113 | - public function setId($id) |
|
114 | - { |
|
115 | - $this->id = $id; |
|
116 | - } |
|
110 | + /** |
|
111 | + * @param int $id |
|
112 | + */ |
|
113 | + public function setId($id) |
|
114 | + { |
|
115 | + $this->id = $id; |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public function getTitleTag() |
|
122 | - { |
|
123 | - return $this->titleTag; |
|
124 | - } |
|
118 | + /** |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public function getTitleTag() |
|
122 | + { |
|
123 | + return $this->titleTag; |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * @param string $titleTag |
|
128 | - */ |
|
129 | - public function setTitleTag($titleTag) |
|
130 | - { |
|
131 | - $this->titleTag = $titleTag; |
|
132 | - } |
|
126 | + /** |
|
127 | + * @param string $titleTag |
|
128 | + */ |
|
129 | + public function setTitleTag($titleTag) |
|
130 | + { |
|
131 | + $this->titleTag = $titleTag; |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function getDescriptionTag() |
|
138 | - { |
|
139 | - return $this->descriptionTag; |
|
140 | - } |
|
134 | + /** |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function getDescriptionTag() |
|
138 | + { |
|
139 | + return $this->descriptionTag; |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * @param string $descriptionTag |
|
144 | - */ |
|
145 | - public function setDescriptionTag($descriptionTag) |
|
146 | - { |
|
147 | - $this->descriptionTag = $descriptionTag; |
|
148 | - } |
|
142 | + /** |
|
143 | + * @param string $descriptionTag |
|
144 | + */ |
|
145 | + public function setDescriptionTag($descriptionTag) |
|
146 | + { |
|
147 | + $this->descriptionTag = $descriptionTag; |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * @return string |
|
152 | - */ |
|
153 | - public function getTitle() |
|
154 | - { |
|
155 | - return $this->title; |
|
156 | - } |
|
150 | + /** |
|
151 | + * @return string |
|
152 | + */ |
|
153 | + public function getTitle() |
|
154 | + { |
|
155 | + return $this->title; |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * @param string $title |
|
160 | - */ |
|
161 | - public function setTitle($title) |
|
162 | - { |
|
163 | - $this->title = $title; |
|
164 | - } |
|
158 | + /** |
|
159 | + * @param string $title |
|
160 | + */ |
|
161 | + public function setTitle($title) |
|
162 | + { |
|
163 | + $this->title = $title; |
|
164 | + } |
|
165 | 165 | |
166 | 166 | /** |
167 | 167 | * @return string |
@@ -195,84 +195,84 @@ discard block |
||
195 | 195 | $this->url = $url; |
196 | 196 | } |
197 | 197 | |
198 | - /** |
|
199 | - * @return string |
|
200 | - */ |
|
201 | - public function getContent() |
|
202 | - { |
|
203 | - return $this->content; |
|
204 | - } |
|
198 | + /** |
|
199 | + * @return string |
|
200 | + */ |
|
201 | + public function getContent() |
|
202 | + { |
|
203 | + return $this->content; |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * @param string $content |
|
208 | - */ |
|
209 | - public function setContent($content) |
|
210 | - { |
|
211 | - $this->content = $content; |
|
212 | - } |
|
206 | + /** |
|
207 | + * @param string $content |
|
208 | + */ |
|
209 | + public function setContent($content) |
|
210 | + { |
|
211 | + $this->content = $content; |
|
212 | + } |
|
213 | 213 | |
214 | - /** |
|
215 | - * @return int |
|
216 | - */ |
|
217 | - public function getActive() |
|
218 | - { |
|
219 | - return $this->active; |
|
220 | - } |
|
214 | + /** |
|
215 | + * @return int |
|
216 | + */ |
|
217 | + public function getActive() |
|
218 | + { |
|
219 | + return $this->active; |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
223 | - * @param int $active |
|
224 | - */ |
|
225 | - public function setActive($active) |
|
226 | - { |
|
227 | - $this->active = $active; |
|
228 | - } |
|
222 | + /** |
|
223 | + * @param int $active |
|
224 | + */ |
|
225 | + public function setActive($active) |
|
226 | + { |
|
227 | + $this->active = $active; |
|
228 | + } |
|
229 | 229 | |
230 | - /** |
|
231 | - * @return int |
|
232 | - */ |
|
233 | - public function getOrder() |
|
234 | - { |
|
235 | - return $this->order; |
|
236 | - } |
|
230 | + /** |
|
231 | + * @return int |
|
232 | + */ |
|
233 | + public function getOrder() |
|
234 | + { |
|
235 | + return $this->order; |
|
236 | + } |
|
237 | 237 | |
238 | - /** |
|
239 | - * @param int $order |
|
240 | - */ |
|
241 | - public function setOrder($order) |
|
242 | - { |
|
243 | - $this->order = $order; |
|
244 | - } |
|
238 | + /** |
|
239 | + * @param int $order |
|
240 | + */ |
|
241 | + public function setOrder($order) |
|
242 | + { |
|
243 | + $this->order = $order; |
|
244 | + } |
|
245 | 245 | |
246 | - /** |
|
247 | - * @return int |
|
248 | - */ |
|
249 | - public function getDisplayed() |
|
250 | - { |
|
251 | - return $this->displayed; |
|
252 | - } |
|
246 | + /** |
|
247 | + * @return int |
|
248 | + */ |
|
249 | + public function getDisplayed() |
|
250 | + { |
|
251 | + return $this->displayed; |
|
252 | + } |
|
253 | 253 | |
254 | - /** |
|
255 | - * @param int $displayed |
|
256 | - */ |
|
257 | - public function setDisplayed($displayed) |
|
258 | - { |
|
259 | - $this->displayed = $displayed; |
|
260 | - } |
|
254 | + /** |
|
255 | + * @param int $displayed |
|
256 | + */ |
|
257 | + public function setDisplayed($displayed) |
|
258 | + { |
|
259 | + $this->displayed = $displayed; |
|
260 | + } |
|
261 | 261 | |
262 | - /** |
|
263 | - * @return \Page |
|
264 | - */ |
|
265 | - public function getParent() |
|
266 | - { |
|
267 | - return $this->parent; |
|
268 | - } |
|
262 | + /** |
|
263 | + * @return \Page |
|
264 | + */ |
|
265 | + public function getParent() |
|
266 | + { |
|
267 | + return $this->parent; |
|
268 | + } |
|
269 | 269 | |
270 | - /** |
|
271 | - * @param \Page $parent |
|
272 | - */ |
|
273 | - public function setParent($parent) |
|
274 | - { |
|
275 | - $this->parent = $parent; |
|
276 | - } |
|
270 | + /** |
|
271 | + * @param \Page $parent |
|
272 | + */ |
|
273 | + public function setParent($parent) |
|
274 | + { |
|
275 | + $this->parent = $parent; |
|
276 | + } |
|
277 | 277 | } |
278 | 278 |
@@ -13,130 +13,130 @@ |
||
13 | 13 | */ |
14 | 14 | class UserLogs |
15 | 15 | { |
16 | - use GuidTrait; |
|
17 | - use CreatedUpdatedTrait; |
|
18 | - |
|
19 | - /** |
|
20 | - * @var integer |
|
21 | - * |
|
22 | - * @ORM\Column(name="id", type="integer", nullable=false) |
|
23 | - * @ORM\Id |
|
24 | - * @ORM\GeneratedValue(strategy="IDENTITY") |
|
25 | - */ |
|
26 | - private $id; |
|
27 | - |
|
28 | - /** |
|
29 | - * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
30 | - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) |
|
31 | - */ |
|
32 | - private $user; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var string |
|
36 | - * |
|
37 | - * @ORM\Column(name="method", type="string", length=255, nullable=false) |
|
38 | - */ |
|
39 | - private $method; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var string |
|
43 | - * |
|
44 | - * @ORM\Column(name="url", type="string", length=255, nullable=false) |
|
45 | - */ |
|
46 | - private $url; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var string |
|
50 | - * |
|
51 | - * @ORM\Column(name="equest_parameters", type="json", nullable=true) |
|
52 | - */ |
|
53 | - private $request_parameters; |
|
54 | - |
|
55 | - /** |
|
56 | - * @return int |
|
57 | - */ |
|
58 | - public function getId() |
|
59 | - { |
|
60 | - return $this->id; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * @param int $id |
|
65 | - */ |
|
66 | - public function setId($id) |
|
67 | - { |
|
68 | - $this->id = $id; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @return User |
|
73 | - */ |
|
74 | - public function getUser(): User |
|
75 | - { |
|
76 | - return $this->user; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @param \User $user |
|
81 | - */ |
|
82 | - public function setUser($user) |
|
83 | - { |
|
84 | - $this->user = $user; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function getMethod(): string |
|
91 | - { |
|
92 | - return $this->method; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * @param string $method |
|
97 | - * @return UserLogs |
|
98 | - */ |
|
99 | - public function setMethod(string $method): UserLogs |
|
100 | - { |
|
101 | - $this->method = $method; |
|
102 | - |
|
103 | - return $this; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - public function getUrl(): string |
|
110 | - { |
|
111 | - return $this->url; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * @param string $url |
|
116 | - * @return UserLogs |
|
117 | - */ |
|
118 | - public function setUrl(string $url): UserLogs |
|
119 | - { |
|
120 | - $this->url = $url; |
|
121 | - |
|
122 | - return $this; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - public function getRequestParameters() |
|
127 | - { |
|
128 | - return $this->request_parameters; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * @param $request_parameters |
|
133 | - * @return UserLogs |
|
134 | - */ |
|
135 | - public function setRequestParameters($request_parameters): UserLogs |
|
136 | - { |
|
137 | - $this->request_parameters = $request_parameters; |
|
138 | - |
|
139 | - return $this; |
|
140 | - } |
|
16 | + use GuidTrait; |
|
17 | + use CreatedUpdatedTrait; |
|
18 | + |
|
19 | + /** |
|
20 | + * @var integer |
|
21 | + * |
|
22 | + * @ORM\Column(name="id", type="integer", nullable=false) |
|
23 | + * @ORM\Id |
|
24 | + * @ORM\GeneratedValue(strategy="IDENTITY") |
|
25 | + */ |
|
26 | + private $id; |
|
27 | + |
|
28 | + /** |
|
29 | + * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
30 | + * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) |
|
31 | + */ |
|
32 | + private $user; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + * |
|
37 | + * @ORM\Column(name="method", type="string", length=255, nullable=false) |
|
38 | + */ |
|
39 | + private $method; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + * |
|
44 | + * @ORM\Column(name="url", type="string", length=255, nullable=false) |
|
45 | + */ |
|
46 | + private $url; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + * |
|
51 | + * @ORM\Column(name="equest_parameters", type="json", nullable=true) |
|
52 | + */ |
|
53 | + private $request_parameters; |
|
54 | + |
|
55 | + /** |
|
56 | + * @return int |
|
57 | + */ |
|
58 | + public function getId() |
|
59 | + { |
|
60 | + return $this->id; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * @param int $id |
|
65 | + */ |
|
66 | + public function setId($id) |
|
67 | + { |
|
68 | + $this->id = $id; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @return User |
|
73 | + */ |
|
74 | + public function getUser(): User |
|
75 | + { |
|
76 | + return $this->user; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @param \User $user |
|
81 | + */ |
|
82 | + public function setUser($user) |
|
83 | + { |
|
84 | + $this->user = $user; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function getMethod(): string |
|
91 | + { |
|
92 | + return $this->method; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * @param string $method |
|
97 | + * @return UserLogs |
|
98 | + */ |
|
99 | + public function setMethod(string $method): UserLogs |
|
100 | + { |
|
101 | + $this->method = $method; |
|
102 | + |
|
103 | + return $this; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + public function getUrl(): string |
|
110 | + { |
|
111 | + return $this->url; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * @param string $url |
|
116 | + * @return UserLogs |
|
117 | + */ |
|
118 | + public function setUrl(string $url): UserLogs |
|
119 | + { |
|
120 | + $this->url = $url; |
|
121 | + |
|
122 | + return $this; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + public function getRequestParameters() |
|
127 | + { |
|
128 | + return $this->request_parameters; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * @param $request_parameters |
|
133 | + * @return UserLogs |
|
134 | + */ |
|
135 | + public function setRequestParameters($request_parameters): UserLogs |
|
136 | + { |
|
137 | + $this->request_parameters = $request_parameters; |
|
138 | + |
|
139 | + return $this; |
|
140 | + } |
|
141 | 141 | } |
142 | 142 |
@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 15 | class Navigation |
16 | 16 | { |
17 | - use GuidTrait; |
|
18 | - use CreatedUpdatedTrait; |
|
17 | + use GuidTrait; |
|
18 | + use CreatedUpdatedTrait; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var integer |