Thank you
Dear Hugo, thanks a lot for your nice work. Two remarks:
- With my xampp on windows the DS get backslash instead of slashes, so I had to change this.
- The link "new gallery" doesn't work with the Html-Helper, I had to do the link manually. I hope you understand. Sorry, my english ist terrible. Best wishes from Germany Gregor
getGallery() doesn't work. I get a Database Error ;-( Any idea what I am wrong? I attached a new gallery with my model and it works fine, but I can't list the gallery...
Did you go through readme file? Check if you database structure is correct: https://github.com/hugodias/cakegallery/blob/master/Config/cakegallery.sql
What kind of error you are getting?
Am 29.07.2014 12:44, schrieb mateuszgwozdz:
Did you go through readme file? Check if you database structure is correct: https://github.com/hugodias/cakegallery/blob/master/Config/cakegallery.sql
What kind of error you are getting?
— Reply to this email directly or view it on GitHub https://github.com/hugodias/cakegallery/issues/2#issuecomment-50460904.
I try to explain my app: I have a table Users an I would like to attach to every User one Album. It works fine, with the new gallery link. The album get created an the field model_id gets the correct the User_id. The pictures are stored in the correct file and get stored in the path-field in the gallery-pictures-table. Everything is fine. But if I
try to access the stored pictures and list them up for one specific User, I get the error, becauce I can't access the gallery_picture-table about my model Users. I can work around it by creating models for the gallery_pictures-table and the gallery-albums-table and by defining relations like _ User_ public $hasOne = array( 'Gallery_album' => array( 'className' => 'Gallery_album', 'foreignKey' => 'model_id', 'dependent' => true ) );
Gallery_album public $hasMany = array( 'Gallery_picture' => array( 'className' => 'Gallery_picture', 'foreignKey' => 'album_id', 'dependent' => true ) ); }
But I think, it should be possible to achieve the pictures by using your plugin or am I wrong?
@big-apple What happens if you do this?
Class User extends AppModel{
public $name = 'User';
public $actsAs = 'Gallery.Gallery';
}
$this->User->id = 1;
$this->User->getGallery();
This should list all galleries for this user, and each gallery will have many photos. is this what you want to do?
Am 29.07.2014 14:26, schrieb Hugo Dias:
@big-apple https://github.com/big-apple What happens if you do this?
|Class User extends AppModel{ public $name = 'User'; public $actsAs = 'Gallery.Gallery'; }
$this->User->id = 1; $this->User->getGallery(); |
This should list all galleries for this user, and each gallery will have many photos. is this what you want to do?
— Reply to this email directly or view it on GitHub https://github.com/hugodias/cakegallery/issues/2#issuecomment-50469143.
Okay, first thanks a lot for your answer. I have done:
- I wrote a function test in the UsersController: function test() { $this->User->id = 40; debug($this->User->read(null)); //$this->set('test', $this->User->getGallery()); $this->User->getGallery(); }
- My user-model contains: I have thrown out everything else.
The result:
array( 'User' => array( 'password' => '*****', 'id' => '40', 'username' => 'admin', 'created' => '2011-05-22 00:00:00', 'modified' => '2014-07-29 08:58:21', 'email' => '[email protected]', 'active' => true, 'title' => 'Hi, ihr da draussen', 'description' => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.', 'price' => '13', 'sex' => 'm', 'age' => '26', 'plz' => '18273' )
And then:
Database Error
*Error: * SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'getGallery' at line 1
*SQL Query: * getGallery
*Notice: * If you want to customize this error message, create app\View\Errors\pdo_error.ctp
Stack Trace
- CORE\Cake\Model\Datasource\DboSource.php line 458 http://localhost/begleitservice/users/test# → PDOStatement->execute(array) http://localhost/begleitservice/users/test#
- CORE\Cake\Model\Datasource\DboSource.php line 424 http://localhost/begleitservice/users/test# → DboSource->_execute(string, array) http://localhost/begleitservice/users/test#
- CORE\Cake\Model\Datasource\DboSource.php line 666 http://localhost/begleitservice/users/test# → DboSource->execute(string, array, array) http://localhost/begleitservice/users/test#
- CORE\Cake\Model\Datasource\DboSource.php line 609 http://localhost/begleitservice/users/test# → DboSource->fetchAll(string, array, array) http://localhost/begleitservice/users/test#
- CORE\Cake\Model\Model.php line 800 http://localhost/begleitservice/users/test# → DboSource->query(string, array, User) http://localhost/begleitservice/users/test#
- APP\Controller\UsersController.php line 290 http://localhost/begleitservice/users/test# → Model->__call(string, array) http://localhost/begleitservice/users/test#
- APP\Controller\UsersController.php line 290 http://localhost/begleitservice/users/test# → User->getGallery() http://localhost/begleitservice/users/test#
- [internal function] http://localhost/begleitservice/users/test# → UsersController->test() http://localhost/begleitservice/users/test#
- CORE\Cake\Controller\Controller.php line 490 http://localhost/begleitservice/users/test# → ReflectionMethod->invokeArgs(UsersController, array) http://localhost/begleitservice/users/test#
- CORE\Cake\Routing\Dispatcher.php line 191 http://localhost/begleitservice/users/test# → Controller->invokeAction(CakeRequest) http://localhost/begleitservice/users/test#
- CORE\Cake\Routing\Dispatcher.php line 165 http://localhost/begleitservice/users/test# → Dispatcher->_invoke(UsersController, CakeRequest) http://localhost/begleitservice/users/test#
- APP\webroot\index.php line 108 http://localhost/begleitservice/users/test# → Dispatcher->dispatch(CakeRequest, CakeResponse) http://localhost/begleitservice/users/test#
I hope it will help...