I'm using Extbase in TYPO3.
I want to create some repository function which can get a random record from the database.
Is there a way to resolve this with the Extbase Query Language?
Look at this issue:
http://forge.typo3.org/issues/14026
Seems like this is still a problem in Extbase.
But there is some workarounds like this one:
http://typo3blogger.de/random-record-repository/
Related
I am very new to the laravel,i am using l5-repository package for orderBy and sortedBy to sort columns ,while hitting API i am getting following error please help me to resolve the issue
my API URL :-http://localhost.com/v1/domain?limit=250&page=1&orderBy=users|name&sortedBy=desc
You probrably have an error in your table name. For default, laravel will look for cards table name for a model named Card. Also, take a look in your models name. I espect you misstype card.php because it should be Card.php. Laravel uses a lot of psr convention and Eloquent (who deal with relationships and that stuff). If you are not well versed into it, take a look in how to name classes. As Alireza said, take a look in the Laravel's documentation, it is awesome and complete. When you have a one to many realtionship, one of they should have a hasMany(...) instead belongsTo(....)
I am going to use the JQuery Query Builder plugin in my project. I want to know how query will generate for relational table.
For example, I have two tables user and user_emails. I want to filter those users which have an email address. To get this result, I have to use subquery on user_emails table. Has that been possible by using this plugin? In the demo, I have not found this case.
Your question is vague. Do you want to build conditions in the jQuery-QueryBuilder for "All users with emails"? You also want the jQuery-QueryBuilder to look and return something like the following?
After you clarify the community can point you in the right direction.
I am trying to implement autocomplete with hanami-model and I am trying to find in documentation or google how fetch records using LIKE function.
I am trying to reflect following SQL query using hanami repositories:
SELECT * FROM users WHERE name LIKE '%a'
Do you know how to do this? Thanks for all answers.
Pavel is right, you can use repo.where { name.like(pattern) } code for work with LIKE/ILIKE.
Here you can find real example :)
I am working on a Joomla 3.2.1 site and the client, without thinking, entered in the same alias for all articles, instead of letting the system use the article title. So now if I want to turn on SEF URL's we are going to have 404 issues in the future.
I want to resave or regenerate all article aliases at once (batch).
Is there a way to do it? in the MYSQL DB maybe?
Thank you in advance.
$alias = JApplication::stringURLSafe($article->title);
Joomla will generate the alias when saving the article. I am not aware of any batch joomla feature to regenerate all the aliases and I would also be interested to know about this.
If no other batch solution exists, you should do manually the updates to these fields.
In the database, you could run update queries for all your articles, but you must type each update query one by one.
The update query for a single row would look like:
UPDATE jos_content
SET alias='my-new-alias-name'
WHERE id='{id-of-the-article}'
For multiple rows at once, you could do something like this:
UPDATE jos_content
SET alias = CASE id
WHEN 1 THEN 'alias1'
WHEN 2 THEN 'alias2'
WHEN 3 THEN 'alias3'
END
WHERE id IN (1,2,3)
What you could do is delete the alias data from all of your articles in the database using mysql. Then make a tag, like "fixalias." Using the batch processing feature tag all of the articles with that tag.
This will run store() for all of your articles and automatically generate the aliases. Then delete the tag from the tag manager.you ar
A similar strategy would involve also deleting all the aliases but batch moving (don't copy) your articles to a temporary category and then moving them back.
If I have tables in doctrine for user_1, user_2, etc. is there a way to dynamically set the table name in Doctrine for a single User model?
It's weird, I know. I'm trying to create an interface to a WordPress database (because WP has little to no API for directly accessing posts), and WP creates duplicate tables for each site, so there's a wp_posts, wp_comments, wp_2_posts, wp_2_comments, etc.
Here's what I ended up doing:
$post = new WordPressPost();
$post->setTableName('wp_'.$user_id.'_posts');
If it could, you would have to run migrations for each added/deleted user.
I am curious; why would you EVER need something like that?
I don't know how WP works, but here is the thing; each site should use it's OWN database, not to share it with others.